当前位置: 首页>>代码示例>>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;未经允许,请勿转载。