本文整理汇总了Python中triangle.detect_triangle函数的典型用法代码示例。如果您正苦于以下问题:Python detect_triangle函数的具体用法?Python detect_triangle怎么用?Python detect_triangle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了detect_triangle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testTGvuongcan
def testTGvuongcan(self): # Tam giac vuong can
print "Test case 26: a = %r, b = %r, c = %r" % (1,1,math.sqrt(2))
self.assertEqual(detect_triangle(1.0, 1.0, math.sqrt(2.0)), "Tam giac vuong can\n")
print "Test case 27: a = %r, b = %r, c = %r" % (2,2*math.sqrt(2),2)
self.assertEqual(detect_triangle(2, 2*math.sqrt(2), 2), "Tam giac vuong can\n")
print "Test case 28: a = %r, b = %r, c = %r" % (2*math.sqrt(2),2,2)
self.assertEqual(detect_triangle(2*math.sqrt(2.0), 2.0, 2), "Tam giac vuong can\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:7,代码来源:test.py
示例2: testTGdeu
def testTGdeu(self): # Tam giac deu
print "Test case 23: a = %r, b = %r, c = %r" % (2,2,2)
self.assertEqual(detect_triangle(2.0, 2.0, 2.0), "Tam giac deu\n")
print "Test case 24: a = %r, b = %r, c = %r" % ("2**32-1","2**32-1","2**32-1")
self.assertEqual(detect_triangle(2**32-1, 2**32-1, 2**32-1), "Tam giac deu\n")
print "Test case 25: a = %r, b = %r, c = %r" % ("1e-10","1e-10","1e-10")
self.assertEqual(detect_triangle(1e-10, 1e-10, 1e-10), "Tam giac deu\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:7,代码来源:test.py
示例3: testTGVuong
def testTGVuong(self): # Tam giac vuong
print "Test case 13: a = %r, b = %r, c = %r" % (3,4,5)
self.assertEqual(detect_triangle(3.0, 4.0, 5.0), "Tam giac vuong\n")
print "Test case 14: a = %r, b = %r, c = %r" % (5*1e-10, 4*1e-10,3*1e-10)
self.assertEqual(detect_triangle(5*1e-10, 3*1e-10,4*1e-10), "Tam giac vuong\n")
print "Test case 15: a = %r, b = %r, c = %r" % (4*2**31, 5*2**31,3*2**31)
self.assertEqual(detect_triangle(4*2**29, 5*2**29,3*2**29), "Tam giac vuong\n")
print "Test case 33: a = %r, b = %r, c = %r" % (8.0,math.sqrt(48),4.0)
self.assertEqual(detect_triangle(8.0,math.sqrt(48),4.0), "Tam giac vuong\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:9,代码来源:test.py
示例4: testTGthuong
def testTGthuong(self): # Tam giac thuong
print "Test case 29: a = %r, b = %r, c = %r" % (3, 5, 7)
self.assertEqual(detect_triangle(3, 5.0, 7.0), "Tam giac binh thuong\n")
print "Test case 30: a = %r, b = %r, c = %r" % (2, "2^32-1", "2^32-2")
self.assertEqual(detect_triangle(2, 2**31-5, 2**31-4), "Tam giac binh thuong\n")
# Gioi han 10**-5 cho e = 10**-10
print "Test case 31: a = %r, b = %r, c = %r" % (2e-10, 3-5e-10, 3-4e-10)
self.assertEqual(detect_triangle(2e-10, 3-5e-10, 3-4e-10), "Tam giac binh thuong\n")
print "Test case 32: a = %r, b = %r, c = %r" % (2e-7, 3e-7, 4e-7)
self.assertEqual(detect_triangle(2e-7, 3e-7, 4e-7), "Tam giac binh thuong\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:10,代码来源:test.py
示例5: s_detect_triangle
def s_detect_triangle( a , b , c , e):
return {
0: detect_triangle(a,b,c),
1: detect_triangle(a,c,b),
2: detect_triangle(b,a,c),
3: detect_triangle(b,c,a),
4: detect_triangle(c,a,b),
5: detect_triangle(c,b,a),
}[e]
开发者ID:vuqt55,项目名称:ktpm2013,代码行数:9,代码来源:test.py
示例6: testTGcan
def testTGcan(self): # Tam giac can
print "Test case 16: a = %r, b = %r, c = %r" % (2,2,1)
self.assertEqual(detect_triangle(2.0, 2.0, 1.0), "Tam giac can\n")
print "Test case 17: a = %r, b = %r, c = %r" % ("4e-5", "7e-5", "4e-5")
self.assertEqual(detect_triangle(4e-5, 7e-5, 4e-5), "Tam giac can\n")
print "Test case 18: a = %r, b = %r, c = %r" % ("5e-5", "5e-5", "8e-5")
self.assertEqual(detect_triangle(5e-5, 5e-5, 8e-5), "Tam giac can\n")
print "Test case 19: a = %r, b = %r, c = %r" % ("5e-5", "3e-5", "3e-5")
self.assertEqual(detect_triangle(5e-5, 3e-5, 3e-5), "Tam giac can\n")
print "Test case 20: a = %r, b = %r, c = %r" % ("2**32-1",4,"2**32-1")
self.assertEqual(detect_triangle(2**32-1, 4, 2**32-1), "Tam giac can\n")
print "Test case 21: a = %r, b = %r, c = %r" % ("2**32-1","2**32-1",4)
self.assertEqual(detect_triangle(2**32-1, 2**32-1, 4), "Tam giac can\n")
# Gioi han 2**26 khi co mot bien < 1
print "Test case 22: a = %r, b = %r, c = %r" % ("2**32-1","2**32-1","1e-6")
self.assertEqual(detect_triangle(2**32-1, 2**32-1, 1e-9), "Tam giac can\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:16,代码来源:test.py
示例7: testInputValid
def testInputValid(self): # Test invalid.
print "Test case 5: a = %r, b = %r, c = %r" % (0,2,"2^32-1")
self.assertEqual(detect_triangle(0, 2.0, 2**32-1), "Khong phai tam giac\n")
print "Test case 8: a = %r, b = %r, c = %r" % (1,4,5)
self.assertEqual(detect_triangle(1.0, 4.0, 5.0), "Khong phai tam giac\n")
print "Test case 9: a = %r, b = %r, c = %r" % (1,4,"2**32-1")
self.assertEqual(detect_triangle(1.0, 4.0, 2**32-1), "Khong phai tam giac\n")
print "Test case 10: a = %r, b = %r, c = %r" % (1,2**32-1,1)
self.assertEqual(detect_triangle(1.0, 2**32-1, 1), "Khong phai tam giac\n")
print "Test case 11: a = %r, b = %r, c = %r" % ("1e-10",4,1)
self.assertEqual(detect_triangle(1e-10, 4.0, 1), "Khong phai tam giac\n")
print "Test case 12: a = %r, b = %r, c = %r" % ("2**32-1","1e-10","1e-10")
self.assertEqual(detect_triangle(2**32-1, 1e-10, 1e-10), "Khong phai tam giac\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:13,代码来源:test.py
示例8: testInputInvalid
def testInputInvalid(self): # Test invalid
print "Test case 1: a = %r, b = %r, c = %r" % ("-1",2,0)
self.assertEqual(detect_triangle('a', 2.0, 0), "Gia tri dau vao khong phu hop\n")
print "Test case 2: a = %r, b = %r, c = %r" % (2,"-1",0)
self.assertEqual(detect_triangle(2, "-1", 0), "Gia tri dau vao khong phu hop\n")
print "Test case 3: a = %r, b = %r, c = %r" % (2,0,"-1")
self.assertEqual(detect_triangle(2,0, "-1"), "Gia tri dau vao khong phu hop\n")
print "Test case 4: a = %r, b = %r, c = %r" % (1,2,"2^32")
self.assertEqual(detect_triangle(1, 2.0, 2**32), "Gia tri dau vao khong phu hop\n")
print "Test case 6: a = %r, b = %r, c = %r" % ("2^32-1","2**32","0")
self.assertEqual(detect_triangle(2**32-1, 2**32, 0), "Gia tri dau vao khong phu hop\n")
print "Test case 7: a = %r, b = %r, c = %r" % ("1e-10","2**32","2**32-2")
self.assertEqual(detect_triangle(1e-10 , 2**32, 2**32-2), "Gia tri dau vao khong phu hop\n")
开发者ID:LeKhanhTrinh,项目名称:KTPM-2013-,代码行数:13,代码来源:test.py
示例9: test30
def test30(self):
self.assertEqual(triangle.detect_triangle(6,-4,5),'Vuot qua mien gia tri')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例10: test28
def test28(self):
self.assertEqual(triangle.detect_triangle(1,1,pow(2,32)),'Vuot qua mien gia tri')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例11: test20
def test20(self):
self.assertEqual(triangle.detect_triangle(4,0,8),'Khong phai tam giac')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例12: test18
def test18(self):
self.assertEqual(triangle.detect_triangle(1,1,2),'Khong phai tam giac')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例13: test16
def test16(self):
self.assertEqual(triangle.detect_triangle(12345678,12345677,12345679),'Tam giac thuong')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例14: test6
def test6(self):
self.assertEqual(triangle.detect_triangle(pow(2,31)-1,pow(2,31)-1,pow(2,31)-1),'Tam giac deu')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例15: test5
def test5(self):
self.assertEqual(triangle.detect_triangle(1,1,1),'Tam giac deu')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例16: test14
def test14(self):
self.assertEqual(triangle.detect_triangle(4,2,3),'Tam giac thuong')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例17: test15
def test15(self):
self.assertEqual(triangle.detect_triangle(9/2,3,2),'Tam giac thuong')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例18: test7
def test7(self):
self.assertEqual(triangle.detect_triangle(pow(1,-40),pow(1,-40),pow(1,-40)),'Tam giac deu')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例19: test17
def test17(self):
self.assertEqual(triangle.detect_triangle(pow(2,31)-1,pow(2,31)-2,pow(2,31)-3),'Tam giac thuong')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
示例20: test8
def test8(self):
self.assertEqual(triangle.detect_triangle(3,4,5),'Tam giac vuong')
开发者ID:anhnt55,项目名称:ktpm2013,代码行数:2,代码来源:test.py
注:本文中的triangle.detect_triangle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论