def test_fully_exhaust_base(monkeypatch): """In this test we generate all possible values for the first byte but never get to the point where we exhaust the root of the tree.""" seed_random(0) seen = set() def f(data): key = data.draw_bytes(2) assert key not in seen seen.add(key) runner = ConjectureRunner(f, settings=settings( max_examples=10000, phases=no_shrink, buffer_size=1024, database=None, )) for c in hrange(256): runner.cached_test_function([0, c]) assert 1 in runner.dead runner.run()
def test_one_dead_branch(): seed_random(0) seen = set() @run_to_buffer def x(data): i = data.draw_bytes(1)[0] if i > 0: data.mark_invalid() i = data.draw_bytes(1)[0] if len(seen) < 255: seen.add(i) elif i not in seen: data.mark_interesting()
def test_fully_exhaust_base(): """In this test we generate all possible values for the first byte but never get to the point where we exhaust the root of the tree.""" seed_random(0) seen = set() def f(data): seen.add(data.draw_bytes(2)) runner = ConjectureRunner(f, settings=settings( max_examples=10000, max_iterations=10000, max_shrinks=MAX_SHRINKS, buffer_size=1024, database=None, )) runner.run() assert len(seen) > 256 assert len({x[0] for x in seen}) == 256
def test_fully_exhaust_base(): """In this test we generate all possible values for the first byte but never get to the point where we exhaust the root of the tree.""" seed_random(0) seen = set() def f(data): seen.add(data.draw_bytes(2)) runner = ConjectureRunner(f, settings=settings( max_examples=5000, max_iterations=10000, max_shrinks=MAX_SHRINKS, buffer_size=1024, database=None, )) runner.run() assert len(seen) > 256 assert len({x[0] for x in seen}) == 256
def test_fully_exhaust_base(monkeypatch): """In this test we generate all possible values for the first byte but never get to the point where we exhaust the root of the tree.""" seed_random(0) seen = set() def f(data): key = (data.draw_bits(2), data.draw_bits(2)) assert key not in seen seen.add(key) runner = ConjectureRunner(f, settings=settings( max_examples=10000, phases=no_shrink, buffer_size=1024, database=None, )) for c in hrange(4): runner.cached_test_function([0, c]) assert 1 in runner.dead runner.run()