diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-06-24 21:55:03 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-06-24 21:55:03 (GMT) |
commit | 1e30e2c3822f55848e2306e59a2e66d7285f6b78 (patch) | |
tree | 7a0fd0bce0f27dceb19b0596cc7a00962c3435ad /tests | |
parent | d49b837c891e0490167b51c4a9811cb2e8276588 (diff) |
Create functions suitable for [un]setting only one bit.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common/bitfield.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/common/bitfield.py b/tests/common/bitfield.py index 75dfb6e..5d535fd 100644 --- a/tests/common/bitfield.py +++ b/tests/common/bitfield.py @@ -93,7 +93,7 @@ class TestBitFields(ChrysalideTestCase): bf_a = BitField(75, 0) bf_b = BitField(4, 1) - bf_b.reset(2, 1) + bf_b.reset(2) bf_a.or_at(bf_b, 63) @@ -130,14 +130,14 @@ class TestBitFields(ChrysalideTestCase): bf_t = BitField(75, 0) for i in range(75): - bf_t.set(i, 1) + bf_t.set(i) self.assertEqual(bf_t, bf_1) self.assertEqual(bf_t.popcount, bf_1.popcount) for i in range(75): - bf_t.reset(i, 1) + bf_t.reset(i) self.assertEqual(bf_t, bf_0) @@ -223,8 +223,8 @@ class TestBitFields(ChrysalideTestCase): """Check bitfield comparison.""" bf_a = BitField(9, 0) - bf_a.set(0, 1) - bf_a.set(5, 1) + bf_a.set(0) + bf_a.set(5) bf_b = BitField(9, 1) @@ -240,7 +240,7 @@ class TestBitFields(ChrysalideTestCase): bits = [ 0, 1, 50, 63, 64, 65, 111 ] for b in bits: - bf.set(b, 1) + bf.set(b) prev = None found = [] @@ -261,17 +261,17 @@ class TestBitFields(ChrysalideTestCase): def testRealCase00(self): - """Test bits in bitfields against other bitfields in a real case (#02).""" + """Test bits in bitfields against other bitfields in a real case (#00).""" bf = BitField(128, 0) for b in [ 0, 50, 54, 58, 66, 70, 98 ]: - bf.set(b, 1) + bf.set(b) mask = BitField(128, 0) for b in [ 0, 51 ]: - mask.set(b, 1) + mask.set(b) self.assertFalse(bf.test_zeros_with(0, mask)) @@ -284,7 +284,7 @@ class TestBitFields(ChrysalideTestCase): self.assertTrue(bf.test_zeros_with(0, mask)) for b in [ 0, 8, 9, 10 ]: - mask.set(b, 1) + mask.set(b) self.assertTrue(bf.test_zeros_with(0, mask)) @@ -305,7 +305,7 @@ class TestBitFields(ChrysalideTestCase): bits = [ 0, 50, 54, 58, 66, 70, 98 ] for b in bits: - mask.set(b, 1) + mask.set(b) bf.or_at(mask, 0) |