diff options
| author | Florent Monjalet <florent.monjalet@gmail.com> | 2015-11-24 17:33:13 +0100 |
|---|---|---|
| committer | Florent Monjalet <florent.monjalet@gmail.com> | 2016-01-18 14:02:31 +0100 |
| commit | 7192718eeba19d4b96f8cd59d31d8b0c865cc67c (patch) | |
| tree | 9a2994cadbd01e62920c2b36084df1271175623c /test | |
| parent | d4b88ab3d84dafeac7b8b1592e4ddaef3df00dbe (diff) | |
| download | miasm-7192718eeba19d4b96f8cd59d31d8b0c865cc67c.tar.gz miasm-7192718eeba19d4b96f8cd59d31d8b0c865cc67c.zip | |
MemStruct: dyn types (returned by mem*()) are now cached
Diffstat (limited to '')
| -rw-r--r-- | test/analysis/mem.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/analysis/mem.py b/test/analysis/mem.py index a3642a4f..d0590ebc 100644 --- a/test/analysis/mem.py +++ b/test/analysis/mem.py @@ -292,9 +292,6 @@ assert cont.instruct.bar == 0x03 assert cont.last == 0x04 assert jitter.vm.get_mem(cont.get_addr(), len(cont)) == '\x01\x02\x03\x04' -# Quick mem(MemField) test: -assert mem(Num("f"))(jitter.vm, addr) == mem(Num("f"))(jitter.vm, addr) - # Union test class UniStruct(MemStruct): @@ -464,6 +461,19 @@ assert BitField(Num("B"), [("f1", 1), ("f2", 4), ("f3", 1)]) != \ BitField(Num("B"), [("f1", 2), ("f2", 4), ("f3", 1)]) +# Quick mem(MemField)/MemField hash test: +assert mem(Num("f"))(jitter.vm, addr) == mem(Num("f"))(jitter.vm, addr) +# Types are cached +assert mem(Num("f")) == mem(Num("f")) +assert mem(Num("d")) != mem(Num("f")) +assert mem(Union([("f1", Num("I")), ("f2", Num("H"))])) == \ + mem(Union([("f1", Num("I")), ("f2", Num("H"))])) +assert mem_array_type(Num("B")) == mem_array_type(Num("B")) +assert mem_array_type(Num("I")) != mem_array_type(Num("B")) +assert mem_sized_array_type(Num("B"), 20) == mem_sized_array_type(Num("B"), 20) +assert mem_sized_array_type(Num("B"), 19) != mem_sized_array_type(Num("B"), 20) + + # Repr tests print "Some struct reprs:\n" |