test: add a test about using an inherited enum definition as an expression,

with an explicit mention of the base contract.  The test is about #1131.
This commit is contained in:
Yoichi Hirai 2016-10-21 10:18:51 +02:00
parent 2f13101243
commit df900c5583
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -5905,6 +5905,48 @@ BOOST_AUTO_TEST_CASE(using_library_structs)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7), u256(8)));
}
BOOST_AUTO_TEST_CASE(library_struct_as_an_expression)
{
char const* sourceCode = R"(
library Arst {
struct Foo {
int Things;
int Stuff;
}
}
contract Tsra {
function f() returns(uint) {
Arst.Foo;
return 1;
}
}
)";
compileAndRun(sourceCode, 0, "Tsra");
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
}
BOOST_AUTO_TEST_CASE(library_enum_as_an_expression)
{
char const* sourceCode = R"(
library Arst {
enum Foo {
Things,
Stuff
}
}
contract Tsra {
function f() returns(uint) {
Arst.Foo;
return 1;
}
}
)";
compileAndRun(sourceCode, 0, "Tsra");
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
}
BOOST_AUTO_TEST_CASE(short_strings)
{
// This test verifies that the byte array encoding that combines length and data works