From eab39a8aa82bbef9eabbd54d8acae93187d11278 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Wed, 24 Jul 2019 19:18:15 +0200 Subject: [PATCH] Add few missing tests --- tests/test_SymbolTable.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp index c97706921..aa15ef0c1 100644 --- a/tests/test_SymbolTable.cpp +++ b/tests/test_SymbolTable.cpp @@ -13,14 +13,19 @@ TEST_CASE("SymbolTable", "[language]") using namespace TAO_PEGTL_NAMESPACE; position begin_position{internal::iterator{"fixture"}, "fixture"}; + begin_position.byte = 2; auto [i_symbol_a, created_a] = root_st->add("a", begin_position); REQUIRE(created_a); + REQUIRE(i_symbol_a->second.position().byte == 2); + // Check that one cannot build another "a" in this table REQUIRE(not root_st->add("a", begin_position).second); position use_position{internal::iterator{"fixture"}, "fixture"}; + use_position.byte = 3; // after declarative position + auto [i_search_a, found_a] = root_st->find("a", use_position); REQUIRE(found_a); REQUIRE(i_search_a == i_symbol_a); @@ -65,6 +70,9 @@ TEST_CASE("SymbolTable", "[language]") REQUIRE(std::holds_alternative<double>(attributes_a.value())); + const auto const_attribute_a = attributes_a; + REQUIRE(std::get<double>(const_attribute_a.value()) == 2.3); + { std::stringstream value_output; value_output << attributes_a; -- GitLab