當前位置: 首頁>>代碼示例>>Python>>正文


Python Tester.compare方法代碼示例

本文整理匯總了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]))
開發者ID:C0dets,項目名稱:PythonPractice,代碼行數:23,代碼來源:mathHelperTest.py

示例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)))
開發者ID:C0dets,項目名稱:PythonPractice,代碼行數:15,代碼來源:mathHelperTest.py


注:本文中的tester.Tester.compare方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。