From b1135812037657f1dc4a175d8e29329a171fc997 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sun, 4 Jun 2023 23:53:00 -0600 Subject: [PATCH] Bugstomping in the tests --- projects/proquint/test/python/test_examples.py | 5 +++++ projects/proquint/test/python/test_hypothesis.py | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/proquint/test/python/test_examples.py b/projects/proquint/test/python/test_examples.py index 486c2d3..8bf4444 100644 --- a/projects/proquint/test/python/test_examples.py +++ b/projects/proquint/test/python/test_examples.py @@ -55,3 +55,8 @@ def test_encode_examples(val, width, qint): assert ( encoded_qint == qint ), f"did not encode {val} to {qint}; got {encoded_qint} ({decoded_val})" + +# Previously failed test values - +# 4294967296 +# 18446744073709551616 +# 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096 diff --git a/projects/proquint/test/python/test_hypothesis.py b/projects/proquint/test/python/test_hypothesis.py index a7f0318..5650c06 100644 --- a/projects/proquint/test/python/test_hypothesis.py +++ b/projects/proquint/test/python/test_hypothesis.py @@ -5,21 +5,22 @@ from hypothesis.strategies import integers import proquint -@given(integers(min_value=0, max_value=1 << 16)) -def test_round_trip_16(val): - assert proquint.Proquint.decode(proquint.Proquint.encode(val, 16)) == val +def test_round_trip_16(): + for val in range(0, 1<<16): + assert proquint.Proquint.decode(proquint.Proquint.encode(val, 16)) == val -@given(integers(min_value=0, max_value=1 << 32)) +@given(integers(min_value=1<<16, max_value=1 << 32 - 1)) def test_round_trip_32(val): assert proquint.Proquint.decode(proquint.Proquint.encode(val, 32)) == val -@given(integers(min_value=0, max_value=1 << 64)) +@given(integers(min_value=1<<16, max_value=1 << 64 - 1)) def test_round_trip_64(val): assert proquint.Proquint.decode(proquint.Proquint.encode(val, 64)) == val -@given(integers(min_value=0, max_value=1 << 512)) +@given(integers(min_value=1<<16, max_value=1 << 512 - 1)) def test_round_trip_512(val): assert proquint.Proquint.decode(proquint.Proquint.encode(val, 512)) == val +