本文整理匯總了Python中tester.Tester.compare方法的典型用法代碼示例。如果您正苦於以下問題:Python Tester.compare方法的具體用法?Python Tester.compare怎麽用?Python Tester.compare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tester.Tester
的用法示例。
在下文中一共展示了Tester.compare方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rectOnLine
# 需要導入模塊: from tester import Tester [as 別名]
# 或者: from tester.Tester import compare [as 別名]
def rectOnLine():
'''
args: lineStart, lineEnd, rectStartPoint, rectDimensions
'''
tester = Tester('rectOnLine')
rectPos = [5, 5]
rectSize = [5, 5]
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [6, 11], [6, 4]))
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [6, 6], [6, 4]))
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [6, 11], [7, 4]))
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [6, 11], [6, 6]))
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [6, 4], [6, 11]))
tester.compare(True, mathHelper.rectOnLine(rectPos, rectSize, [11, 9], [6, 4]))
tester.compare(False, mathHelper.rectOnLine(rectPos, rectSize, [6, 1], [7, 1]))
tester.compare(False, mathHelper.rectOnLine(rectPos, rectSize, [6, 1], [7, 2]))
tester.compare(False, mathHelper.rectOnLine(rectPos, rectSize, [9, 1], [15, 6]))
tester.compare(False, mathHelper.rectOnLine(rectPos, rectSize, [1, 11], [11, 11]))
tester.compare(False, mathHelper.rectOnLine(rectPos, rectSize, [1, 11], [11, 12]))
示例2: smallestAngleBetween
# 需要導入模塊: from tester import Tester [as 別名]
# 或者: from tester.Tester import compare [as 別名]
def smallestAngleBetween():
tester = Tester('smallestAngleBetween')
twoPi = np.pi * 2
def truncate(num):
return '%.4f'%(num)
tester.compare(truncate(-twoPi*2/6), truncate(mathHelper.smallestAngleBetween(twoPi*1/6, twoPi*5/6)))
tester.compare(truncate(twoPi*2/6), truncate(mathHelper.smallestAngleBetween(twoPi*5/6, twoPi*1/6)))
tester.compare(truncate(twoPi*1/6), truncate(mathHelper.smallestAngleBetween(twoPi*1/6, twoPi*2/6)))
tester.compare(truncate(-twoPi*1/6), truncate(mathHelper.smallestAngleBetween(twoPi*2/6, twoPi*1/6)))
tester.compare(truncate(-twoPi*3/6), truncate(mathHelper.smallestAngleBetween(twoPi*2/6, twoPi*5/6)))
tester.compare(truncate(twoPi*3/6), truncate(mathHelper.smallestAngleBetween(twoPi*5/6, twoPi*2/6)))