diff options
| author | Dave Hibberd <hibby@debian.org> | 2024-04-13 21:28:00 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2024-04-13 21:28:00 +0100 |
| commit | 824c4dbfc89ab108ccac0b32cec7950744d2dc41 (patch) | |
| tree | 551a84a22eaec580bcd1a0402302504714347d94 /tests/unit/test_bitwise.py | |
| parent | 57aacec614eade6d835418db7740ab611f22773d (diff) | |
| parent | 0496ffac85e663ba4c9a14d2d4eb300a3c017ae2 (diff) | |
Update upstream source from tag 'upstream/20240413'
Update to upstream version '20240413'
with Debian dir 62c7de265ce7a67bd3a5b9926035f7ef2243b9f4
Diffstat (limited to 'tests/unit/test_bitwise.py')
| -rw-r--r-- | tests/unit/test_bitwise.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/test_bitwise.py b/tests/unit/test_bitwise.py index 9f40dcc..3ace170 100644 --- a/tests/unit/test_bitwise.py +++ b/tests/unit/test_bitwise.py @@ -192,6 +192,16 @@ class TestBitType(BaseTest): obj.foo[i] = i % 2 self.assertEqual(data.get_packed(), b"\x55\x55\x55") + def test_lbit_array(self): + defn = "lbit foo[24];" + data = memmap.MemoryMapBytes(bytes(b"\x00\x20\x80")) + obj = bitwise.parse(defn, data) + for i, v in [(0, False), (13, True), (23, True)]: + self.assertEqual(bool(obj.foo[i]), v) + for i in range(0, 24): + obj.foo[i] = i % 2 + self.assertEqual(data.get_packed(), b"\xAA\xAA\xAA") + def test_bit_array_fail(self): self.assertRaises(ValueError, bitwise.parse, "bit foo[23];", b"000") |
