diff options
author | LianaHus <liana@ethdev.com> | 2015-09-01 17:19:02 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-08 19:12:00 +0800 |
commit | 02d4198242ec3dacc7af31c9446c83adcf014de9 (patch) | |
tree | 6d000f103d2520ebec433c41726dd30350462d8b /test | |
parent | 1b5e6fc9e76ad3cf30e6e7bfc0e868dbb5267ff4 (diff) | |
download | dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar.gz dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar.bz2 dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar.lz dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar.xz dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.tar.zst dexon-solidity-02d4198242ec3dacc7af31c9446c83adcf014de9.zip |
removed get prefix
style fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/Assembly.cpp | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityExpressionCompiler.cpp | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityInterface.cpp | 18 | ||||
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 16 |
4 files changed, 23 insertions, 23 deletions
diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index aab612dc..eb4999e7 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -80,10 +80,10 @@ void checkAssemblyLocations(AssemblyItems const& _items, vector<SourceLocation> for (size_t i = 0; i < min(_items.size(), _locations.size()); ++i) { BOOST_CHECK_MESSAGE( - _items[i].getLocation() == _locations[i], + _items[i].location() == _locations[i], "Location mismatch for assembly item " + to_string(i) + ". Found: " + - to_string(_items[i].getLocation().start) + "-" + - to_string(_items[i].getLocation().end) + ", expected: " + + to_string(_items[i].location().start) + "-" + + to_string(_items[i].location().end) + ", expected: " + to_string(_locations[i].start) + "-" + to_string(_locations[i].end)); } diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index dfbb1c65..9b1c026f 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -48,7 +48,7 @@ class FirstExpressionExtractor: private ASTVisitor { public: FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); } - Expression* getExpression() const { return m_expression; } + Expression* expression() const { return m_expression; } private: virtual bool visit(Assignment& _expression) override { return checkExpression(_expression); } virtual bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); } @@ -123,7 +123,7 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _ if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { FirstExpressionExtractor extractor(*contract); - BOOST_REQUIRE(extractor.getExpression() != nullptr); + BOOST_REQUIRE(extractor.expression() != nullptr); CompilerContext context; context.resetVisitedNodes(contract); @@ -134,7 +134,7 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _ context.addVariable(dynamic_cast<VariableDeclaration const&>(resolveDeclaration(variable, resolver)), parametersSize--); - ExpressionCompiler(context).compile(*extractor.getExpression()); + ExpressionCompiler(context).compile(*extractor.expression()); for (vector<string> const& function: _functions) context << context.functionEntryLabel(dynamic_cast<FunctionDefinition const&>(resolveDeclaration(function, resolver))); diff --git a/test/libsolidity/SolidityInterface.cpp b/test/libsolidity/SolidityInterface.cpp index 39703cfc..d77bccbd 100644 --- a/test/libsolidity/SolidityInterface.cpp +++ b/test/libsolidity/SolidityInterface.cpp @@ -48,7 +48,7 @@ public: return m_reCompiler.contractDefinition(_contractName); } - string getSourcePart(ASTNode const& _node) const + string sourcePart(ASTNode const& _node) const { SourceLocation location = _node.location(); BOOST_REQUIRE(!location.isEmpty()); @@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_SUITE(SolidityInterface, SolidityInterfaceChecker) BOOST_AUTO_TEST_CASE(empty_contract) { ContractDefinition const& contract = checkInterface("contract test {}"); - BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}"); + BOOST_CHECK_EQUAL(sourcePart(contract), "contract test{}"); } BOOST_AUTO_TEST_CASE(single_function) @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(single_function) " function f(uint a) returns(uint d) { return a * 7; }\n" "}\n"); BOOST_REQUIRE_EQUAL(1, contract.definedFunctions().size()); - BOOST_CHECK_EQUAL(getSourcePart(*contract.definedFunctions().front()), + BOOST_CHECK_EQUAL(sourcePart(*contract.definedFunctions().front()), "function f(uint256 a)returns(uint256 d);"); } @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(single_constant_function) ContractDefinition const& contract = checkInterface( "contract test { function f(uint a) constant returns(bytes1 x) { 1==2; } }"); BOOST_REQUIRE_EQUAL(1, contract.definedFunctions().size()); - BOOST_CHECK_EQUAL(getSourcePart(*contract.definedFunctions().front()), + BOOST_CHECK_EQUAL(sourcePart(*contract.definedFunctions().front()), "function f(uint256 a)constant returns(bytes1 x);"); } @@ -100,15 +100,15 @@ BOOST_AUTO_TEST_CASE(multiple_functions) set<string> expectation({"function f(uint256 a)returns(uint256 d);", "function g(uint256 b)returns(uint256 e);"}); BOOST_REQUIRE_EQUAL(2, contract.definedFunctions().size()); - BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.definedFunctions().at(0)), - getSourcePart(*contract.definedFunctions().at(1))})); + BOOST_CHECK(expectation == set<string>({sourcePart(*contract.definedFunctions().at(0)), + sourcePart(*contract.definedFunctions().at(1))})); } BOOST_AUTO_TEST_CASE(exclude_fallback_function) { char const* sourceCode = "contract test { function() {} }"; ContractDefinition const& contract = checkInterface(sourceCode); - BOOST_CHECK_EQUAL(getSourcePart(contract), "contract test{}"); + BOOST_CHECK_EQUAL(sourcePart(contract), "contract test{}"); } BOOST_AUTO_TEST_CASE(events) @@ -138,8 +138,8 @@ BOOST_AUTO_TEST_CASE(inheritance) set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i);", "function derivedFunction(bytes32 p)returns(bytes32 i);"}); BOOST_REQUIRE_EQUAL(2, contract.definedFunctions().size()); - BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.definedFunctions().at(0)), - getSourcePart(*contract.definedFunctions().at(1))})); + BOOST_CHECK(expectedFunctions == set<string>({sourcePart(*contract.definedFunctions().at(0)), + sourcePart(*contract.definedFunctions().at(1))})); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 85a88c03..20d59a04 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -101,7 +101,7 @@ public: return state; } - AssemblyItems getCSE(AssemblyItems const& _input, eth::KnownState const& _state = eth::KnownState()) + AssemblyItems CSE(AssemblyItems const& _input, eth::KnownState const& _state = eth::KnownState()) { AssemblyItems input = addDummyLocations(_input); @@ -111,7 +111,7 @@ public: for (AssemblyItem const& item: output) { - BOOST_CHECK(item == Instruction::POP || !item.getLocation().isEmpty()); + BOOST_CHECK(item == Instruction::POP || !item.location().isEmpty()); } return output; } @@ -122,11 +122,11 @@ public: KnownState const& _state = eth::KnownState() ) { - AssemblyItems output = getCSE(_input, _state); + AssemblyItems output = CSE(_input, _state); BOOST_CHECK_EQUAL_COLLECTIONS(_expectation.begin(), _expectation.end(), output.begin(), output.end()); } - AssemblyItems getCFG(AssemblyItems const& _input) + AssemblyItems CFG(AssemblyItems const& _input) { AssemblyItems output = _input; // Running it four times should be enough for these tests. @@ -144,7 +144,7 @@ public: void checkCFG(AssemblyItems const& _input, AssemblyItems const& _expectation) { - AssemblyItems output = getCFG(_input); + AssemblyItems output = CFG(_input); BOOST_CHECK_EQUAL_COLLECTIONS(_expectation.begin(), _expectation.end(), output.begin(), output.end()); } @@ -890,7 +890,7 @@ BOOST_AUTO_TEST_CASE(cse_sha3_twice_same_content_noninterfering_store_in_between Instruction::SHA3 // sha3(m[12..(12+32)]) }; // if this changes too often, only count the number of SHA3 and MSTORE instructions - AssemblyItems output = getCSE(input); + AssemblyItems output = CSE(input); BOOST_CHECK_EQUAL(4, count(output.begin(), output.end(), AssemblyItem(Instruction::MSTORE))); BOOST_CHECK_EQUAL(1, count(output.begin(), output.end(), AssemblyItem(Instruction::SHA3))); } @@ -914,7 +914,7 @@ BOOST_AUTO_TEST_CASE(cse_equality_on_initially_known_stack) AssemblyItems input{ Instruction::EQ }; - AssemblyItems output = getCSE(input, state); + AssemblyItems output = CSE(input, state); // check that it directly pushes 1 (true) BOOST_CHECK(find(output.begin(), output.end(), AssemblyItem(u256(1))) != output.end()); } @@ -938,7 +938,7 @@ BOOST_AUTO_TEST_CASE(cse_access_previous_sequence) u256(0), Instruction::SLOAD, }; - BOOST_CHECK_THROW(getCSE(input, state), StackTooDeepException); + BOOST_CHECK_THROW(CSE(input, state), StackTooDeepException); // @todo for now, this throws an exception, but it should recover to the following // (or an even better version) at some point: // 0, SLOAD, 1, ADD, SSTORE, 0 SLOAD |