about summary refs log tree commit diff stats
path: root/test/core
diff options
context:
space:
mode:
authorw4kfu <gw4kfu@gmail.com>2020-06-16 10:09:41 +0200
committerw4kfu <gw4kfu@gmail.com>2020-06-16 10:09:41 +0200
commitf134c523757b3859aba2ba3e060a922995a84c08 (patch)
treefb317cf9be774683ba022534b6aba82a4e2b106c /test/core
parent975a527b4f268c4e41ab5ab259442c0941da6709 (diff)
downloadfocaccia-miasm-f134c523757b3859aba2ba3e060a922995a84c08.tar.gz
focaccia-miasm-f134c523757b3859aba2ba3e060a922995a84c08.zip
Fix issue #1255 ; Add unit test
Diffstat (limited to 'test/core')
-rwxr-xr-xtest/core/test_types.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/core/test_types.py b/test/core/test_types.py
index 1b15630c..13a7824e 100755
--- a/test/core/test_types.py
+++ b/test/core/test_types.py
@@ -351,6 +351,31 @@ assert bit.flags.f2_5 == 0b01110
 assert bit.flags.f3_8 == 0b01010101
 assert bit.flags.f4_1 == 1
 
+try:
+    class BitStruct(MemUnion):
+        fields = [
+            ("ValueB", BitField(Num("<Q"), [
+                ("field_00", 32),
+                ("field_01", 32),
+            ])),
+            ("Value", Num("<Q")),
+        ]
+except ValueError:
+    assert False, "Should not raise"
+
+try:
+    class BitStruct(MemUnion):
+        fields = [
+            ("ValueB", BitField(Num("<Q"), [
+                ("field_00", 32),
+                ("field_01", 32),
+                ("field_02", 1),
+            ])),
+            ("Value", Num("<Q")),
+        ]
+    assert False, "Should raise"
+except ValueError:
+    pass
 
 # Unhealthy ideas
 class UnhealthyIdeas(MemStruct):