From dd3afa2877b06a2f196c2f4c85453b0e2d8ec745 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 14 Jul 2015 16:37:11 +0200 Subject: [PATCH] Fix comparison between bytes types. Fixes #2087 --- libsolidity/SolidityEndToEndTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index ad2175461..9f806347e 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"