Skip to content
Snippets Groups Projects
Commit eab39a8a authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add few missing tests

parent 5e639ce8
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment