aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-07-15 00:16:54 +0800
committerGav Wood <g@ethdev.com>2015-07-15 00:16:54 +0800
commitab75d542813898349f3ff54de5e5388fbb437330 (patch)
tree571660b11d9ab041b7e31581ed67d0469ac23ae0
parentac98dbfa76ce937a386841e566349d0a60217179 (diff)
parentdd3afa2877b06a2f196c2f4c85453b0e2d8ec745 (diff)
downloaddexon-solidity-ab75d542813898349f3ff54de5e5388fbb437330.tar.gz
dexon-solidity-ab75d542813898349f3ff54de5e5388fbb437330.tar.zst
dexon-solidity-ab75d542813898349f3ff54de5e5388fbb437330.zip
Merge pull request #2470 from chriseth/sol_fix_bytesComparison
Fix comparison between bytes types.
-rw-r--r--libsolidity/SolidityEndToEndTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp
index ad217546..9f806347 100644
--- a/libsolidity/SolidityEndToEndTest.cpp
+++ b/libsolidity/SolidityEndToEndTest.cpp
@@ -585,6 +585,22 @@ BOOST_AUTO_TEST_CASE(inc_dec_operators)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(0x53866));
}
+BOOST_AUTO_TEST_CASE(bytes_comparison)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f() returns (bool) {
+ bytes2 a = "a";
+ bytes2 x = "aa";
+ bytes2 b = "b";
+ return a < x && x < b;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(true));
+}
+
BOOST_AUTO_TEST_CASE(state_smoke_test)
{
char const* sourceCode = "contract test {\n"