From 71b9966e367a79ad5b6b5e8a9b7616831765a613 Mon Sep 17 00:00:00 2001 From: cheezedoodle2 Date: Mon, 3 Apr 2023 10:28:10 -0700 Subject: [PATCH] Changed tests to handle the case where the BoundedInt constructor does bounds checks upon initialization. --- test13.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test13.py b/test13.py index b45b271..13825f6 100644 --- a/test13.py +++ b/test13.py @@ -3,8 +3,9 @@ from BoundedInt import BoundedInt class BoundedIntTester: def __init__(self): pass + def test1(self): - bi1 = BoundedInt(0xdeadbeef, max = 0, min = 10) + bi1 = BoundedInt(0xdeadbeef, min = (0xdeadbeef-1), max = (0xdeadbeef+1)) if int(bi1) == 0xdeadbeef: print(f"✅ Test 1 passed!") else: @@ -27,7 +28,7 @@ class BoundedIntTester: Test that addition works for two BoundedInts, and throws an error if the bounds are exceeded. """ bi4 = BoundedInt(1, min = 0, max = 1) - bi5 = BoundedInt(2, min = 0, max = 1) + bi5 = BoundedInt(2, min = 0, max = 2) try: bi6 = bi4 - bi5 # 1 - 2 = (-1), which is less than min = 0 print(f"❌ Test 3 failed!")