aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityOptimizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SolidityOptimizer.cpp')
-rw-r--r--SolidityOptimizer.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp
index 7e06c2e3..23b122b8 100644
--- a/SolidityOptimizer.cpp
+++ b/SolidityOptimizer.cpp
@@ -55,12 +55,12 @@ public:
}
template <class... Args>
- void compareVersions(byte _index, Args const&... _arguments)
+ void compareVersions(std::string _sig, Args const&... _arguments)
{
m_contractAddress = m_nonOptimizedContract;
- bytes nonOptimizedOutput = callContractFunction(_index, _arguments...);
+ bytes nonOptimizedOutput = callContractFunction(_sig, _arguments...);
m_contractAddress = m_optimizedContract;
- bytes optimizedOutput = callContractFunction(_index, _arguments...);
+ bytes optimizedOutput = callContractFunction(_sig, _arguments...);
BOOST_CHECK_MESSAGE(nonOptimizedOutput == optimizedOutput, "Computed values do not match."
"\nNon-Optimized: " + toHex(nonOptimizedOutput) +
"\nOptimized: " + toHex(optimizedOutput));
@@ -81,8 +81,8 @@ BOOST_AUTO_TEST_CASE(smoke_test)
return a;
}
})";
- compileBothVersions(4, sourceCode);
- compareVersions(0, u256(7));
+ compileBothVersions(29, sourceCode);
+ compareVersions("f(uint256)", u256(7));
}
BOOST_AUTO_TEST_CASE(large_integers)
@@ -94,8 +94,8 @@ BOOST_AUTO_TEST_CASE(large_integers)
b = 0x10000000000000000000000002;
}
})";
- compileBothVersions(33, sourceCode);
- compareVersions(0);
+ compileBothVersions(53, sourceCode);
+ compareVersions("f()");
}
BOOST_AUTO_TEST_CASE(invariants)
@@ -106,8 +106,8 @@ BOOST_AUTO_TEST_CASE(invariants)
return int(0) | (int(1) * (int(0) ^ (0 + a)));
}
})";
- compileBothVersions(28, sourceCode);
- compareVersions(0, u256(0x12334664));
+ compileBothVersions(53, sourceCode);
+ compareVersions("f(uint256)", u256(0x12334664));
}
BOOST_AUTO_TEST_CASE(unused_expressions)
@@ -120,8 +120,8 @@ BOOST_AUTO_TEST_CASE(unused_expressions)
data;
}
})";
- compileBothVersions(11, sourceCode);
- compareVersions(0);
+ compileBothVersions(36, sourceCode);
+ compareVersions("f()");
}
BOOST_AUTO_TEST_CASE(constant_folding_both_sides)
@@ -135,8 +135,8 @@ BOOST_AUTO_TEST_CASE(constant_folding_both_sides)
return 98 ^ (7 * ((1 | (x | 1000)) * 40) ^ 102);
}
})";
- compileBothVersions(31, sourceCode);
- compareVersions(0);
+ compileBothVersions(56, sourceCode);
+ compareVersions("f(uint256)");
}
BOOST_AUTO_TEST_SUITE_END()