[chirp_devel] [PATCH] Add bitwise tests for arrays outside of structs

Dan Smith
Sun Oct 27 09:00:04 PDT 2013


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1382889601 25200
# Node ID 0c72e698e212db28a9f5c7f4985f19fb010a468d
# Parent  649e1d06c942a2b4b38ccb3454f403add100db6f
Add bitwise tests for arrays outside of structs

Related to #547

diff -r 649e1d06c942 -r 0c72e698e212 tests/unit/test_bitwise.py
--- a/tests/unit/test_bitwise.py	Fri Oct 25 22:50:14 2013 -0500
+++ b/tests/unit/test_bitwise.py	Sun Oct 27 09:00:01 2013 -0700
@@ -62,6 +62,14 @@
     def test_type_ul32(self):
         self._test_type("ul32", "\x00\x00\x00\x80", 2**31)
 
+    def test_int_array(self):
+        data = memmap.MemoryMap('\x00\x01\x02\x03')
+        obj = bitwise.parse('u8 foo[4];', data)
+        for i in range(4):
+            self.assertEqual(i, obj.foo[i])
+            obj.foo[i] = i * 2
+        self.assertEqual('\x00\x02\x04\x06', data.get_packed())
+
 class TestBitfieldTypes(BaseTest):
     def test_bitfield_u8(self):
         defn = "u8 foo:4, bar:4;"



More information about the chirp_devel mailing list