Skip to content

Commit 3c1f555

Browse files
author
Leo Alt
committed
Tests
1 parent 700fe3e commit 3c1f555

35 files changed

+135
-51
lines changed

libsolidity/interface/StandardCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
958958
return formatFatalError("JSONError", "settings.modelChecker.showUnproved must be a Boolean value.");
959959
ret.modelCheckerSettings.showUnproved = showUnproved.asBool();
960960
}
961-
961+
962962
if (modelCheckerSettings.isMember("solvers"))
963963
{
964964
auto const& solversArray = modelCheckerSettings["solvers"];

test/libsolidity/SMTCheckerTest.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ using namespace solidity::frontend::test;
2727

2828
SMTCheckerTest::SMTCheckerTest(string const& _filename): SyntaxTest(_filename, EVMVersion{})
2929
{
30+
auto const& showUnproved = m_reader.stringSetting("SMTShowUnproved", "yes");
31+
if (showUnproved == "no")
32+
m_modelCheckerSettings.showUnproved = false;
33+
else if (showUnproved == "yes")
34+
m_modelCheckerSettings.showUnproved = true;
35+
else
36+
BOOST_THROW_EXCEPTION(runtime_error("Invalid SMT \"show unproved\" choice."));
37+
3038
auto const& choice = m_reader.stringSetting("SMTSolvers", "any");
3139
if (choice == "any")
3240
m_modelCheckerSettings.solvers = smtutil::SMTSolverChoice::All();

test/libsolidity/smtCheckerTests/abi/abi_encode_packed_string_literal.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ contract C {
2222
// ====
2323
// SMTEngine: all
2424
// ----
25-
// Warning 6328: (226-256): CHC: Assertion violation happens here.
2625
// Warning 1218: (310-340): CHC: Error trying to invoke SMT solver.
27-
// Warning 6328: (310-340): CHC: Assertion violation might happen here.
2826
// Warning 1218: (483-513): CHC: Error trying to invoke SMT solver.
29-
// Warning 6328: (483-513): CHC: Assertion violation might happen here.
3027
// Warning 1218: (568-598): CHC: Error trying to invoke SMT solver.
31-
// Warning 6328: (568-598): CHC: Assertion violation might happen here.
3228
// Warning 1218: (654-684): CHC: Error trying to invoke SMT solver.
29+
// Warning 6328: (226-256): CHC: Assertion violation happens here.
30+
// Warning 6328: (310-340): CHC: Assertion violation might happen here.
31+
// Warning 6328: (483-513): CHC: Assertion violation might happen here.
32+
// Warning 6328: (568-598): CHC: Assertion violation might happen here.
3333
// Warning 6328: (654-684): CHC: Assertion violation might happen here.
3434
// Warning 4661: (310-340): BMC: Assertion violation happens here.
3535
// Warning 4661: (483-513): BMC: Assertion violation happens here.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
contract C {
2+
function abiencodePackedStringLiteral() public pure {
3+
bytes memory b1 = abi.encodePacked("");
4+
bytes memory b2 = abi.encodePacked("");
5+
// should hold, but currently fails due to string literal abstraction
6+
assert(b1.length == b2.length);
7+
8+
bytes memory b3 = abi.encodePacked(bytes(""));
9+
assert(b1.length == b3.length); // should fail
10+
11+
bytes memory b4 = abi.encodePacked(bytes24(""));
12+
// should hold, but currently fails due to string literal abstraction
13+
assert(b1.length == b4.length);
14+
15+
bytes memory b5 = abi.encodePacked(string(""));
16+
assert(b1.length == b5.length); // should fail
17+
18+
bytes memory b6 = abi.encode("");
19+
assert(b1.length == b6.length); // should fail
20+
}
21+
}
22+
// ====
23+
// SMTEngine: all
24+
// SMTShowUnproved: no
25+
// ----
26+
// Warning 1218: (310-340): CHC: Error trying to invoke SMT solver.
27+
// Warning 1218: (483-513): CHC: Error trying to invoke SMT solver.
28+
// Warning 1218: (568-598): CHC: Error trying to invoke SMT solver.
29+
// Warning 1218: (654-684): CHC: Error trying to invoke SMT solver.
30+
// Warning 6328: (226-256): CHC: Assertion violation happens here.
31+
// Warning 5840: CHC: 4 verification condition(s) could not be proved. Enable the model checker option "show unproved" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query.
32+
// Warning 4661: (310-340): BMC: Assertion violation happens here.
33+
// Warning 4661: (483-513): BMC: Assertion violation happens here.
34+
// Warning 4661: (568-598): BMC: Assertion violation happens here.
35+
// Warning 4661: (654-684): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_string_literal.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ contract C {
1919
// ====
2020
// SMTEngine: all
2121
// ----
22-
// Warning 6328: (208-238): CHC: Assertion violation happens here.
2322
// Warning 1218: (286-316): CHC: Error trying to invoke SMT solver.
24-
// Warning 6328: (286-316): CHC: Assertion violation might happen here.
2523
// Warning 1218: (453-483): CHC: Error trying to invoke SMT solver.
26-
// Warning 6328: (453-483): CHC: Assertion violation might happen here.
2724
// Warning 1218: (532-562): CHC: Error trying to invoke SMT solver.
25+
// Warning 6328: (208-238): CHC: Assertion violation happens here.
26+
// Warning 6328: (286-316): CHC: Assertion violation might happen here.
27+
// Warning 6328: (453-483): CHC: Assertion violation might happen here.
2828
// Warning 6328: (532-562): CHC: Assertion violation might happen here.
2929
// Warning 4661: (286-316): BMC: Assertion violation happens here.
3030
// Warning 4661: (453-483): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_with_selector_array_slice.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ contract C {
2525
// ====
2626
// SMTEngine: all
2727
// ----
28+
// Warning 1218: (691-721): CHC: Error trying to invoke SMT solver.
29+
// Warning 1218: (959-989): CHC: Error trying to invoke SMT solver.
30+
// Warning 1218: (1079-1109): CHC: Error trying to invoke SMT solver.
2831
// Warning 6328: (325-355): CHC: Assertion violation happens here.
2932
// Warning 6328: (578-608): CHC: Assertion violation happens here.
30-
// Warning 1218: (691-721): CHC: Error trying to invoke SMT solver.
3133
// Warning 6328: (691-721): CHC: Assertion violation might happen here.
32-
// Warning 1218: (959-989): CHC: Error trying to invoke SMT solver.
3334
// Warning 6328: (959-989): CHC: Assertion violation might happen here.
34-
// Warning 1218: (1079-1109): CHC: Error trying to invoke SMT solver.
3535
// Warning 6328: (1079-1109): CHC: Assertion violation might happen here.
3636
// Warning 4661: (691-721): BMC: Assertion violation happens here.
3737
// Warning 4661: (959-989): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_with_selector_array_slice_2.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ contract C {
2525
// ====
2626
// SMTEngine: all
2727
// ----
28+
// Warning 1218: (692-722): CHC: Error trying to invoke SMT solver.
29+
// Warning 1218: (960-990): CHC: Error trying to invoke SMT solver.
30+
// Warning 1218: (1080-1110): CHC: Error trying to invoke SMT solver.
2831
// Warning 6328: (326-356): CHC: Assertion violation happens here.
2932
// Warning 6328: (579-609): CHC: Assertion violation happens here.
30-
// Warning 1218: (692-722): CHC: Error trying to invoke SMT solver.
3133
// Warning 6328: (692-722): CHC: Assertion violation might happen here.
32-
// Warning 1218: (960-990): CHC: Error trying to invoke SMT solver.
3334
// Warning 6328: (960-990): CHC: Assertion violation might happen here.
34-
// Warning 1218: (1080-1110): CHC: Error trying to invoke SMT solver.
3535
// Warning 6328: (1080-1110): CHC: Assertion violation might happen here.
3636
// Warning 4661: (692-722): BMC: Assertion violation happens here.
3737
// Warning 4661: (960-990): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_with_selector_hash.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ contract C {
1414
// SMTEngine: all
1515
// ----
1616
// Warning 1218: (333-371): CHC: Error trying to invoke SMT solver.
17-
// Warning 6328: (333-371): CHC: Assertion violation might happen here.
1817
// Warning 1218: (390-428): CHC: Error trying to invoke SMT solver.
18+
// Warning 6328: (333-371): CHC: Assertion violation might happen here.
1919
// Warning 6328: (390-428): CHC: Assertion violation might happen here.
2020
// Warning 4661: (333-371): BMC: Assertion violation happens here.
2121
// Warning 4661: (390-428): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_with_selector_string_literal.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ contract C {
2222
// ====
2323
// SMTEngine: all
2424
// ----
25-
// Warning 6328: (252-282): CHC: Assertion violation happens here.
2625
// Warning 1218: (347-377): CHC: Error trying to invoke SMT solver.
27-
// Warning 6328: (347-377): CHC: Assertion violation might happen here.
2826
// Warning 1218: (531-561): CHC: Error trying to invoke SMT solver.
29-
// Warning 6328: (531-561): CHC: Assertion violation might happen here.
3027
// Warning 1218: (627-657): CHC: Error trying to invoke SMT solver.
31-
// Warning 6328: (627-657): CHC: Assertion violation might happen here.
3228
// Warning 1218: (746-776): CHC: Error trying to invoke SMT solver.
29+
// Warning 6328: (252-282): CHC: Assertion violation happens here.
30+
// Warning 6328: (347-377): CHC: Assertion violation might happen here.
31+
// Warning 6328: (531-561): CHC: Assertion violation might happen here.
32+
// Warning 6328: (627-657): CHC: Assertion violation might happen here.
3333
// Warning 6328: (746-776): CHC: Assertion violation might happen here.
3434
// Warning 4661: (347-377): BMC: Assertion violation happens here.
3535
// Warning 4661: (531-561): BMC: Assertion violation happens here.

test/libsolidity/smtCheckerTests/abi/abi_encode_with_sig_array_slice.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ contract C {
2525
// ====
2626
// SMTEngine: all
2727
// ----
28+
// Warning 1218: (702-732): CHC: Error trying to invoke SMT solver.
29+
// Warning 1218: (971-1001): CHC: Error trying to invoke SMT solver.
30+
// Warning 1218: (1086-1116): CHC: Error trying to invoke SMT solver.
2831
// Warning 6328: (334-364): CHC: Assertion violation happens here.
2932
// Warning 6328: (588-618): CHC: Assertion violation happens here.
30-
// Warning 1218: (702-732): CHC: Error trying to invoke SMT solver.
3133
// Warning 6328: (702-732): CHC: Assertion violation might happen here.
32-
// Warning 1218: (971-1001): CHC: Error trying to invoke SMT solver.
3334
// Warning 6328: (971-1001): CHC: Assertion violation might happen here.
34-
// Warning 1218: (1086-1116): CHC: Error trying to invoke SMT solver.
3535
// Warning 6328: (1086-1116): CHC: Assertion violation might happen here.
3636
// Warning 4661: (702-732): BMC: Assertion violation happens here.
3737
// Warning 4661: (971-1001): BMC: Assertion violation happens here.

0 commit comments

Comments
 (0)