예제 #1
0
def test_byte_check_pass():
    overlapping = [(0, 20), (10, 20), (5, 40)]
    assert hp.byte_check(40, overlapping), "Didn't work with overlapping values"

    single = [(0, 20)]
    assert hp.byte_check(20, single), "Didn't work with single chunk"
예제 #2
0
def test_byte_check_fail():
    gap = [(0, 20), (21, 40), (40, 80)]
    assert not hp.byte_check(80, gap), "Didn't work with gapped data"

    wrong_range = [(0, 20), (40, 80), (80, 100)]
    assert not hp.byte_check(80, wrong_range), "Didn't work with wrong range"
예제 #3
0
def test_byte_check_types():
    chunks = [(0, 10), (10, 30), (30, 50), (50, 100)]
    assert hp.byte_check(100, chunks), "Didn't work with int"
    assert hp.byte_check(range(100), chunks), "Didn't work with list"
    assert hp.byte_check(set(range(100)), chunks), "Didn't work with set"
    assert hp.byte_check(tuple(range(100)), chunks), "Didn't work with tuple"