diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/contracts/AuctionRegistrar.cpp | 2 | ||||
-rw-r--r-- | test/contracts/FixedFeeRegistrar.cpp | 2 | ||||
-rw-r--r-- | test/contracts/Wallet.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/Assembly.cpp | 8 | ||||
-rw-r--r-- | test/libsolidity/GasMeter.cpp | 16 | ||||
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityExpressionCompiler.cpp | 10 | ||||
-rw-r--r-- | test/libsolidity/SolidityInterface.cpp | 28 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 54 | ||||
-rw-r--r-- | test/libsolidity/SolidityNatspecJSON.cpp | 4 | ||||
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 26 | ||||
-rw-r--r-- | test/libsolidity/SolidityScanner.cpp | 112 | ||||
-rw-r--r-- | test/libsolidity/SolidityTypes.cpp | 46 | ||||
-rw-r--r-- | test/libsolidity/solidityExecutionFramework.h | 2 |
14 files changed, 157 insertions, 157 deletions
diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index 7c5d9fa3..0935c874 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -233,7 +233,7 @@ protected: m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", registrarCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); - s_compiledRegistrar.reset(new bytes(m_compiler.getBytecode("GlobalRegistrar"))); + s_compiledRegistrar.reset(new bytes(m_compiler.bytecode("GlobalRegistrar"))); } sendMessage(*s_compiledRegistrar, true); BOOST_REQUIRE(!m_output.empty()); diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index ed2ecf0a..266eb923 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -125,7 +125,7 @@ protected: m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", registrarCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); - s_compiledRegistrar.reset(new bytes(m_compiler.getBytecode("FixedFeeRegistrar"))); + s_compiledRegistrar.reset(new bytes(m_compiler.bytecode("FixedFeeRegistrar"))); } sendMessage(*s_compiledRegistrar, true); BOOST_REQUIRE(!m_output.empty()); diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 5f9febd4..32a53199 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -440,7 +440,7 @@ protected: m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", walletCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); - s_compiledWallet.reset(new bytes(m_compiler.getBytecode("Wallet"))); + s_compiledWallet.reset(new bytes(m_compiler.bytecode("Wallet"))); } bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners); sendMessage(*s_compiledWallet + args, true, _value); diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 8d316a97..aab612dc 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -52,23 +52,23 @@ eth::AssemblyItems compileContract(const string& _sourceCode) BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared<Scanner>(CharStream(_sourceCode)))); NameAndTypeResolver resolver({}); resolver.registerDeclarations(*sourceUnit); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract)); } - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { BOOST_REQUIRE_NO_THROW(resolver.checkTypeRequirements(*contract)); } - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { Compiler compiler; compiler.compileContract(*contract, map<ContractDefinition const*, bytes const*>{}); - return compiler.getRuntimeAssemblyItems(); + return compiler.runtimeAssemblyItems(); } BOOST_FAIL("No contract found in source."); return AssemblyItems(); diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 5f442654..bcf9bbc1 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -48,8 +48,8 @@ public: m_compiler.setSource(_sourceCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(), "Compiling contract failed"); - AssemblyItems const* items = m_compiler.getRuntimeAssemblyItems(""); - ASTNode const& sourceUnit = m_compiler.getAST(); + AssemblyItems const* items = m_compiler.runtimeAssemblyItems(""); + ASTNode const& sourceUnit = m_compiler.AST(); BOOST_REQUIRE(items != nullptr); m_gasCosts = GasEstimator::breakToStatementLevel( GasEstimator::structuralEstimation(*items, vector<ASTNode const*>({&sourceUnit})), @@ -61,9 +61,9 @@ public: { compileAndRun(_sourceCode); auto state = make_shared<KnownState>(); - PathGasMeter meter(*m_compiler.getAssemblyItems()); + PathGasMeter meter(*m_compiler.assemblyItems()); GasMeter::GasConsumption gas = meter.estimateMax(0, state); - u256 bytecodeSize(m_compiler.getRuntimeBytecode().size()); + u256 bytecodeSize(m_compiler.runtimeBytecode().size()); gas += bytecodeSize * c_createDataGas; BOOST_REQUIRE(!gas.isInfinite); BOOST_CHECK(gas.value == m_gasUsed); @@ -82,7 +82,7 @@ public: } GasMeter::GasConsumption gas = GasEstimator::functionalEstimation( - *m_compiler.getRuntimeAssemblyItems(), + *m_compiler.runtimeAssemblyItems(), _sig ); BOOST_REQUIRE(!gas.isInfinite); @@ -115,11 +115,11 @@ BOOST_AUTO_TEST_CASE(non_overlapping_filtered_costs) { auto second = first; for (++second; second != m_gasCosts.cend(); ++second) - if (first->first->getLocation().intersects(second->first->getLocation())) + if (first->first->location().intersects(second->first->location())) { BOOST_CHECK_MESSAGE(false, "Source locations should not overlap!"); - SourceReferenceFormatter::printSourceLocation(cout, first->first->getLocation(), m_compiler.getScanner()); - SourceReferenceFormatter::printSourceLocation(cout, second->first->getLocation(), m_compiler.getScanner()); + SourceReferenceFormatter::printSourceLocation(cout, first->first->location(), m_compiler.scanner()); + SourceReferenceFormatter::printSourceLocation(cout, second->first->location(), m_compiler.scanner()); } } } diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index f7390dc9..69504e3d 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -40,7 +40,7 @@ public: void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) { ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing contract failed"); - std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABIInterface); + std::string generatedInterfaceString = m_compilerStack.metadata("", DocumentationType::ABIInterface); Json::Value generatedInterface; m_reader.parse(generatedInterfaceString, generatedInterface); Json::Value expectedInterface; diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index ee631197..dfbb1c65 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -108,18 +108,18 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _ resolver.registerDeclarations(*sourceUnit); vector<ContractDefinition const*> inheritanceHierarchy; - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { ETH_TEST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract), "Resolving names failed"); inheritanceHierarchy = vector<ContractDefinition const*>(1, contract); } - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { ETH_TEST_REQUIRE_NO_THROW(resolver.checkTypeRequirements(*contract), "Checking type Requirements failed"); } - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { FirstExpressionExtractor extractor(*contract); @@ -137,8 +137,8 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _ ExpressionCompiler(context).compile(*extractor.getExpression()); for (vector<string> const& function: _functions) - context << context.getFunctionEntryLabel(dynamic_cast<FunctionDefinition const&>(resolveDeclaration(function, resolver))); - bytes instructions = context.getAssembledBytecode(); + context << context.functionEntryLabel(dynamic_cast<FunctionDefinition const&>(resolveDeclaration(function, resolver))); + bytes instructions = context.assembledBytecode(); // debug // cout << eth::disassemble(instructions) << endl; return instructions; diff --git a/test/libsolidity/SolidityInterface.cpp b/test/libsolidity/SolidityInterface.cpp index 9c9373f0..39703cfc 100644 --- a/test/libsolidity/SolidityInterface.cpp +++ b/test/libsolidity/SolidityInterface.cpp @@ -43,14 +43,14 @@ public: { m_code = _code; ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing failed"); - m_interface = m_compilerStack.getMetadata("", DocumentationType::ABISolidityInterface); + m_interface = m_compilerStack.metadata("", DocumentationType::ABISolidityInterface); ETH_TEST_REQUIRE_NO_THROW(m_reCompiler.parse(m_interface), "Interface parsing failed"); - return m_reCompiler.getContractDefinition(_contractName); + return m_reCompiler.contractDefinition(_contractName); } string getSourcePart(ASTNode const& _node) const { - SourceLocation location = _node.getLocation(); + SourceLocation location = _node.location(); BOOST_REQUIRE(!location.isEmpty()); return m_interface.substr(location.start, location.end - location.start); } @@ -76,8 +76,8 @@ BOOST_AUTO_TEST_CASE(single_function) "contract test {\n" " function f(uint a) returns(uint d) { return a * 7; }\n" "}\n"); - BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size()); - BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()), + BOOST_REQUIRE_EQUAL(1, contract.definedFunctions().size()); + BOOST_CHECK_EQUAL(getSourcePart(*contract.definedFunctions().front()), "function f(uint256 a)returns(uint256 d);"); } @@ -85,8 +85,8 @@ 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.getDefinedFunctions().size()); - BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()), + BOOST_REQUIRE_EQUAL(1, contract.definedFunctions().size()); + BOOST_CHECK_EQUAL(getSourcePart(*contract.definedFunctions().front()), "function f(uint256 a)constant returns(bytes1 x);"); } @@ -99,9 +99,9 @@ BOOST_AUTO_TEST_CASE(multiple_functions) ContractDefinition const& contract = checkInterface(sourceCode); set<string> expectation({"function f(uint256 a)returns(uint256 d);", "function g(uint256 b)returns(uint256 e);"}); - BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size()); - BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)), - getSourcePart(*contract.getDefinedFunctions().at(1))})); + BOOST_REQUIRE_EQUAL(2, contract.definedFunctions().size()); + BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.definedFunctions().at(0)), + getSourcePart(*contract.definedFunctions().at(1))})); } BOOST_AUTO_TEST_CASE(exclude_fallback_function) @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(events) "}\n"; ContractDefinition const& contract = checkInterface(sourceCode); // events should not appear in the Solidity Interface - BOOST_REQUIRE_EQUAL(0, contract.getEvents().size()); + BOOST_REQUIRE_EQUAL(0, contract.events().size()); } BOOST_AUTO_TEST_CASE(inheritance) @@ -137,9 +137,9 @@ BOOST_AUTO_TEST_CASE(inheritance) ContractDefinition const& contract = checkInterface(sourceCode); set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i);", "function derivedFunction(bytes32 p)returns(bytes32 i);"}); - BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size()); - BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)), - getSourcePart(*contract.getDefinedFunctions().at(1))})); + BOOST_REQUIRE_EQUAL(2, contract.definedFunctions().size()); + BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.definedFunctions().at(0)), + getSourcePart(*contract.definedFunctions().at(1))})); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 3daabc85..9f352b36 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -51,19 +51,19 @@ ASTPointer<SourceUnit> parseTextAndResolveNames(std::string const& _source) resolver.registerDeclarations(*sourceUnit); std::shared_ptr<GlobalContext> globalContext = make_shared<GlobalContext>(); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { globalContext->setCurrentContract(*contract); - resolver.updateDeclaration(*globalContext->getCurrentThis()); - resolver.updateDeclaration(*globalContext->getCurrentSuper()); + resolver.updateDeclaration(*globalContext->currentThis()); + resolver.updateDeclaration(*globalContext->currentSuper()); resolver.resolveNamesAndTypes(*contract); } - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { globalContext->setCurrentContract(*contract); - resolver.updateDeclaration(*globalContext->getCurrentThis()); + resolver.updateDeclaration(*globalContext->currentThis()); resolver.checkTypeRequirements(*contract); } @@ -75,7 +75,7 @@ static ContractDefinition const* retrieveContract(ASTPointer<SourceUnit> _source { ContractDefinition* contract; unsigned counter = 0; - for (ASTPointer<ASTNode> const& node: _source->getNodes()) + for (ASTPointer<ASTNode> const& node: _source->nodes()) if ((contract = dynamic_cast<ContractDefinition*>(node.get())) && counter == index) return contract; @@ -86,7 +86,7 @@ static FunctionTypePointer const& retrieveFunctionBySignature(ContractDefinition std::string const& _signature) { FixedHash<4> hash(dev::sha3(_signature)); - return _contract->getInterfaceFunctions()[hash]; + return _contract->interfaceFunctions()[hash]; } } @@ -377,11 +377,11 @@ BOOST_AUTO_TEST_CASE(function_no_implementation) " function functionName(bytes32 input) returns (bytes32 out);\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes(); + std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* contract = dynamic_cast<ContractDefinition*>(nodes[0].get()); BOOST_CHECK(contract); BOOST_CHECK(!contract->isFullyImplemented()); - BOOST_CHECK(!contract->getDefinedFunctions()[0]->isFullyImplemented()); + BOOST_CHECK(!contract->definedFunctions()[0]->isFullyImplemented()); } BOOST_AUTO_TEST_CASE(abstract_contract) @@ -392,15 +392,15 @@ BOOST_AUTO_TEST_CASE(abstract_contract) contract derived is base { function foo() {} } )"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes(); + std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[0].get()); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get()); BOOST_CHECK(base); BOOST_CHECK(!base->isFullyImplemented()); - BOOST_CHECK(!base->getDefinedFunctions()[0]->isFullyImplemented()); + BOOST_CHECK(!base->definedFunctions()[0]->isFullyImplemented()); BOOST_CHECK(derived); BOOST_CHECK(derived->isFullyImplemented()); - BOOST_CHECK(derived->getDefinedFunctions()[0]->isFullyImplemented()); + BOOST_CHECK(derived->definedFunctions()[0]->isFullyImplemented()); } BOOST_AUTO_TEST_CASE(abstract_contract_with_overload) @@ -411,7 +411,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract_with_overload) contract derived is base { function foo(uint) {} } )"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes(); + std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); ContractDefinition* base = dynamic_cast<ContractDefinition*>(nodes[0].get()); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[1].get()); BOOST_REQUIRE(base); @@ -459,7 +459,7 @@ BOOST_AUTO_TEST_CASE(abstract_contract_constructor_args_not_provided) } )"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name resolving failed"); - std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->getNodes(); + std::vector<ASTPointer<ASTNode>> nodes = sourceUnit->nodes(); BOOST_CHECK_EQUAL(nodes.size(), 3); ContractDefinition* derived = dynamic_cast<ContractDefinition*>(nodes[2].get()); BOOST_CHECK(derived); @@ -486,10 +486,10 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature) " }\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); BOOST_CHECK_EQUAL("foo(uint256,uint64,bool)", functions[0]->externalSignature()); } } @@ -503,10 +503,10 @@ BOOST_AUTO_TEST_CASE(function_canonical_signature_type_aliases) " }\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); if (functions.empty()) continue; BOOST_CHECK_EQUAL("boo(uint256,bytes32,address)", functions[0]->externalSignature()); @@ -526,10 +526,10 @@ BOOST_AUTO_TEST_CASE(function_external_types) } })"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); if (functions.empty()) continue; BOOST_CHECK_EQUAL("boo(uint256,bool,bytes8,bool[2],uint256[],address,address[])", functions[0]->externalSignature()); @@ -548,10 +548,10 @@ BOOST_AUTO_TEST_CASE(enum_external_type) } })"; ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed"); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); if (functions.empty()) continue; BOOST_CHECK_EQUAL("boo(uint8)", functions[0]->externalSignature()); @@ -880,24 +880,24 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()"); BOOST_REQUIRE(function && function->hasDeclaration()); - auto returnParams = function->getReturnParameterTypeNames(); + auto returnParams = function->returnParameterTypeNames(); BOOST_CHECK_EQUAL(returnParams.at(0), "uint256"); BOOST_CHECK(function->isConstant()); function = retrieveFunctionBySignature(contract, "map(uint256)"); BOOST_REQUIRE(function && function->hasDeclaration()); - auto params = function->getParameterTypeNames(); + auto params = function->parameterTypeNames(); BOOST_CHECK_EQUAL(params.at(0), "uint256"); - returnParams = function->getReturnParameterTypeNames(); + returnParams = function->returnParameterTypeNames(); BOOST_CHECK_EQUAL(returnParams.at(0), "bytes4"); BOOST_CHECK(function->isConstant()); function = retrieveFunctionBySignature(contract, "multiple_map(uint256,uint256)"); BOOST_REQUIRE(function && function->hasDeclaration()); - params = function->getParameterTypeNames(); + params = function->parameterTypeNames(); BOOST_CHECK_EQUAL(params.at(0), "uint256"); BOOST_CHECK_EQUAL(params.at(1), "uint256"); - returnParams = function->getReturnParameterTypeNames(); + returnParams = function->returnParameterTypeNames(); BOOST_CHECK_EQUAL(returnParams.at(0), "bytes4"); BOOST_CHECK(function->isConstant()); } diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 73c080f7..8a133f5f 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -49,9 +49,9 @@ public: ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing failed"); if (_userDocumentation) - generatedDocumentationString = m_compilerStack.getMetadata("", DocumentationType::NatspecUser); + generatedDocumentationString = m_compilerStack.metadata("", DocumentationType::NatspecUser); else - generatedDocumentationString = m_compilerStack.getMetadata("", DocumentationType::NatspecDev); + generatedDocumentationString = m_compilerStack.metadata("", DocumentationType::NatspecDev); Json::Value generatedDocumentation; m_reader.parse(generatedDocumentationString, generatedDocumentation); Json::Value expectedDocumentation; diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 438e650b..3cb5aa4b 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -43,7 +43,7 @@ ASTPointer<ContractDefinition> parseText(std::string const& _source) { Parser parser; ASTPointer<SourceUnit> sourceUnit = parser.parse(std::make_shared<Scanner>(CharStream(_source))); - for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes()) + for (ASTPointer<ASTNode> const& node: sourceUnit->nodes()) if (ASTPointer<ContractDefinition> contract = dynamic_pointer_cast<ContractDefinition>(node)) return contract; BOOST_FAIL("No contract found in source."); @@ -53,7 +53,7 @@ ASTPointer<ContractDefinition> parseText(std::string const& _source) static void checkFunctionNatspec(ASTPointer<FunctionDefinition> _function, std::string const& _expectedDoc) { - auto doc = _function->getDocumentation(); + auto doc = _function->documentation(); BOOST_CHECK_MESSAGE(doc != nullptr, "Function does not have Natspec Doc as expected"); BOOST_CHECK_EQUAL(*doc, _expectedDoc); } @@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(function_natspec_documentation) " function functionName(bytes32 input) returns (bytes32 out) {}\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is a test function"); } @@ -184,9 +184,9 @@ BOOST_AUTO_TEST_CASE(function_normal_comments) " function functionName(bytes32 input) returns (bytes32 out) {}\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); - BOOST_CHECK_MESSAGE(function->getDocumentation() == nullptr, + BOOST_CHECK_MESSAGE(function->documentation() == nullptr, "Should not have gotten a Natspecc comment for this function"); } @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation) " function functionName4(bytes32 input) returns (bytes32 out) {}\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is test function 1"); @@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation) checkFunctionNatspec(function, "This is test function 2"); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(2), "Failed to retrieve function"); - BOOST_CHECK_MESSAGE(function->getDocumentation() == nullptr, + BOOST_CHECK_MESSAGE(function->documentation() == nullptr, "Should not have gotten natspec comment for functionName3()"); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(3), "Failed to retrieve function"); @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation) " function functionName1(bytes32 input) returns (bytes32 out) {}\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is a test function\n" @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body) " function fun(bytes32 input) returns (bytes32 out) {}\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "fun1 description"); @@ -284,10 +284,10 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature) " }\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); - BOOST_CHECK_MESSAGE(!function->getDocumentation(), + BOOST_CHECK_MESSAGE(!function->documentation(), "Shouldn't get natspec docstring for this function"); } @@ -307,10 +307,10 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature) " }\n" "}\n"; ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); - auto functions = contract->getDefinedFunctions(); + auto functions = contract->definedFunctions(); ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); - BOOST_CHECK_MESSAGE(!function->getDocumentation(), + BOOST_CHECK_MESSAGE(!function->documentation(), "Shouldn't get natspec docstring for this function"); } diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index 8d3e5392..431f233e 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -35,49 +35,49 @@ BOOST_AUTO_TEST_SUITE(SolidityScanner) BOOST_AUTO_TEST_CASE(test_empty) { Scanner scanner(CharStream("")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); } BOOST_AUTO_TEST_CASE(smoke_test) { Scanner scanner(CharStream("function break;765 \t \"string1\",'string2'\nidentifier1")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Function); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Function); BOOST_CHECK_EQUAL(scanner.next(), Token::Break); BOOST_CHECK_EQUAL(scanner.next(), Token::Semicolon); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "765"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "765"); BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "string1"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "string1"); BOOST_CHECK_EQUAL(scanner.next(), Token::Comma); BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "string2"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "string2"); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "identifier1"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "identifier1"); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } BOOST_AUTO_TEST_CASE(string_escapes) { Scanner scanner(CharStream(" { \"a\\x61\"")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "aa"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "aa"); } BOOST_AUTO_TEST_CASE(string_escapes_with_zero) { Scanner scanner(CharStream(" { \"a\\x61\\x00abc\"")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), std::string("aa\0abc", 6)); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), std::string("aa\0abc", 6)); } BOOST_AUTO_TEST_CASE(string_escape_illegal) { Scanner scanner(CharStream(" bla \"\\x6rf\" (illegalescape)")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), ""); // TODO recovery from illegal tokens should be improved BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); @@ -88,11 +88,11 @@ BOOST_AUTO_TEST_CASE(string_escape_illegal) BOOST_AUTO_TEST_CASE(hex_numbers) { Scanner scanner(CharStream("var x = 0x765432536763762734623472346;")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Var); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Var); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Assign); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "0x765432536763762734623472346"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "0x765432536763762734623472346"); BOOST_CHECK_EQUAL(scanner.next(), Token::Semicolon); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } @@ -100,23 +100,23 @@ BOOST_AUTO_TEST_CASE(hex_numbers) BOOST_AUTO_TEST_CASE(negative_numbers) { Scanner scanner(CharStream("var x = -.2 + -0x78 + -7.3 + 8.9;")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Var); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Var); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Assign); BOOST_CHECK_EQUAL(scanner.next(), Token::Sub); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), ".2"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), ".2"); BOOST_CHECK_EQUAL(scanner.next(), Token::Add); BOOST_CHECK_EQUAL(scanner.next(), Token::Sub); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "0x78"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "0x78"); BOOST_CHECK_EQUAL(scanner.next(), Token::Add); BOOST_CHECK_EQUAL(scanner.next(), Token::Sub); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "7.3"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "7.3"); BOOST_CHECK_EQUAL(scanner.next(), Token::Add); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "8.9"); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "8.9"); BOOST_CHECK_EQUAL(scanner.next(), Token::Semicolon); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } @@ -124,22 +124,22 @@ BOOST_AUTO_TEST_CASE(negative_numbers) BOOST_AUTO_TEST_CASE(locations) { Scanner scanner(CharStream("function_identifier has ; -0x743/*comment*/\n ident //comment")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 0); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 19); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentLocation().start, 0); + BOOST_CHECK_EQUAL(scanner.currentLocation().end, 19); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 20); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 23); + BOOST_CHECK_EQUAL(scanner.currentLocation().start, 20); + BOOST_CHECK_EQUAL(scanner.currentLocation().end, 23); BOOST_CHECK_EQUAL(scanner.next(), Token::Semicolon); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 24); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 25); + BOOST_CHECK_EQUAL(scanner.currentLocation().start, 24); + BOOST_CHECK_EQUAL(scanner.currentLocation().end, 25); BOOST_CHECK_EQUAL(scanner.next(), Token::Sub); BOOST_CHECK_EQUAL(scanner.next(), Token::Number); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 27); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 32); + BOOST_CHECK_EQUAL(scanner.currentLocation().start, 27); + BOOST_CHECK_EQUAL(scanner.currentLocation().end, 32); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 45); - BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 50); + BOOST_CHECK_EQUAL(scanner.currentLocation().start, 45); + BOOST_CHECK_EQUAL(scanner.currentLocation().end, 50); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); } @@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(ambiguities) { // test scanning of some operators which need look-ahead Scanner scanner(CharStream("<=""<""+ +=a++ =>""<<")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::LessThanOrEqual); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LessThanOrEqual); BOOST_CHECK_EQUAL(scanner.next(), Token::LessThan); BOOST_CHECK_EQUAL(scanner.next(), Token::Add); BOOST_CHECK_EQUAL(scanner.next(), Token::AssignAdd); @@ -160,25 +160,25 @@ BOOST_AUTO_TEST_CASE(ambiguities) BOOST_AUTO_TEST_CASE(documentation_comments_parsed_begin) { Scanner scanner(CharStream("/// Send $(value / 1000) chocolates to the user")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(multiline_documentation_comments_parsed_begin) { Scanner scanner(CharStream("/** Send $(value / 1000) chocolates to the user*/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(documentation_comments_parsed) { Scanner scanner(CharStream("some other tokens /// Send $(value / 1000) chocolates to the user")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(multiline_documentation_comments_parsed) @@ -186,11 +186,11 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_comments_parsed) Scanner scanner(CharStream("some other tokens /**\n" "* Send $(value / 1000) chocolates to the user\n" "*/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(multiline_documentation_no_stars) @@ -198,11 +198,11 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_no_stars) Scanner scanner(CharStream("some other tokens /**\n" " Send $(value / 1000) chocolates to the user\n" "*/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(multiline_documentation_whitespace_hell) @@ -210,39 +210,39 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_whitespace_hell) Scanner scanner(CharStream("some other tokens /** \t \r \n" "\t \r * Send $(value / 1000) chocolates to the user\n" "*/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user"); } BOOST_AUTO_TEST_CASE(comment_before_eos) { Scanner scanner(CharStream("//")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), ""); } BOOST_AUTO_TEST_CASE(documentation_comment_before_eos) { Scanner scanner(CharStream("///")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), ""); } BOOST_AUTO_TEST_CASE(empty_multiline_comment) { Scanner scanner(CharStream("/**/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), ""); } BOOST_AUTO_TEST_CASE(empty_multiline_documentation_comment_before_eos) { Scanner scanner(CharStream("/***/")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::EOS); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), ""); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::EOS); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), ""); } BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence) @@ -250,15 +250,15 @@ BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence) Scanner scanner(CharStream("hello_world ///documentation comment \n" "//simple comment \n" "<<")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::Identifier); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); BOOST_CHECK_EQUAL(scanner.next(), Token::SHL); - BOOST_CHECK_EQUAL(scanner.getCurrentCommentLiteral(), "documentation comment "); + BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "documentation comment "); } BOOST_AUTO_TEST_CASE(ether_subdenominations) { Scanner scanner(CharStream("wei szabo finney ether")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::SubWei); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubWei); BOOST_CHECK_EQUAL(scanner.next(), Token::SubSzabo); BOOST_CHECK_EQUAL(scanner.next(), Token::SubFinney); BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(ether_subdenominations) BOOST_AUTO_TEST_CASE(time_subdenominations) { Scanner scanner(CharStream("seconds minutes hours days weeks years")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::SubSecond); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubSecond); BOOST_CHECK_EQUAL(scanner.next(), Token::SubMinute); BOOST_CHECK_EQUAL(scanner.next(), Token::SubHour); BOOST_CHECK_EQUAL(scanner.next(), Token::SubDay); @@ -278,7 +278,7 @@ BOOST_AUTO_TEST_CASE(time_subdenominations) BOOST_AUTO_TEST_CASE(time_after) { Scanner scanner(CharStream("after 1")); - BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::After); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::After); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index 7892de67..fc97667c 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -41,13 +41,13 @@ BOOST_AUTO_TEST_CASE(storage_layout_simple) {string("second"), Type::fromElementaryTypeName("uint120")}, {string("wraps"), Type::fromElementaryTypeName("uint16")} })); - BOOST_REQUIRE_EQUAL(u256(2), members.getStorageSize()); - BOOST_REQUIRE(members.getMemberStorageOffset("first") != nullptr); - BOOST_REQUIRE(members.getMemberStorageOffset("second") != nullptr); - BOOST_REQUIRE(members.getMemberStorageOffset("wraps") != nullptr); - BOOST_CHECK(*members.getMemberStorageOffset("first") == make_pair(u256(0), unsigned(0))); - BOOST_CHECK(*members.getMemberStorageOffset("second") == make_pair(u256(0), unsigned(16))); - BOOST_CHECK(*members.getMemberStorageOffset("wraps") == make_pair(u256(1), unsigned(0))); + BOOST_REQUIRE_EQUAL(u256(2), members.storageSize()); + BOOST_REQUIRE(members.memberStorageOffset("first") != nullptr); + BOOST_REQUIRE(members.memberStorageOffset("second") != nullptr); + BOOST_REQUIRE(members.memberStorageOffset("wraps") != nullptr); + BOOST_CHECK(*members.memberStorageOffset("first") == make_pair(u256(0), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("second") == make_pair(u256(0), unsigned(16))); + BOOST_CHECK(*members.memberStorageOffset("wraps") == make_pair(u256(1), unsigned(0))); } BOOST_AUTO_TEST_CASE(storage_layout_mapping) @@ -64,26 +64,26 @@ BOOST_AUTO_TEST_CASE(storage_layout_mapping) Type::fromElementaryTypeName("uint8") )}, })); - BOOST_REQUIRE_EQUAL(u256(4), members.getStorageSize()); - BOOST_REQUIRE(members.getMemberStorageOffset("first") != nullptr); - BOOST_REQUIRE(members.getMemberStorageOffset("second") != nullptr); - BOOST_REQUIRE(members.getMemberStorageOffset("third") != nullptr); - BOOST_REQUIRE(members.getMemberStorageOffset("final") != nullptr); - BOOST_CHECK(*members.getMemberStorageOffset("first") == make_pair(u256(0), unsigned(0))); - BOOST_CHECK(*members.getMemberStorageOffset("second") == make_pair(u256(1), unsigned(0))); - BOOST_CHECK(*members.getMemberStorageOffset("third") == make_pair(u256(2), unsigned(0))); - BOOST_CHECK(*members.getMemberStorageOffset("final") == make_pair(u256(3), unsigned(0))); + BOOST_REQUIRE_EQUAL(u256(4), members.storageSize()); + BOOST_REQUIRE(members.memberStorageOffset("first") != nullptr); + BOOST_REQUIRE(members.memberStorageOffset("second") != nullptr); + BOOST_REQUIRE(members.memberStorageOffset("third") != nullptr); + BOOST_REQUIRE(members.memberStorageOffset("final") != nullptr); + BOOST_CHECK(*members.memberStorageOffset("first") == make_pair(u256(0), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("second") == make_pair(u256(1), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("third") == make_pair(u256(2), unsigned(0))); + BOOST_CHECK(*members.memberStorageOffset("final") == make_pair(u256(3), unsigned(0))); } BOOST_AUTO_TEST_CASE(storage_layout_arrays) { - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(1), 32).getStorageSize() == 1); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(1), 33).getStorageSize() == 2); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(2), 31).getStorageSize() == 2); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(7), 8).getStorageSize() == 2); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(7), 9).getStorageSize() == 3); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(31), 9).getStorageSize() == 9); - BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(32), 9).getStorageSize() == 9); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(1), 32).storageSize() == 1); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(1), 33).storageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(2), 31).storageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(7), 8).storageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(7), 9).storageSize() == 3); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(31), 9).storageSize() == 9); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared<FixedBytesType>(32), 9).storageSize() == 9); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h index 05f93bb6..86e7d351 100644 --- a/test/libsolidity/solidityExecutionFramework.h +++ b/test/libsolidity/solidityExecutionFramework.h @@ -59,7 +59,7 @@ public: m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", _sourceCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); - bytes code = m_compiler.getBytecode(_contractName); + bytes code = m_compiler.bytecode(_contractName); sendMessage(code + _arguments, true, _value); return m_output; } |