diff options
| author | Florent Monjalet <florent.monjalet@gmail.com> | 2015-12-21 11:29:37 +0100 |
|---|---|---|
| committer | Florent Monjalet <florent.monjalet@gmail.com> | 2016-01-18 14:02:32 +0100 |
| commit | e6ec6f9d800584234301733340b171092aac3f9a (patch) | |
| tree | 71958d2d3a778303b27a34cbfdeeae50f3993755 /test/core | |
| parent | f5f920ce597d0c4e03d0b79aa9b20a70e325cef9 (diff) | |
| download | miasm-e6ec6f9d800584234301733340b171092aac3f9a.tar.gz miasm-e6ec6f9d800584234301733340b171092aac3f9a.zip | |
Types: typo, MemStruct.get_offset should be a classmethod
Also added tests and MemArray.get_offset
Diffstat (limited to 'test/core')
| -rw-r--r-- | test/core/types.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/core/types.py b/test/core/types.py index 7ad8ad13..bb1d5da1 100644 --- a/test/core/types.py +++ b/test/core/types.py @@ -518,6 +518,17 @@ assert anon.c1 == 0x55 assert anon.c2 == 0x77 assert anon.d == 0x33 +# get_offset +for field, off in (("a", 0), ("b1", 1), ("b2", 1), ("c1", 3), ("c2", 4), + ("d", 5)): + assert Anon.get_offset(field) == Anon.get_type().get_offset(field) + assert Anon.get_offset(field) == off + +arr_t = Array(Num("H")) +for idx, off in ((0, 0), (1, 2), (30, 60)): + assert arr_t.get_offset(idx) == arr_t.lval.get_offset(idx) + assert arr_t.get_offset(idx) == off + # Repr tests |