diff options
author | Christian Parpart <christian@ethereum.org> | 2018-12-12 21:43:34 +0800 |
---|---|---|
committer | Christian Parpart <christian@ethereum.org> | 2018-12-19 18:21:45 +0800 |
commit | d10bae245ed441314c3bd6ecc74b2a1f3d060d12 (patch) | |
tree | 1c93d817c44d86d5d3c8ee5c79d04196de289132 /test | |
parent | 678a95f6e3bbd9f1c4914151c0178847348de970 (diff) | |
download | dexon-solidity-d10bae245ed441314c3bd6ecc74b2a1f3d060d12.tar.gz dexon-solidity-d10bae245ed441314c3bd6ecc74b2a1f3d060d12.tar.zst dexon-solidity-d10bae245ed441314c3bd6ecc74b2a1f3d060d12.zip |
liblangutil: SourceLocation to default initialize data members (w/o the use of ctor)
See: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c45-dont-define-a-default-constructor-that-only-initializes-data-members-use-in-class-member-initializers-instead
Diffstat (limited to 'test')
-rw-r--r-- | test/libevmasm/Assembler.cpp | 4 | ||||
-rw-r--r-- | test/libevmasm/Optimiser.cpp | 2 | ||||
-rw-r--r-- | test/liblangutil/SourceLocation.cpp | 12 | ||||
-rw-r--r-- | test/libsolidity/Assembly.cpp | 26 |
4 files changed, 22 insertions, 22 deletions
diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index 6976755f..4e9040b9 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -56,11 +56,11 @@ BOOST_AUTO_TEST_CASE(all_assembly_items) { Assembly _assembly; auto root_asm = make_shared<CharStream>("", "root.asm"); - _assembly.setSourceLocation(SourceLocation(1, 3, root_asm)); + _assembly.setSourceLocation({1, 3, root_asm}); Assembly _subAsm; auto sub_asm = make_shared<CharStream>("", "sub.asm"); - _subAsm.setSourceLocation(SourceLocation(6, 8, sub_asm)); + _subAsm.setSourceLocation({6, 8, sub_asm}); _subAsm.append(Instruction::INVALID); shared_ptr<Assembly> _subAsmPtr = make_shared<Assembly>(_subAsm); diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 7d102948..c65d28d3 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -53,7 +53,7 @@ namespace // add dummy locations to each item so that we can check that they are not deleted AssemblyItems input = _input; for (AssemblyItem& item: input) - item.setLocation(SourceLocation(1, 3, nullptr)); + item.setLocation({1, 3, nullptr}); return input; } diff --git a/test/liblangutil/SourceLocation.cpp b/test/liblangutil/SourceLocation.cpp index ef4103da..5bdce88e 100644 --- a/test/liblangutil/SourceLocation.cpp +++ b/test/liblangutil/SourceLocation.cpp @@ -37,12 +37,12 @@ BOOST_AUTO_TEST_CASE(test_fail) auto const sourceA = std::make_shared<CharStream>("", "sourceA"); auto const sourceB = std::make_shared<CharStream>("", "sourceB"); - BOOST_CHECK(SourceLocation() == SourceLocation()); - BOOST_CHECK(SourceLocation(0, 3, sourceA) != SourceLocation(0, 3, sourceB)); - BOOST_CHECK(SourceLocation(0, 3, source) == SourceLocation(0, 3, source)); - BOOST_CHECK(SourceLocation(3, 7, source).contains(SourceLocation(4, 6, source))); - BOOST_CHECK(!SourceLocation(3, 7, sourceA).contains(SourceLocation(4, 6, sourceB))); - BOOST_CHECK(SourceLocation(3, 7, sourceA) < SourceLocation(4, 6, sourceB)); + BOOST_CHECK(SourceLocation{} == SourceLocation{}); + BOOST_CHECK((SourceLocation{0, 3, sourceA} != SourceLocation{0, 3, sourceB})); + BOOST_CHECK((SourceLocation{0, 3, source} == SourceLocation{0, 3, source})); + BOOST_CHECK((SourceLocation{3, 7, source}.contains(SourceLocation{4, 6, source}))); + BOOST_CHECK((!SourceLocation{3, 7, sourceA}.contains(SourceLocation{4, 6, sourceB}))); + BOOST_CHECK((SourceLocation{3, 7, sourceA} < SourceLocation{4, 6, sourceB})); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 5d8c89a4..baa9bff1 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -165,19 +165,19 @@ BOOST_AUTO_TEST_CASE(location_test) auto codegenCharStream = make_shared<CharStream>("", "--CODEGEN--"); vector<SourceLocation> locations = - vector<SourceLocation>(4, SourceLocation(2, 82, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(8, 17, codegenCharStream)) + - vector<SourceLocation>(3, SourceLocation(5, 7, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(30, 31, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(27, 28, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(20, 32, codegenCharStream)) + - vector<SourceLocation>(1, SourceLocation(5, 7, codegenCharStream)) + - vector<SourceLocation>(hasShifts ? 19 : 20, SourceLocation(2, 82, sourceCode)) + - vector<SourceLocation>(24, SourceLocation(20, 79, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(49, 58, sourceCode)) + - vector<SourceLocation>(1, SourceLocation(72, 74, sourceCode)) + - vector<SourceLocation>(2, SourceLocation(65, 74, sourceCode)) + - vector<SourceLocation>(2, SourceLocation(20, 79, sourceCode)); + vector<SourceLocation>(4, SourceLocation{2, 82, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{8, 17, codegenCharStream}) + + vector<SourceLocation>(3, SourceLocation{5, 7, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{30, 31, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{27, 28, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{20, 32, codegenCharStream}) + + vector<SourceLocation>(1, SourceLocation{5, 7, codegenCharStream}) + + vector<SourceLocation>(hasShifts ? 19 : 20, SourceLocation{2, 82, sourceCode}) + + vector<SourceLocation>(24, SourceLocation{20, 79, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{49, 58, sourceCode}) + + vector<SourceLocation>(1, SourceLocation{72, 74, sourceCode}) + + vector<SourceLocation>(2, SourceLocation{65, 74, sourceCode}) + + vector<SourceLocation>(2, SourceLocation{20, 79, sourceCode}); checkAssemblyLocations(items, locations); } |