about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-06-16 16:59:56 +0200
committerGitHub <noreply@github.com>2020-06-16 16:59:56 +0200
commit09b4265344ea987d0a1e78559711f86c0985b574 (patch)
treefb317cf9be774683ba022534b6aba82a4e2b106c /test
parent975a527b4f268c4e41ab5ab259442c0941da6709 (diff)
parentf134c523757b3859aba2ba3e060a922995a84c08 (diff)
downloadmiasm-09b4265344ea987d0a1e78559711f86c0985b574.tar.gz
miasm-09b4265344ea987d0a1e78559711f86c0985b574.zip
Merge pull request #1256 from w4kfu/bitfield_fix
Fix issue #1255 ; Add unit test
Diffstat (limited to '')
-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):