diff options
Diffstat (limited to 'test/libevmasm')
-rw-r--r-- | test/libevmasm/Assembler.cpp | 7 | ||||
-rw-r--r-- | test/libevmasm/Optimiser.cpp | 3 | ||||
-rw-r--r-- | test/libevmasm/SourceLocation.cpp | 50 |
3 files changed, 7 insertions, 53 deletions
diff --git a/test/libevmasm/Assembler.cpp b/test/libevmasm/Assembler.cpp index 1c041596..bece2be4 100644 --- a/test/libevmasm/Assembler.cpp +++ b/test/libevmasm/Assembler.cpp @@ -30,6 +30,7 @@ #include <memory> using namespace std; +using namespace langutil; using namespace dev::eth; namespace dev @@ -54,10 +55,12 @@ BOOST_AUTO_TEST_SUITE(Assembler) BOOST_AUTO_TEST_CASE(all_assembly_items) { Assembly _assembly; - _assembly.setSourceLocation(SourceLocation(1, 3, make_shared<string>("root.asm"))); + auto root_asm = make_shared<CharStream>("", "root.asm"); + _assembly.setSourceLocation(SourceLocation(1, 3, root_asm)); Assembly _subAsm; - _subAsm.setSourceLocation(SourceLocation(6, 8, make_shared<string>("sub.asm"))); + auto sub_asm = make_shared<CharStream>("", "sub.asm"); + _subAsm.setSourceLocation(SourceLocation(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 c01e8758..7d102948 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -36,6 +36,7 @@ #include <memory> using namespace std; +using namespace langutil; using namespace dev::eth; namespace dev @@ -52,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, make_shared<string>(""))); + item.setLocation(SourceLocation(1, 3, nullptr)); return input; } diff --git a/test/libevmasm/SourceLocation.cpp b/test/libevmasm/SourceLocation.cpp deleted file mode 100644 index 764da3cd..00000000 --- a/test/libevmasm/SourceLocation.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see <http://www.gnu.org/licenses/>. -*/ -/** - * @author Yoichi Hirai <yoichi@ethereum.org> - * @date 2016 - * Unit tests for the SourceLocation class. - */ - -#include <libevmasm/SourceLocation.h> - -#include <test/Options.h> - -namespace dev -{ -namespace solidity -{ -namespace test -{ - -BOOST_AUTO_TEST_SUITE(SourceLocationTest) - -BOOST_AUTO_TEST_CASE(test_fail) -{ - BOOST_CHECK(SourceLocation() == SourceLocation()); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared<std::string>("sourceA")) != SourceLocation(0, 3, std::make_shared<std::string>("sourceB"))); - BOOST_CHECK(SourceLocation(0, 3, std::make_shared<std::string>("source")) == SourceLocation(0, 3, std::make_shared<std::string>("source"))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared<std::string>("source")).contains(SourceLocation(4, 6, std::make_shared<std::string>("source")))); - BOOST_CHECK(!SourceLocation(3, 7, std::make_shared<std::string>("sourceA")).contains(SourceLocation(4, 6, std::make_shared<std::string>("sourceB")))); - BOOST_CHECK(SourceLocation(3, 7, std::make_shared<std::string>("sourceA")) < SourceLocation(4, 6, std::make_shared<std::string>("sourceB"))); -} - -BOOST_AUTO_TEST_SUITE_END() - -} -} -} // end namespaces |