Skip to content

Commit 5a8c436

Browse files
committed
test: fix encodeConcreteStore-overwrite case
1 parent 74c9f36 commit 5a8c436

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/test.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,10 +1021,12 @@ tests = testGroup "hevm"
10211021
-- same as above, but with offset 2
10221022
(LitByte 0xbb)
10231023
(Expr.indexWord (Lit 2) (Lit 0xff22bb4455667788990011223344556677889900112233445566778899001122))
1024-
, test "encodeConcreteStore-overwrite" $
1025-
assertEqualM ""
1026-
(pure "(store (store ((as const Storage) #x0000000000000000000000000000000000000000000000000000000000000000) (_ bv1 256) (_ bv2 256)) (_ bv3 256) (_ bv4 256))")
1027-
(EVM.SMT.encodeConcreteStore $ HashMap.fromList [(W256 1, W256 2), (W256 3, W256 4)])
1024+
, test "encodeConcreteStore-overwrite" $ do
1025+
-- HashMap has no defined order so encoding may differ
1026+
let encoded = fromRight "err" $ EVM.SMT.encodeConcreteStore $ HashMap.fromList [(W256 1, W256 2), (W256 3, W256 4)]
1027+
let options = ["(store (store ((as const Storage) #x0000000000000000000000000000000000000000000000000000000000000000) (_ bv1 256) (_ bv2 256)) (_ bv3 256) (_ bv4 256))",
1028+
"(store (store ((as const Storage) #x0000000000000000000000000000000000000000000000000000000000000000) (_ bv3 256) (_ bv4 256)) (_ bv1 256) (_ bv2 256))"]
1029+
assertBoolM "encoding must match" (encoded `elem` options)
10281030
, test "indexword-oob-sym" $ assertEqualM ""
10291031
-- indexWord should return 0 for oob access
10301032
(LitByte 0x0)

0 commit comments

Comments
 (0)