mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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:
parent
2f13101243
commit
df900c5583
@ -5905,6 +5905,48 @@ BOOST_AUTO_TEST_CASE(using_library_structs)
|
|||||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(7), u256(8)));
|
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)
|
BOOST_AUTO_TEST_CASE(short_strings)
|
||||||
{
|
{
|
||||||
// This test verifies that the byte array encoding that combines length and data works
|
// This test verifies that the byte array encoding that combines length and data works
|
||||||
|
Loading…
Reference in New Issue
Block a user