aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityParser.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-02-23 19:28:42 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-02-23 19:28:42 +0800
commitcd9262badfd1cd7425469d0eba94a5109c20960a (patch)
tree05cd1f06ecbd25ca6220cb3ef6c4948e25c4c3d1 /SolidityParser.cpp
parent154d439cf8530528fc362f99461f9648ce3b5f45 (diff)
parent9a764055ac69ceb9e5a16c4c930730255db13236 (diff)
downloaddexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar.gz
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar.bz2
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar.lz
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar.xz
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.tar.zst
dexon-solidity-cd9262badfd1cd7425469d0eba94a5109c20960a.zip
Merge remote-tracking branch 'upstream/develop' into addTests
Conflicts: test/CMakeLists.txt test/ttTransactionTestFiller.json
Diffstat (limited to 'SolidityParser.cpp')
-rw-r--r--SolidityParser.cpp67
1 files changed, 64 insertions, 3 deletions
diff --git a/SolidityParser.cpp b/SolidityParser.cpp
index 7af99567..69bbc6e0 100644
--- a/SolidityParser.cpp
+++ b/SolidityParser.cpp
@@ -387,6 +387,17 @@ BOOST_AUTO_TEST_CASE(complex_expression)
BOOST_CHECK_NO_THROW(parseText(text));
}
+BOOST_AUTO_TEST_CASE(exp_expression)
+{
+ char const* text = R"(
+ contract test {
+ function fun(uint256 a) {
+ uint256 x = 3 ** a;
+ }
+ })";
+ BOOST_CHECK_NO_THROW(parseText(text));
+}
+
BOOST_AUTO_TEST_CASE(while_loop)
{
char const* text = "contract test {\n"
@@ -640,13 +651,13 @@ BOOST_AUTO_TEST_CASE(visibility_specifiers)
char const* text = R"(
contract c {
uint private a;
- uint protected b;
+ uint internal b;
uint public c;
uint d;
function f() {}
function f_priv() private {}
function f_public() public {}
- function f_protected() protected {}
+ function f_internal() internal {}
})";
BOOST_CHECK_NO_THROW(parseText(text));
}
@@ -655,7 +666,7 @@ BOOST_AUTO_TEST_CASE(multiple_visibility_specifiers)
{
char const* text = R"(
contract c {
- uint private protected a;
+ uint private internal a;
})";
BOOST_CHECK_THROW(parseText(text), ParserError);
}
@@ -692,6 +703,56 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
}
+BOOST_AUTO_TEST_CASE(enum_valid_declaration)
+{
+ char const* text = R"(
+ contract c {
+ enum validEnum { Value1, Value2, Value3, Value4 }
+ function c ()
+ {
+ a = foo.Value3;
+ }
+ uint256 a;
+ })";
+ BOOST_CHECK_NO_THROW(parseTextExplainError(text));
+}
+
+BOOST_AUTO_TEST_CASE(empty_enum_declaration)
+{
+ char const* text = R"(
+ contract c {
+ enum foo { }
+ })";
+ BOOST_CHECK_NO_THROW(parseTextExplainError(text));
+}
+
+BOOST_AUTO_TEST_CASE(malformed_enum_declaration)
+{
+ char const* text = R"(
+ contract c {
+ enum foo { WARNING,}
+ })";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
+BOOST_AUTO_TEST_CASE(external_function)
+{
+ char const* text = R"(
+ contract c {
+ function x() external {}
+ })";
+ BOOST_CHECK_NO_THROW(parseTextExplainError(text));
+}
+
+BOOST_AUTO_TEST_CASE(external_variable)
+{
+ char const* text = R"(
+ contract c {
+ uint external x;
+ })";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}