Skip to content

Commit 554ed54

Browse files
authored
Merge pull request #689 from ethereum/one-more-eq-test
One more equivalence test
2 parents 07bc1b2 + 6d48c77 commit 554ed54

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

test/test.hs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4137,9 +4137,32 @@ tests = testGroup "hevm"
41374137
]
41384138
, testGroup "equivalence-checking"
41394139
[
4140+
test "eq-simple-diff" $ do
4141+
Just a <- solcRuntime "C"
4142+
[i|
4143+
contract C {
4144+
function stuff() public returns (uint256) {
4145+
return 4;
4146+
}
4147+
}
4148+
|]
4149+
Just b <- solcRuntime "C"
4150+
[i|
4151+
contract C {
4152+
function stuff() public returns (uint256) {
4153+
return 5;
4154+
}
4155+
}
4156+
|]
4157+
withSolvers Bitwuzla 3 1 Nothing $ \s -> do
4158+
calldata <- mkCalldata Nothing []
4159+
(res, _) <- equivalenceCheck s a b defaultVeriOpts calldata False
4160+
assertBoolM "Must have a difference" (any isCex res)
4161+
let cexs = mapMaybe getCex res
4162+
assertEqualM "Must have exactly one cex" (length cexs) 1
41404163
-- diverging gas overapproximations are caught
41414164
-- previously, they had the same name (gas_...), so they compared equal
4142-
test "eq-divergent-overapprox-gas" $ do
4165+
, test "eq-divergent-overapprox-gas" $ do
41434166
Just a <- solcRuntime "C"
41444167
[i|
41454168
contract C {

0 commit comments

Comments
 (0)