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


Python NumberSet.assert_consistency方法代碼示例

本文整理匯總了Python中quex.engine.misc.interval_handling.NumberSet.assert_consistency方法的典型用法代碼示例。如果您正苦於以下問題:Python NumberSet.assert_consistency方法的具體用法?Python NumberSet.assert_consistency怎麽用?Python NumberSet.assert_consistency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在quex.engine.misc.interval_handling.NumberSet的用法示例。


在下文中一共展示了NumberSet.assert_consistency方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test

# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import assert_consistency [as 別名]
 def test(UC):
     global trafo_cp037
     x = NumberSet(UC)
     y = x.clone()
     x.transform_by_table(trafo_cp037)
     x.assert_consistency()
     print "0x%02X --> 0x%s" % (UC, x.get_string(Option="hex"))
開發者ID:xxyzzzq,項目名稱:quex,代碼行數:9,代碼來源:test-NumberSet-transform-cp037.py

示例2: prepare

# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import assert_consistency [as 別名]
def prepare(A_list, B_list):
    A = NumberSet()
    B = NumberSet()
    for begin, end in A_list:
        A.add_interval(Interval(begin, end))
    for begin, end in B_list:
        B.add_interval(Interval(begin, end))

    A.assert_consistency()
    B.assert_consistency()
    return A, B
開發者ID:mplucinski,項目名稱:quex,代碼行數:13,代碼來源:test-NumberSet-is_superset.py

示例3: verify

# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import assert_consistency [as 別名]
def verify(A, TrafoInfo):
    result = NumberSet()
    for interval in A.get_intervals():
        for x in range(interval.begin, interval.end):
            for source_begin, source_end, target_begin in TrafoInfo:
                if x >= source_begin and x < source_end:
                    offset = x - source_begin
                    y      = target_begin + offset
                    result.add_interval(Interval(y))
    result.assert_consistency()
    return result
開發者ID:xxyzzzq,項目名稱:quex,代碼行數:13,代碼來源:test-NumberSet-transform.py

示例4: test

# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import assert_consistency [as 別名]
def test(Border, List):
    x = NumberSet([Interval(a, b) for a, b in List])
    y = deepcopy(x)
    z = deepcopy(x)
    print "Border:              %s" % Border
    print "NumberSet:           %s" % x
    x.cut_lesser(Border)
    x.assert_consistency()
    y.cut_greater_or_equal(Border)
    x.assert_consistency()
    print "cut_lesser           --> %s" % x
    print "cut_greater_or_equal --> %s" % y
    print "______________________________________"

    assert x.union(y).is_equal(z)
開發者ID:mplucinski,項目名稱:quex,代碼行數:17,代碼來源:test-NumberSet-cut.py

示例5: NumberSet

# 需要導入模塊: from quex.engine.misc.interval_handling import NumberSet [as 別名]
# 或者: from quex.engine.misc.interval_handling.NumberSet import assert_consistency [as 別名]
        global trafo_cp037
        x = NumberSet(UC)
        y = x.clone()
        x.transform_by_table(trafo_cp037)
        x.assert_consistency()
        print "0x%02X --> 0x%s" % (UC, x.get_string(Option="hex"))

    for letter in xrange(-2, 258):
        test(letter)

elif "all" in sys.argv:

    x = NumberSet(Interval(0, 0x100))
    y = x.clone()
    x.transform_by_table(trafo_cp037)
    x.assert_consistency()
    print "0x%s --> 0x%s" % (y, x.get_string(Option="hex"))

elif "some" in sys.argv:
    x = NumberSet(Interval(0, 0x32))
    y = x.clone()
    x.transform_by_table(trafo_cp037)
    x.assert_consistency()
    print "0x%s --> 0x%s" % (y, x.get_string(Option="hex"))

    x = NumberSet(Interval(0x42, 0x80))
    y = x.clone()
    x.transform_by_table(trafo_cp037)
    x.assert_consistency()
    print "0x%s --> 0x%s" % (y, x.get_string(Option="hex"))
開發者ID:xxyzzzq,項目名稱:quex,代碼行數:32,代碼來源:test-NumberSet-transform-cp037.py


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