From 980596dab7588715d43a06485117247991c71454 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Sun, 27 Oct 2024 09:56:32 +0100 Subject: [PATCH] Add symbol tables clean-up in tests --- tests/test_ASTBuilder.cpp | 2 + tests/test_ASTDotPrinter.cpp | 2 + tests/test_ASTModulesImporter.cpp | 3 + ...st_ASTNodeAffectationExpressionBuilder.cpp | 10 ++++ ...ASTNodeBinaryOperatorExpressionBuilder.cpp | 3 + ...STNodeBuiltinFunctionExpressionBuilder.cpp | 3 + tests/test_ASTNodeDataTypeBuilder.cpp | 29 ++++++++++ tests/test_ASTNodeDataTypeChecker.cpp | 2 + tests/test_ASTNodeDataTypeFlattener.cpp | 6 ++ ...TNodeDeclarationToAffectationConverter.cpp | 1 + tests/test_ASTNodeEmptyBlockCleaner.cpp | 1 + tests/test_ASTNodeExpressionBuilder.cpp | 3 + ...odeFunctionEvaluationExpressionBuilder.cpp | 1 + .../test_ASTNodeFunctionExpressionBuilder.cpp | 13 ++--- tests/test_ASTNodeIncDecExpressionBuilder.cpp | 2 + tests/test_ASTNodeJumpPlacementChecker.cpp | 8 +++ ...STNodeListAffectationExpressionBuilder.cpp | 1 + tests/test_ASTNodeListProcessor.cpp | 1 + tests/test_ASTNodeTypeCleaner.cpp | 1 + ..._ASTNodeUnaryOperatorExpressionBuilder.cpp | 2 + tests/test_ASTPrinter.cpp | 2 + tests/test_ASTSymbolInitializationChecker.cpp | 12 ++++ tests/test_ASTSymbolTableBuilder.cpp | 10 +++- tests/test_AffectationProcessor.cpp | 4 ++ tests/test_AffectationToStringProcessor.cpp | 1 + tests/test_AffectationToTupleProcessor.cpp | 2 + tests/test_ArraySubscriptProcessor.cpp | 2 + ...t_BinaryExpressionProcessor_arithmetic.cpp | 2 + .../test_BinaryExpressionProcessor_shift.cpp | 1 + tests/test_BuiltinFunctionEmbedderUtils.cpp | 58 +++++++++++++++++++ tests/test_BuiltinFunctionProcessor.cpp | 2 + tests/test_ConcatExpressionProcessor.cpp | 1 + tests/test_DiscreteFunctionIntegrator.cpp | 3 + .../test_DiscreteFunctionIntegratorByZone.cpp | 3 + tests/test_DiscreteFunctionInterpoler.cpp | 3 + .../test_DiscreteFunctionInterpolerByZone.cpp | 3 + .../test_DiscreteFunctionVectorIntegrator.cpp | 4 ++ ...DiscreteFunctionVectorIntegratorByZone.cpp | 3 + .../test_DiscreteFunctionVectorInterpoler.cpp | 4 ++ ...DiscreteFunctionVectorInterpolerByZone.cpp | 4 ++ tests/test_DoWhileProcessor.cpp | 2 + tests/test_ForProcessor.cpp | 2 + tests/test_FunctionProcessor.cpp | 2 + tests/test_IfProcessor.cpp | 2 + tests/test_IncDecExpressionProcessor.cpp | 3 + tests/test_IntegrateCellArray.cpp | 6 ++ tests/test_IntegrateCellValue.cpp | 6 ++ tests/test_IntegrateOnCells.cpp | 18 ++++++ tests/test_InterpolateItemArray.cpp | 15 +++++ tests/test_InterpolateItemValue.cpp | 6 ++ ...est_ItemArrayVariantFunctionInterpoler.cpp | 3 + ...est_ItemValueVariantFunctionInterpoler.cpp | 3 + tests/test_ListAffectationProcessor.cpp | 2 + tests/test_NameProcessor.cpp | 2 + tests/test_PugsFunctionAdapter.cpp | 2 + tests/test_TupleToVectorProcessor.cpp | 2 + tests/test_UnaryExpressionProcessor.cpp | 3 + tests/test_WhileProcessor.cpp | 4 +- tests/test_checkpointing_Checkpoint.cpp | 1 + ...st_checkpointing_Checkpoint_sequential.cpp | 1 + ...kpointing_IBoundaryConditionDescriptor.cpp | 1 + 61 files changed, 295 insertions(+), 9 deletions(-) diff --git a/tests/test_ASTBuilder.cpp b/tests/test_ASTBuilder.cpp index e1ee2761d..1a443ba4e 100644 --- a/tests/test_ASTBuilder.cpp +++ b/tests/test_ASTBuilder.cpp @@ -3,6 +3,7 @@ #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTPrinter.hpp> +#include <language/utils/SymbolTable.hpp> #include <pegtl/string_input.hpp> @@ -20,6 +21,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::none}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTDotPrinter.cpp b/tests/test_ASTDotPrinter.cpp index 7081821e6..ca5f817a8 100644 --- a/tests/test_ASTDotPrinter.cpp +++ b/tests/test_ASTDotPrinter.cpp @@ -3,6 +3,7 @@ #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTDotPrinter.hpp> +#include <language/utils/SymbolTable.hpp> #include <pegtl/string_input.hpp> @@ -20,6 +21,7 @@ ast_output << '\n' << ASTDotPrinter{*ast}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTModulesImporter.cpp b/tests/test_ASTModulesImporter.cpp index 6156c571e..fdfa69ce4 100644 --- a/tests/test_ASTModulesImporter.cpp +++ b/tests/test_ASTModulesImporter.cpp @@ -46,6 +46,7 @@ test_ASTExecutionInfo(const ASTNode& root_node, const ModuleRepository& module_r ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::data_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static @@ -103,6 +104,7 @@ import unknown_module; auto ast = ASTBuilder::build(input); REQUIRE_THROWS_AS(ASTModulesImporter{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } SECTION("symbol already defined (same builtin function)") @@ -117,6 +119,7 @@ import math; ast->m_symbol_table->add("sin:R", ast->begin()); REQUIRE_THROWS_AS(ASTModulesImporter{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ASTNodeAffectationExpressionBuilder.cpp b/tests/test_ASTNodeAffectationExpressionBuilder.cpp index 39fcf659b..7524a099c 100644 --- a/tests/test_ASTNodeAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeAffectationExpressionBuilder.cpp @@ -45,6 +45,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } template <> @@ -100,6 +101,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou \ REQUIRE(ast_output.str() == expected_output); \ \ + ast->m_symbol_table->clearValues(); \ OperatorRepository::instance().reset(); \ } @@ -121,6 +123,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_WITH_BUILTIN_THROWS_WITH(data, expected_error) \ @@ -168,6 +171,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ \ + ast->m_symbol_table->clearValues(); \ OperatorRepository::instance().reset(); \ } @@ -3268,6 +3272,7 @@ let (x,y,z):R*R*R, (x,y) = (2,3); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"invalid number of definition identifiers, expecting 3 found 2"}); + ast->m_symbol_table->clearValues(); } SECTION("incorrect identifier/expression number of symbols") @@ -3285,6 +3290,7 @@ let x:R, (x,y) = (2,3); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"unexpected variable list, expecting one identifier"}); + ast->m_symbol_table->clearValues(); } SECTION("incorrect definition variable identifier") @@ -3301,6 +3307,7 @@ let x:R, y = 3; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"invalid identifier, expecting 'x'"}); + ast->m_symbol_table->clearValues(); } SECTION("invalid definition variable identifier order") @@ -3316,6 +3323,7 @@ let (x,y):R, (y,x) = (3,2); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"invalid identifier, expecting 'x'"}); + ast->m_symbol_table->clearValues(); } SECTION("undefined affectations =") @@ -7508,6 +7516,7 @@ let a:void; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); + ast->m_symbol_table->clearValues(); } } @@ -7527,6 +7536,7 @@ let a:void, a = 3; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp index 8443d55be..0bd3f48fa 100644 --- a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp @@ -45,6 +45,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define REQUIRE_AST_THROWS_WITH(data, expected_output) \ @@ -56,6 +57,7 @@ \ ASTSymbolTableBuilder{*ast}; \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static @@ -1874,6 +1876,7 @@ x!=[4,3,2]; ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } SECTION("shift left (builtin)") diff --git a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp index 05b64ce51..a40b605e3 100644 --- a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp @@ -42,6 +42,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_WITH(data, expected_error) \ @@ -61,6 +62,7 @@ ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_AT_BUILD_WITH(data, expected_error) \ @@ -76,6 +78,7 @@ \ ASTSymbolTableBuilder{*ast}; \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, expected_error); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeDataTypeBuilder.cpp b/tests/test_ASTNodeDataTypeBuilder.cpp index 2a5777b32..d82f6c514 100644 --- a/tests/test_ASTNodeDataTypeBuilder.cpp +++ b/tests/test_ASTNodeDataTypeBuilder.cpp @@ -32,6 +32,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::data_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } template <> @@ -65,6 +66,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::data_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static @@ -93,6 +95,7 @@ import a_module_name; ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::data_type}}; REQUIRE(ast_output.str() == result); + ast->m_symbol_table->clearValues(); } SECTION("integer") @@ -321,6 +324,7 @@ let x:R, x = 1; let y:R, y = x[2]; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid subscript expression: R cannot be indexed"); + ast->m_symbol_table->clearValues(); } SECTION("invalid R^d subscript index list") @@ -334,6 +338,7 @@ let x:R^2, x = 0; let y:R, y = x[2,2]; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid index type: R^2 requires a single integer"); + ast->m_symbol_table->clearValues(); } SECTION("invalid R^dxd subscript index list 1") @@ -347,6 +352,7 @@ let x:R^2x2, x = 0; let y:R, y = x[2][1]; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid index type: R^2x2 requires two integers"); + ast->m_symbol_table->clearValues(); } SECTION("invalid R^dxd subscript index list 2") @@ -374,6 +380,7 @@ let (x,b,n,s,t) : R*B*N*string; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of product spaces (4) R*B*N*string differs from " "number of variables (5) (x,b,n,s,t) "); + ast->m_symbol_table->clearValues(); } SECTION("too few variables") @@ -388,6 +395,7 @@ let (x,b,n) : R*B*N*string; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of product spaces (4) R*B*N*string differs from " "number of variables (3) (x,b,n) "); + ast->m_symbol_table->clearValues(); } SECTION("unexpected variable list") @@ -401,6 +409,7 @@ let (x,y) : R; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "unexpected variable list for single space"); + ast->m_symbol_table->clearValues(); } SECTION("invalid R-list -> R^d") @@ -415,6 +424,7 @@ let square : R -> R^3, x -> (x, 2); REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of image spaces (1) R^3 differs from number of expressions (2) (x, 2)"); + ast->m_symbol_table->clearValues(); } } } @@ -713,6 +723,7 @@ let t : builtin_t; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "undefined type identifier"); + ast->m_symbol_table->clearValues(); } SECTION("type_id 2") @@ -728,6 +739,7 @@ let t : a; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid type identifier, 'a' was previously defined as a 'R'"); + ast->m_symbol_table->clearValues(); } SECTION("type_id tuples") @@ -741,6 +753,7 @@ let t : (builtin_t); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "undefined type identifier"); + ast->m_symbol_table->clearValues(); } SECTION("type_id tuples 2") @@ -756,6 +769,7 @@ let t : (a); REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid type identifier, 'a' was previously defined as a 'R'"); + ast->m_symbol_table->clearValues(); } } } @@ -1067,6 +1081,7 @@ let f : R*Z -> B, x -> 3; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of product spaces (2) R*Z differs from number of variables (1) x"); + ast->m_symbol_table->clearValues(); } SECTION("wrong parameter number 2") @@ -1080,6 +1095,7 @@ let f : R -> B, (x,y) -> 3; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of product spaces (1) R differs from number of variables (2) (x,y) "); + ast->m_symbol_table->clearValues(); } SECTION("wrong image size") @@ -1093,6 +1109,7 @@ let f : R*Z -> B, (x,z) -> (3, x); REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of image spaces (1) B differs from number of expressions (2) (3, x)"); + ast->m_symbol_table->clearValues(); } SECTION("wrong image size 2") @@ -1110,6 +1127,7 @@ let f : R -> R*R, x -> x*x*x; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of image spaces (2) R*R differs from number of expressions (1) x*x*x"); + ast->m_symbol_table->clearValues(); } SECTION("wrong image size 3") @@ -1127,6 +1145,7 @@ let f : R -> R^2x2, x -> (x, 2*x, 2); REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "number of image spaces (1) R^2x2 differs from number of expressions (3) (x, 2*x, 2)"); + ast->m_symbol_table->clearValues(); } SECTION("undefined type identifier") @@ -1139,6 +1158,7 @@ let x:X; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "undefined type identifier"); + ast->m_symbol_table->clearValues(); } SECTION("undefined type identifier") @@ -1153,6 +1173,7 @@ let x:X; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid type identifier, 'X' was previously defined as a 'R'"); + ast->m_symbol_table->clearValues(); } SECTION("undefined image type identifier") @@ -1165,6 +1186,7 @@ let f: R -> X, x -> x; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "undefined type identifier"); + ast->m_symbol_table->clearValues(); } SECTION("invalid image type identifier") @@ -1179,6 +1201,7 @@ let f: R -> X, x -> x; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid type identifier, 'X' was previously defined as a 'R'"); + ast->m_symbol_table->clearValues(); } SECTION("invalid tuple type domain") @@ -1191,6 +1214,7 @@ let f: (R) -> R, x -> x; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "cannot use tuple (R) as a domain for user functions"); + ast->m_symbol_table->clearValues(); } SECTION("invalid tuple type in compound domain") @@ -1203,6 +1227,7 @@ let f: N*(R^2) -> R, (x,t) -> x; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "cannot use tuple (R^2) as a domain for user functions"); + ast->m_symbol_table->clearValues(); } } } @@ -1460,6 +1485,7 @@ not_a_function(2,3); REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid function call\n" "note: 'not_a_function' (type: R) is not a function!"); + ast->m_symbol_table->clearValues(); } } } @@ -1920,6 +1946,7 @@ if ("string"); auto ast = ASTBuilder::build(input); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid implicit conversion: string -> B"); + ast->m_symbol_table->clearValues(); } } @@ -2006,6 +2033,7 @@ while ("string"); auto ast = ASTBuilder::build(input); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid implicit conversion: string -> B"); + ast->m_symbol_table->clearValues(); } } @@ -2092,6 +2120,7 @@ do 1; while ("string"); auto ast = ASTBuilder::build(input); ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, "invalid implicit conversion: string -> B"); + ast->m_symbol_table->clearValues(); } } diff --git a/tests/test_ASTNodeDataTypeChecker.cpp b/tests/test_ASTNodeDataTypeChecker.cpp index 5c0fc6d8f..69aa66383 100644 --- a/tests/test_ASTNodeDataTypeChecker.cpp +++ b/tests/test_ASTNodeDataTypeChecker.cpp @@ -34,6 +34,7 @@ for(let i:Z, i=0; i<10; ++i) { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeDataTypeChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("everything uninitialized node type") @@ -57,5 +58,6 @@ for(let i:Z, i=0; i<10; ++i) { ast->children[0]->m_data_type = ASTNodeDataType::build<ASTNodeDataType::undefined_t>(); REQUIRE_THROWS_AS(ASTNodeDataTypeChecker{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } } diff --git a/tests/test_ASTNodeDataTypeFlattener.cpp b/tests/test_ASTNodeDataTypeFlattener.cpp index aaa3739b2..65249b078 100644 --- a/tests/test_ASTNodeDataTypeFlattener.cpp +++ b/tests/test_ASTNodeDataTypeFlattener.cpp @@ -46,6 +46,7 @@ b; REQUIRE(flattened_datatype_list.size() == 1); REQUIRE(flattened_datatype_list[0].m_data_type == ASTNodeDataType::bool_t); REQUIRE(&flattened_datatype_list[0].m_parent_node == root_node->children[1].get()); + root_node->m_symbol_table->clearValues(); } SECTION("N") @@ -72,6 +73,7 @@ n; REQUIRE(flattened_datatype_list.size() == 1); REQUIRE(flattened_datatype_list[0].m_data_type == ASTNodeDataType::unsigned_int_t); REQUIRE(&flattened_datatype_list[0].m_parent_node == root_node->children[1].get()); + root_node->m_symbol_table->clearValues(); } } @@ -107,6 +109,7 @@ f(2); REQUIRE(flattened_datatype_list.size() == 1); REQUIRE(flattened_datatype_list[0].m_data_type == ASTNodeDataType::unsigned_int_t); REQUIRE(&flattened_datatype_list[0].m_parent_node == root_node->children[0].get()); + root_node->m_symbol_table->clearValues(); } SECTION("function evaluation -> N*R*B*string*Z*builtin_t") @@ -158,6 +161,7 @@ f(2, b); REQUIRE(flattened_datatype_list[3].m_data_type == ASTNodeDataType::string_t); REQUIRE(flattened_datatype_list[4].m_data_type == ASTNodeDataType::int_t); REQUIRE(flattened_datatype_list[5].m_data_type == ASTNodeDataType::type_id_t); + root_node->m_symbol_table->clearValues(); } SECTION("function evaluation -> R*R^3") @@ -191,6 +195,7 @@ f(2); REQUIRE(flattened_datatype_list[0].m_data_type == ASTNodeDataType::double_t); REQUIRE(flattened_datatype_list[1].m_data_type == ASTNodeDataType::vector_t); REQUIRE(flattened_datatype_list[1].m_data_type.dimension() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin_function -> R*R") @@ -225,6 +230,7 @@ sum_vector(2,3); REQUIRE(flattened_datatype_list[0].m_data_type == ASTNodeDataType::double_t); REQUIRE(flattened_datatype_list[1].m_data_type == ASTNodeDataType::vector_t); REQUIRE(flattened_datatype_list[1].m_data_type.dimension() == 2); + root_node->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp index f38b7aaf7..ee9d2ebd5 100644 --- a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp +++ b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp @@ -31,6 +31,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::none}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeEmptyBlockCleaner.cpp b/tests/test_ASTNodeEmptyBlockCleaner.cpp index baf6978c6..db8178420 100644 --- a/tests/test_ASTNodeEmptyBlockCleaner.cpp +++ b/tests/test_ASTNodeEmptyBlockCleaner.cpp @@ -39,6 +39,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeExpressionBuilder.cpp b/tests/test_ASTNodeExpressionBuilder.cpp index 127b2e016..79fae8ff8 100644 --- a/tests/test_ASTNodeExpressionBuilder.cpp +++ b/tests/test_ASTNodeExpressionBuilder.cpp @@ -36,6 +36,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_WITH(data, error_message) \ @@ -49,6 +50,7 @@ ASTSymbolTableBuilder{*ast}; \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static @@ -916,5 +918,6 @@ continue; // for this test ast->children[0]->set_type<language::ignored>(); REQUIRE_THROWS_AS(ASTNodeExpressionBuilder{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } } diff --git a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp index 289eb44be..7ea1be3ac 100644 --- a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp @@ -35,6 +35,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeFunctionExpressionBuilder.cpp b/tests/test_ASTNodeFunctionExpressionBuilder.cpp index f26ee8ad3..ef9ad42fe 100644 --- a/tests/test_ASTNodeFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionExpressionBuilder.cpp @@ -57,6 +57,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS(data) \ @@ -75,6 +76,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ REQUIRE_THROWS_AS(ASTNodeExpressionBuilder{*ast}, ParseError); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_TYPE_BUILDER_THROWS_WITH(data, error) \ @@ -90,6 +92,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou \ ASTSymbolTableBuilder{*ast}; \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_EXPRESSION_BUILDER_THROWS_WITH(data, error) \ @@ -109,6 +112,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error); \ + ast->m_symbol_table->clearValues(); \ } #ifdef __clang__ @@ -4018,6 +4022,7 @@ let g:R -> R, void -> 2; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error); + ast->m_symbol_table->clearValues(); } SECTION("void as a parameter") @@ -4037,6 +4042,7 @@ let g:void -> R, x -> 2; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error); + ast->m_symbol_table->clearValues(); } SECTION("void in compound domain") @@ -4048,13 +4054,6 @@ let h:R*void -> R, (x,void) -> 2.5; std::string error = "parse error, expecting type specifier"; TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; - // auto ast = ASTBuilder::build(input); - - // ASTModulesImporter{*ast}; - // ASTNodeTypeCleaner<language::import_instruction>{*ast}; - - // ASTSymbolTableBuilder{*ast}; - // ASTNodeDataTypeBuilder{*ast}; REQUIRE_THROWS_WITH(ASTBuilder::build(input), error); } diff --git a/tests/test_ASTNodeIncDecExpressionBuilder.cpp b/tests/test_ASTNodeIncDecExpressionBuilder.cpp index 41297a7f0..049fe462f 100644 --- a/tests/test_ASTNodeIncDecExpressionBuilder.cpp +++ b/tests/test_ASTNodeIncDecExpressionBuilder.cpp @@ -39,6 +39,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define DISALLOWED_CHAINED_AST(data, expected_error) \ @@ -60,6 +61,7 @@ ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeJumpPlacementChecker.cpp b/tests/test_ASTNodeJumpPlacementChecker.cpp index f69a09ac4..b25a6669f 100644 --- a/tests/test_ASTNodeJumpPlacementChecker.cpp +++ b/tests/test_ASTNodeJumpPlacementChecker.cpp @@ -29,6 +29,7 @@ for(;;) { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("in while loop") @@ -45,6 +46,7 @@ while(true) { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("in do while loop") @@ -61,6 +63,7 @@ do { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("misplaced") @@ -79,6 +82,7 @@ do { ast->children[0]->m_data_type = ASTNodeDataType::build<ASTNodeDataType::undefined_t>(); REQUIRE_THROWS_AS(ASTNodeJumpPlacementChecker{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } } @@ -98,6 +102,7 @@ for(;;) { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("in while loop") @@ -114,6 +119,7 @@ while(true) { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("in do while loop") @@ -130,6 +136,7 @@ do { ASTNodeDataTypeBuilder{*ast}; REQUIRE_NOTHROW(ASTNodeJumpPlacementChecker{*ast}); + ast->m_symbol_table->clearValues(); } SECTION("misplaced") @@ -148,6 +155,7 @@ do { ast->children[0]->m_data_type = ASTNodeDataType::build<ASTNodeDataType::undefined_t>(); REQUIRE_THROWS_AS(ASTNodeJumpPlacementChecker{*ast}, ParseError); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp index 3f7122860..d929860eb 100644 --- a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp @@ -59,6 +59,7 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_WITH(data, error) \ diff --git a/tests/test_ASTNodeListProcessor.cpp b/tests/test_ASTNodeListProcessor.cpp index 1cc41cb34..583035059 100644 --- a/tests/test_ASTNodeListProcessor.cpp +++ b/tests/test_ASTNodeListProcessor.cpp @@ -45,4 +45,5 @@ true; REQUIRE(ast->children[2]->is_type<language::real>()); REQUIRE(ast->m_node_processor->typeIdName() == demangle<ASTNodeListProcessor>()); + ast->m_symbol_table->clearValues(); } diff --git a/tests/test_ASTNodeTypeCleaner.cpp b/tests/test_ASTNodeTypeCleaner.cpp index d78d4ce17..9bc9d50fd 100644 --- a/tests/test_ASTNodeTypeCleaner.cpp +++ b/tests/test_ASTNodeTypeCleaner.cpp @@ -28,6 +28,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::none}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp index d320aee02..9a12c7089 100644 --- a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp @@ -38,6 +38,7 @@ ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::exec_type}}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_WITH(data, error_message) \ @@ -51,6 +52,7 @@ ASTSymbolTableBuilder{*ast}; \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTPrinter.cpp b/tests/test_ASTPrinter.cpp index 87072e631..375c94297 100644 --- a/tests/test_ASTPrinter.cpp +++ b/tests/test_ASTPrinter.cpp @@ -4,6 +4,7 @@ #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTPrinter.hpp> +#include <language/utils/SymbolTable.hpp> #include <pegtl/string_input.hpp> @@ -21,6 +22,7 @@ ast_output << '\n' << ASTPrinter{*ast, format}; \ \ REQUIRE(ast_output.str() == expected_output); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ASTSymbolInitializationChecker.cpp b/tests/test_ASTSymbolInitializationChecker.cpp index 52b49d7c9..57396e8da 100644 --- a/tests/test_ASTSymbolInitializationChecker.cpp +++ b/tests/test_ASTSymbolInitializationChecker.cpp @@ -41,6 +41,7 @@ let p:N; auto [symbol_p, found_p] = ast->m_symbol_table->find("p", position); REQUIRE(found_p); REQUIRE(not symbol_p->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Declaration plus affectation") @@ -73,6 +74,7 @@ m = n; auto [symbol_z, found_z] = ast->m_symbol_table->find("z", position); REQUIRE(found_z); REQUIRE(not symbol_z->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Declarative function initialization") @@ -93,6 +95,7 @@ let f: R->R, x->x+1; auto [symbol_m, found_m] = ast->m_symbol_table->find("f", position); REQUIRE(found_m); REQUIRE(symbol_m->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Lists") @@ -119,6 +122,7 @@ let (x,y):R*R, (x,y) = (2.3, 4.1); auto [symbol_y, found_y] = ast->m_symbol_table->find("y", position); REQUIRE(found_y); REQUIRE(symbol_y->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Declarative initialization") @@ -139,6 +143,7 @@ let x:R^2, x = (2.3, 4.1); auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); REQUIRE(symbol_x->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Not initialized") @@ -164,6 +169,7 @@ y = 3; auto [symbol_y, found_y] = ast->m_symbol_table->find("y", position); REQUIRE(found_y); REQUIRE(symbol_y->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Affectation") @@ -189,6 +195,7 @@ let (x,y):R*R; auto [symbol_y, found_y] = ast->m_symbol_table->find("y", position); REQUIRE(found_y); REQUIRE(symbol_y->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } SECTION("Affectation") @@ -214,6 +221,7 @@ let (x,y):R^3*R; auto [symbol_y, found_y] = ast->m_symbol_table->find("y", position); REQUIRE(found_y); REQUIRE(symbol_y->attributes().isInitialized()); + ast->m_symbol_table->clearValues(); } } @@ -231,6 +239,7 @@ let m:N, m = n; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"uninitialized symbol 'n'"}); + ast->m_symbol_table->clearValues(); } SECTION("used uninitialized in list affectation") @@ -247,6 +256,7 @@ let (l, x) : N*R; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"uninitialized symbol 'l'"}); + ast->m_symbol_table->clearValues(); } SECTION("used uninitialized in function") @@ -261,6 +271,7 @@ let f : R->R, x->x+y; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"uninitialized symbol 'y'"}); + ast->m_symbol_table->clearValues(); } SECTION("expecting a list of identifiers") @@ -274,6 +285,7 @@ let (x,y,z):R*R*R, x = 3; ASTSymbolTableBuilder{*ast}; REQUIRE_THROWS_WITH(ASTSymbolInitializationChecker{*ast}, std::string{"expecting a list of identifiers"}); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ASTSymbolTableBuilder.cpp b/tests/test_ASTSymbolTableBuilder.cpp index 5f5eae42f..2e29ac2f8 100644 --- a/tests/test_ASTSymbolTableBuilder.cpp +++ b/tests/test_ASTSymbolTableBuilder.cpp @@ -28,6 +28,7 @@ let n:N, n = 2; auto ast = ASTBuilder::build(input); ASTSymbolTableBuilder{*ast}; + ast->m_symbol_table->clearValues(); } SECTION("Populate symbol table") @@ -66,6 +67,7 @@ let f: R*Z*B->R, (x,n,z) -> x+n; << "------------------------\n"; REQUIRE(st_output.str() == expected_output.str()); + ast->m_symbol_table->clearValues(); } SECTION("errors") @@ -80,6 +82,7 @@ let n:N, n = a; auto ast = ASTBuilder::build(input); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "undefined symbol 'a'"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared symbol") @@ -93,6 +96,7 @@ let n:N, n = 1; auto ast = ASTBuilder::build(input); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'n' was already defined at line 2"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared symbol (nested scope)") @@ -108,6 +112,7 @@ let n:N, n = 0; auto ast = ASTBuilder::build(input); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'n' was already defined at line 2"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared symbol (function)") @@ -121,6 +126,7 @@ let f : R -> R, x -> 1; auto ast = ASTBuilder::build(input); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'f' was already defined at line 2"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared symbol (builtin function)") @@ -135,6 +141,7 @@ let cos:N; ASTModulesImporter{*ast}; REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'cos' already denotes a builtin function!"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared symbol (builtin function) 2") @@ -148,8 +155,8 @@ let cos: R -> R, x->2*x; auto ast = ASTBuilder::build(input); ASTModulesImporter{*ast}; - // REQUIRE_THROWS_AS(ASTSymbolTableBuilder{*ast}, ParseError); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'cos' already denotes a builtin function!"); + ast->m_symbol_table->clearValues(); } SECTION("Re-declared parameter (function)") @@ -163,6 +170,7 @@ let f : R*R*N -> R, auto ast = ASTBuilder::build(input); REQUIRE_THROWS_WITH(ASTSymbolTableBuilder{*ast}, "symbol 'x' was already defined at line 3"); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_AffectationProcessor.cpp b/tests/test_AffectationProcessor.cpp index 20b2c215f..393be0d67 100644 --- a/tests/test_AffectationProcessor.cpp +++ b/tests/test_AffectationProcessor.cpp @@ -52,6 +52,7 @@ auto value = std::get<decltype(expected_value)>(attributes.value()); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_BUILTIN_AFFECTATION_RESULT(data, variable_name, expected_value) \ @@ -113,6 +114,7 @@ \ double value = *dynamic_cast<const DataHandler<const double>&>(embedded_value.get()).data_ptr(); \ REQUIRE(value == expected); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AFFECTATION_THROWS_WITH(data, error_message) \ @@ -129,6 +131,7 @@ ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ \ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_BUILD_THROWS_WITH(data, error_message) \ @@ -156,6 +159,7 @@ ASTExecutionStack::create(); \ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_message); \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp index 13e948543..fd6260123 100644 --- a/tests/test_AffectationToStringProcessor.cpp +++ b/tests/test_AffectationToStringProcessor.cpp @@ -48,6 +48,7 @@ auto value = std::get<decltype(expected_value)>(attributes.value()); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_AffectationToTupleProcessor.cpp b/tests/test_AffectationToTupleProcessor.cpp index d77cd1dc6..056df8292 100644 --- a/tests/test_AffectationToTupleProcessor.cpp +++ b/tests/test_AffectationToTupleProcessor.cpp @@ -47,6 +47,7 @@ auto value = std::get<decltype(expected_value)>(attributes.value()); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AFFECTATION_EXEC_THROWS_WITH(data, error_message) \ @@ -68,6 +69,7 @@ ASTExecutionStack::create(); \ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_message); \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ArraySubscriptProcessor.cpp b/tests/test_ArraySubscriptProcessor.cpp index 423d63aae..9ece9e4c7 100644 --- a/tests/test_ArraySubscriptProcessor.cpp +++ b/tests/test_ArraySubscriptProcessor.cpp @@ -48,6 +48,7 @@ auto value = std::get<decltype(expected_value)>(attributes.value()); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_EVALUATION_THROWS_WITH(data, error_message) \ @@ -71,6 +72,7 @@ ASTExecutionStack::create(); \ ast->execute(exec_policy); \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ }; \ \ REQUIRE_THROWS_WITH(eval(), error_message); \ diff --git a/tests/test_BinaryExpressionProcessor_arithmetic.cpp b/tests/test_BinaryExpressionProcessor_arithmetic.cpp index 84be64a40..70e4efdef 100644 --- a/tests/test_BinaryExpressionProcessor_arithmetic.cpp +++ b/tests/test_BinaryExpressionProcessor_arithmetic.cpp @@ -89,6 +89,7 @@ \ double value = *dynamic_cast<const DataHandler<const double>&>(embedded_value.get()).data_ptr(); \ REQUIRE(value == expected); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_BUILTIN_BINARY_EXPRESSION_ERROR(data, error_msg) \ @@ -157,6 +158,7 @@ ASTExecutionStack::create(); \ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_msg); \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } TEST_CASE("BinaryExpressionProcessor arithmetic", "[language]") diff --git a/tests/test_BinaryExpressionProcessor_shift.cpp b/tests/test_BinaryExpressionProcessor_shift.cpp index 1766e111e..1ccf1231a 100644 --- a/tests/test_BinaryExpressionProcessor_shift.cpp +++ b/tests/test_BinaryExpressionProcessor_shift.cpp @@ -69,6 +69,7 @@ fout << createSocketServer(0) << "\n";)"; ast->execute(exec_policy); ASTExecutionStack::destroy(); CheckpointResumeRepository::destroy(); + ast->m_symbol_table->clearValues(); } REQUIRE(std::filesystem::exists(filename)); diff --git a/tests/test_BuiltinFunctionEmbedderUtils.cpp b/tests/test_BuiltinFunctionEmbedderUtils.cpp index 3dee7e009..8b414382e 100644 --- a/tests/test_BuiltinFunctionEmbedderUtils.cpp +++ b/tests/test_BuiltinFunctionEmbedderUtils.cpp @@ -69,6 +69,7 @@ foo(3); REQUIRE(function_embedder->getReturnDataType() == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*string -> R") @@ -92,6 +93,7 @@ foo(3,"bar"); REQUIRE(function_embedder->getParameterDataTypes().size() == 2); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::string_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*string -> R (using builtin function result)") @@ -115,6 +117,7 @@ foo(foo(3),"bar"); REQUIRE(function_embedder->getParameterDataTypes().size() == 2); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::string_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function N -> N (choosing appropriate candidate)") @@ -139,6 +142,7 @@ foo(2); REQUIRE(function_embedder->getReturnDataType() == ASTNodeDataType::int_t); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::int_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R -> R (using function result)") @@ -158,6 +162,7 @@ foo(f(3)); REQUIRE(function_embedder->getReturnDataType() == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*string -> R (using function result)") @@ -182,6 +187,7 @@ foo(f(3)); REQUIRE(function_embedder->getParameterDataTypes().size() == 2); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::string_t); + root_node->m_symbol_table->clearValues(); } } @@ -210,6 +216,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^1 -> R^2") @@ -236,6 +243,7 @@ foo(3,1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^1 -> R^2") @@ -263,6 +271,7 @@ foo(3.1,f(1)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R^1 -> R^2 (from f: R -> R*R^1)") @@ -290,6 +299,7 @@ foo(f(2)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 1); + root_node->m_symbol_table->clearValues(); } } @@ -318,6 +328,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^2 -> R^3") @@ -344,6 +355,7 @@ foo(3,0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^2 -> R^2 (R^2 from list)") @@ -370,6 +382,7 @@ foo(3.1,[1,2.3]); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 2); + root_node->m_symbol_table->clearValues(); } } @@ -400,6 +413,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^3 -> R^3") @@ -426,6 +440,7 @@ foo(3,0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^3 -> R^2 (R^3 from list)") @@ -452,6 +467,7 @@ foo(3.1,[1,2.3,4]); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[1].dimension() == 3); + root_node->m_symbol_table->clearValues(); } } @@ -480,6 +496,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^1x1 -> R^2x2") @@ -506,6 +523,7 @@ foo(3,1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^1x1 -> R^2x2") @@ -533,6 +551,7 @@ foo(3.1,f(1)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R^1x1 -> R^2x2 (from f: R -> R*R^1x1)") @@ -560,6 +579,7 @@ foo(f(2)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } } @@ -588,6 +608,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^2x2 -> R^3x3") @@ -616,6 +637,7 @@ foo(3,0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^2x2 -> R^2x2 (R^2x2 from list)") @@ -642,6 +664,7 @@ foo(3.1,[[1,2.3],[0,3]]); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 2); + root_node->m_symbol_table->clearValues(); } } @@ -673,6 +696,7 @@ foo(3,x); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^3x3 -> R^3x3") @@ -699,6 +723,7 @@ foo(3,0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function R*R^3x3 -> R^2x2 (R^3x3 from list)") @@ -726,6 +751,7 @@ foo(3.1,[[1, 2.3, 4], [0.3, 2.5, 4.6], [2.7, 8.1, -9]]); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::double_t); REQUIRE(function_embedder->getParameterDataTypes()[1] == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[1].numberOfRows() == 3); + root_node->m_symbol_table->clearValues(); } } @@ -752,6 +778,7 @@ foo(v); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::double_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R) -> N (from Z)") @@ -774,6 +801,7 @@ foo(-4); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::double_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1) -> N (from (N...))") @@ -798,6 +826,7 @@ foo(v); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1) -> N (from 0)") @@ -821,6 +850,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R) -> N (from list)") @@ -843,6 +873,7 @@ foo((1,2,3,5)); REQUIRE(function_embedder->getParameterDataTypes().size() == 1); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::double_t); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1) -> N (from castable list)") @@ -866,6 +897,7 @@ foo((1,2,3,5)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1) -> N (from list)") @@ -890,6 +922,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1x1) -> N (from castable list)") @@ -913,6 +946,7 @@ foo((1,2,3,5)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1x1) -> N (from 0)") @@ -936,6 +970,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^1x1) -> N (from list)") @@ -960,6 +995,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 1); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^2) -> N (from list)") @@ -984,6 +1020,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^2) -> N (from 0)") @@ -1007,6 +1044,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^2x2) -> N (from 0)") @@ -1030,6 +1068,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^2x2) -> N (from list)") @@ -1054,6 +1093,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^3) -> N (from list)") @@ -1078,6 +1118,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^3) -> N (from 0)") @@ -1101,6 +1142,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().dimension() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^3x3) -> N (from 0)") @@ -1124,6 +1166,7 @@ foo(0); REQUIRE(function_embedder->getParameterDataTypes()[0] == ASTNodeDataType::tuple_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 3); + root_node->m_symbol_table->clearValues(); } SECTION("builtin function (R^3x3) -> N (from list)") @@ -1149,6 +1192,7 @@ foo((x,2*x)); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType() == ASTNodeDataType::matrix_t); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfRows() == 3); REQUIRE(function_embedder->getParameterDataTypes()[0].contentType().numberOfColumns() == 3); + root_node->m_symbol_table->clearValues(); } } @@ -1191,6 +1235,7 @@ foo((x,2*x), 1, "bar", [2,3]); REQUIRE(function_embedder->getParameterDataTypes()[2] == ASTNodeDataType::string_t); REQUIRE(function_embedder->getParameterDataTypes()[3] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[3].dimension() == 2); + root_node->m_symbol_table->clearValues(); } SECTION("tuple not first") @@ -1230,6 +1275,7 @@ foo(1, "bar", (x,2*x), [2,3]); REQUIRE(function_embedder->getParameterDataTypes()[2].contentType().numberOfColumns() == 3); REQUIRE(function_embedder->getParameterDataTypes()[3] == ASTNodeDataType::vector_t); REQUIRE(function_embedder->getParameterDataTypes()[3].dimension() == 2); + root_node->m_symbol_table->clearValues(); } } @@ -1264,6 +1310,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^2: invalid conversion") @@ -1295,6 +1342,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^3: invalid conversion") @@ -1326,6 +1374,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^2: invalid argument list size") @@ -1356,6 +1405,7 @@ foo(1,2,3,4); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^3: invalid argument list size") @@ -1386,6 +1436,7 @@ foo(1,2,3,4); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^1x1: invalid conversion") @@ -1417,6 +1468,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^2x2: invalid conversion") @@ -1448,6 +1500,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^3x3: invalid conversion") @@ -1479,6 +1532,7 @@ foo(x); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^2x2: invalid argument list size") @@ -1509,6 +1563,7 @@ foo(1,2,3); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("R^3x3: invalid argument list size") @@ -1539,6 +1594,7 @@ foo(1,2,3,4); return x; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("(N) invalid cast") @@ -1562,6 +1618,7 @@ foo(1.34); return t.size(); }))}), error_msg); + root_node->m_symbol_table->clearValues(); } SECTION("ambiguous function call") @@ -1599,6 +1656,7 @@ foo(1); return x[0]; }))}), error_msg); + root_node->m_symbol_table->clearValues(); } } } diff --git a/tests/test_BuiltinFunctionProcessor.cpp b/tests/test_BuiltinFunctionProcessor.cpp index 014c7b123..258a3a69f 100644 --- a/tests/test_BuiltinFunctionProcessor.cpp +++ b/tests/test_BuiltinFunctionProcessor.cpp @@ -49,6 +49,7 @@ auto value = std::get<decltype(expected_value)>(attributes.value()); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AST_THROWS_WITH(data, expected_error) \ @@ -74,6 +75,7 @@ ASTExecutionStack::create(); \ REQUIRE_THROWS_WITH(ast->execute(exec_policy), expected_error); \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ConcatExpressionProcessor.cpp b/tests/test_ConcatExpressionProcessor.cpp index 488698bb3..ca02f8030 100644 --- a/tests/test_ConcatExpressionProcessor.cpp +++ b/tests/test_ConcatExpressionProcessor.cpp @@ -50,6 +50,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_DiscreteFunctionIntegrator.cpp b/tests/test_DiscreteFunctionIntegrator.cpp index 1ab77c2e3..1baf0b95d 100644 --- a/tests/test_DiscreteFunctionIntegrator.cpp +++ b/tests/test_DiscreteFunctionIntegrator.cpp @@ -275,6 +275,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -509,6 +510,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -743,6 +745,7 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_DiscreteFunctionIntegratorByZone.cpp b/tests/test_DiscreteFunctionIntegratorByZone.cpp index 608a523b4..5582dec40 100644 --- a/tests/test_DiscreteFunctionIntegratorByZone.cpp +++ b/tests/test_DiscreteFunctionIntegratorByZone.cpp @@ -373,6 +373,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } SECTION("2D") @@ -701,6 +702,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } SECTION("3D") @@ -1029,6 +1031,7 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } ASTNode::setStackDetails(stack_details); diff --git a/tests/test_DiscreteFunctionInterpoler.cpp b/tests/test_DiscreteFunctionInterpoler.cpp index bb27d85aa..7d7454fa7 100644 --- a/tests/test_DiscreteFunctionInterpoler.cpp +++ b/tests/test_DiscreteFunctionInterpoler.cpp @@ -329,6 +329,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -620,6 +621,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -911,6 +913,7 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_DiscreteFunctionInterpolerByZone.cpp b/tests/test_DiscreteFunctionInterpolerByZone.cpp index 9a228fa7c..578dd0087 100644 --- a/tests/test_DiscreteFunctionInterpolerByZone.cpp +++ b/tests/test_DiscreteFunctionInterpolerByZone.cpp @@ -377,6 +377,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } SECTION("2D") @@ -712,6 +713,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } SECTION("3D") @@ -1047,6 +1049,7 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_cell_value(cell_value, discrete_function.get<DiscreteFunctionP0<const DataType>>())); } + ast->m_symbol_table->clearValues(); } ASTNode::setStackDetails(stack_details); diff --git a/tests/test_DiscreteFunctionVectorIntegrator.cpp b/tests/test_DiscreteFunctionVectorIntegrator.cpp index c176efb65..ac6e42686 100644 --- a/tests/test_DiscreteFunctionVectorIntegrator.cpp +++ b/tests/test_DiscreteFunctionVectorIntegrator.cpp @@ -138,6 +138,7 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -224,6 +225,7 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -308,6 +310,7 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -386,6 +389,7 @@ Invalid value type: R^2)"; REQUIRE_THROWS_WITH(integrator.integrate(), error_msg); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp b/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp index 180bc3b2a..ba29056d3 100644 --- a/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp +++ b/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp @@ -181,6 +181,7 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } SECTION("2D") @@ -306,6 +307,7 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } SECTION("3D") @@ -431,6 +433,7 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } ASTNode::setStackDetails(stack_details); diff --git a/tests/test_DiscreteFunctionVectorInterpoler.cpp b/tests/test_DiscreteFunctionVectorInterpoler.cpp index 466e88bb5..e7369e653 100644 --- a/tests/test_DiscreteFunctionVectorInterpoler.cpp +++ b/tests/test_DiscreteFunctionVectorInterpoler.cpp @@ -150,6 +150,7 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -251,6 +252,7 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -352,6 +354,7 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } } } @@ -436,6 +439,7 @@ Invalid interpolation value type: R^2)"; DiscreteFunctionVectorInterpoler interpoler{mesh_3d_v, std::make_shared<DiscreteFunctionDescriptorP0>(), {}}; REQUIRE_THROWS_WITH(interpoler.interpolate(), error_msg); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp b/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp index e5e99b854..7388e66e4 100644 --- a/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp +++ b/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp @@ -175,6 +175,7 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } SECTION("2D") @@ -297,6 +298,7 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } SECTION("3D") @@ -419,6 +421,7 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; } REQUIRE(i == function_id_list.size()); + ast->m_symbol_table->clearValues(); } SECTION("errors") @@ -501,6 +504,7 @@ Invalid interpolation value type: R^2)"; DiscreteFunctionVectorInterpoler interpoler{mesh_3d_v, std::make_shared<DiscreteFunctionDescriptorP0>(), {}}; REQUIRE_THROWS_WITH(interpoler.interpolate(), error_msg); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_DoWhileProcessor.cpp b/tests/test_DoWhileProcessor.cpp index 3cdabe47d..01c170247 100644 --- a/tests/test_DoWhileProcessor.cpp +++ b/tests/test_DoWhileProcessor.cpp @@ -49,6 +49,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_DO_WHILE_PROCESSOR_THROWS_WITH(data, error_message) \ @@ -66,6 +67,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_ForProcessor.cpp b/tests/test_ForProcessor.cpp index 111a9526a..b830dfd63 100644 --- a/tests/test_ForProcessor.cpp +++ b/tests/test_ForProcessor.cpp @@ -49,6 +49,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_FOR_PROCESSOR_THROWS_WITH(data, error_message) \ @@ -67,6 +68,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_FunctionProcessor.cpp b/tests/test_FunctionProcessor.cpp index a3eae8485..ede3bd01b 100644 --- a/tests/test_FunctionProcessor.cpp +++ b/tests/test_FunctionProcessor.cpp @@ -49,6 +49,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_FUNCTION_EVALUATION_THROWS(data, error_msg) \ @@ -73,6 +74,7 @@ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_msg); \ \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_IfProcessor.cpp b/tests/test_IfProcessor.cpp index 147dcd84e..38b687c79 100644 --- a/tests/test_IfProcessor.cpp +++ b/tests/test_IfProcessor.cpp @@ -47,6 +47,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_IF_PROCESSOR_THROWS_WITH(data, error_message) \ @@ -64,6 +65,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_IncDecExpressionProcessor.cpp b/tests/test_IncDecExpressionProcessor.cpp index 2c51b86b8..5e951aaac 100644 --- a/tests/test_IncDecExpressionProcessor.cpp +++ b/tests/test_IncDecExpressionProcessor.cpp @@ -47,6 +47,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_INCDEC_EXPRESSION_THROWS_WITH(data, error_message) \ @@ -64,6 +65,7 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_INCDEC_THROWS_WITH(data, error_message) \ @@ -85,6 +87,7 @@ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_message); \ \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_IntegrateCellArray.cpp b/tests/test_IntegrateCellArray.cpp index f556c87fa..27a2e3300 100644 --- a/tests/test_IntegrateCellArray.cpp +++ b/tests/test_IntegrateCellArray.cpp @@ -131,6 +131,7 @@ let g: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -222,6 +223,7 @@ let g: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -324,6 +326,7 @@ let g: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -439,6 +442,7 @@ let g: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -539,6 +543,7 @@ let g: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -650,6 +655,7 @@ let g: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral_array, integrate_value)); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_IntegrateCellValue.cpp b/tests/test_IntegrateCellValue.cpp index b13ec6149..e2563d473 100644 --- a/tests/test_IntegrateCellValue.cpp +++ b/tests/test_IntegrateCellValue.cpp @@ -100,6 +100,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -163,6 +164,7 @@ let R3_2d: R^2 -> R^3, x -> [2*exp(x[0])*sin(x[1])+3, x[0]-2*x[1], 3]; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -234,6 +236,7 @@ let scalar_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -318,6 +321,7 @@ let scalar_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -392,6 +396,7 @@ let R3_2d: R^2 -> R^3, x -> [2*exp(x[0])*sin(x[1])+3, x[0]-2*x[1], 3]; ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } @@ -477,6 +482,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin ASTNode::setStackDetails(true); REQUIRE(same_item_integral(cell_integral, integrate_value)); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_IntegrateOnCells.cpp b/tests/test_IntegrateOnCells.cpp index d49ccb2c1..7a285a612 100644 --- a/tests/test_IntegrateOnCells.cpp +++ b/tests/test_IntegrateOnCells.cpp @@ -157,6 +157,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -276,6 +277,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -406,6 +408,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -546,6 +549,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -675,6 +679,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -815,6 +820,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -950,6 +956,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1069,6 +1076,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1199,6 +1207,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1339,6 +1348,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1468,6 +1478,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1608,6 +1619,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1743,6 +1755,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1862,6 +1875,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1992,6 +2006,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -2131,6 +2146,7 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -2260,6 +2276,7 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -2400,6 +2417,7 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin REQUIRE(same_item_integral(cell_integral, integrate_value)); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_InterpolateItemArray.cpp b/tests/test_InterpolateItemArray.cpp index cab00ae0a..4e2dfbb55 100644 --- a/tests/test_InterpolateItemArray.cpp +++ b/tests/test_InterpolateItemArray.cpp @@ -117,6 +117,7 @@ let scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -177,6 +178,7 @@ let f_1d: R^1 -> (R), x -> (2*x[0] + 2, 2 * exp(x[0]) + 3); InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -239,6 +241,7 @@ let f_1d: R^1 -> (R^1), x -> (2*x[0] + 2, [2 * exp(x[0]) + 3]); InterpolateItemArray<R1(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -316,6 +319,7 @@ let scalar_non_linear_2d: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -376,6 +380,7 @@ let f_2d: R^2 -> (R), x -> (2*x[0] + 3*x[1] + 2, 2*exp(x[0])*sin(x[1])+3); InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -453,6 +458,7 @@ let scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -513,6 +519,7 @@ let f_3d: R^3 -> (R), x -> (2 * x[0] + 3 * x[1] + 2 * x[2] - 1, 2 * exp(x[0]) * InterpolateItemArray<double(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -613,6 +620,7 @@ let scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -682,6 +690,7 @@ let f_1d: R^1 -> (R), x -> (2*x[0] + 2, 2 * exp(x[0]) + 3); cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -765,6 +774,7 @@ let scalar_non_linear_2d: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -831,6 +841,7 @@ let f_2d: R^2 -> (R), x -> (2*x[0] + 3*x[1] + 2, 2*exp(x[0])*sin(x[1])+3); cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -902,6 +913,7 @@ let f_2d: R^2 -> (R^2x2), x -> ([[x[0],0],[2-x[1], x[0]*x[1]]], [[2*x[0], x[1]], InterpolateItemArray<R2x2(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj, cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -985,6 +997,7 @@ let scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -1051,6 +1064,7 @@ let f_3d: R^3 -> (R), x -> (2 * x[0] + 3 * x[1] + 2 * x[2] - 1, 2 * exp(x[0]) * cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } @@ -1119,6 +1133,7 @@ let f_3d: R^3 -> (R^3), x -> (2*x, [2*x[0]-x[1], 3*x[2]-x[0], x[1]+x[2]], 0); InterpolateItemArray<R3(TinyVector<Dimension>)>::interpolate(function_symbol_id_list, xj, cell_id_list); REQUIRE(same_cell_array(cell_array, interpolate_array)); + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_InterpolateItemValue.cpp b/tests/test_InterpolateItemValue.cpp index 370b8b401..63f59db78 100644 --- a/tests/test_InterpolateItemValue.cpp +++ b/tests/test_InterpolateItemValue.cpp @@ -210,6 +210,7 @@ let R2x2_non_linear_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -376,6 +377,7 @@ let R2x2_non_linear_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2 REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -543,6 +545,7 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -739,6 +742,7 @@ let R2x2_non_linear_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -914,6 +918,7 @@ let R2x2_non_linear_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2 REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } @@ -1090,6 +1095,7 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos REQUIRE(same_item_value(cell_value, interpolate_value)); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ItemArrayVariantFunctionInterpoler.cpp b/tests/test_ItemArrayVariantFunctionInterpoler.cpp index 95f9d9b5c..18b6e8767 100644 --- a/tests/test_ItemArrayVariantFunctionInterpoler.cpp +++ b/tests/test_ItemArrayVariantFunctionInterpoler.cpp @@ -417,6 +417,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE_THROWS_WITH(interpoler.interpolate(), "error: functions must have the same type"); } + ast->m_symbol_table->clearValues(); } } } @@ -551,6 +552,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_item_array(face_array, item_array_variant->get<FaceArray<DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -675,6 +677,7 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, REQUIRE(same_item_array(edge_array, item_array_variant->get<EdgeArray<DataType>>())); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ItemValueVariantFunctionInterpoler.cpp b/tests/test_ItemValueVariantFunctionInterpoler.cpp index 4bc251aba..d93f046fe 100644 --- a/tests/test_ItemValueVariantFunctionInterpoler.cpp +++ b/tests/test_ItemValueVariantFunctionInterpoler.cpp @@ -317,6 +317,7 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( REQUIRE(same_item_value(cell_value, item_value_variant->get<CellValue<DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -437,6 +438,7 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_item_value(face_value, item_value_variant->get<FaceValue<DataType>>())); } + ast->m_symbol_table->clearValues(); } } } @@ -547,6 +549,7 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( REQUIRE(same_item_value(edge_value, item_value_variant->get<EdgeValue<DataType>>())); } + ast->m_symbol_table->clearValues(); } } } diff --git a/tests/test_ListAffectationProcessor.cpp b/tests/test_ListAffectationProcessor.cpp index a288187e0..0c89251e3 100644 --- a/tests/test_ListAffectationProcessor.cpp +++ b/tests/test_ListAffectationProcessor.cpp @@ -47,6 +47,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_AFFECTATION_THROW_WITH(data, error_message) \ @@ -70,6 +71,7 @@ REQUIRE_THROWS_WITH(ast->execute(exec_policy), error_message); \ \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_NameProcessor.cpp b/tests/test_NameProcessor.cpp index cec1a0648..941eb2075 100644 --- a/tests/test_NameProcessor.cpp +++ b/tests/test_NameProcessor.cpp @@ -65,6 +65,7 @@ n = 2; REQUIRE(ast->children[1]->children[0]->m_node_processor->typeIdName() == demangle<NameProcessor>()); REQUIRE(ast->children[1]->children[1]->m_node_processor->typeIdName() == demangle<NameProcessor>()); REQUIRE(ast->children[2]->children[0]->m_node_processor->typeIdName() == demangle<NameProcessor>()); + ast->m_symbol_table->clearValues(); } SECTION("error") @@ -96,5 +97,6 @@ let m:N, m = n; REQUIRE_THROWS_WITH(ast->execute(exec_policy), "trying to use uninitialized symbol 'n'"); ASTExecutionStack::destroy(); + ast->m_symbol_table->clearValues(); } } diff --git a/tests/test_PugsFunctionAdapter.cpp b/tests/test_PugsFunctionAdapter.cpp index b4844cfa9..a89017e6b 100644 --- a/tests/test_PugsFunctionAdapter.cpp +++ b/tests/test_PugsFunctionAdapter.cpp @@ -366,6 +366,7 @@ let R33toR33zero: R^3x3 -> R^3x3, x -> 0; } ASTExecutionStack::destroy(); + ast->m_symbol_table->clearValues(); } SECTION("Errors calls") @@ -501,5 +502,6 @@ let R33toR22: R^3x3 -> R^2x2, x -> [[x[0,0], x[0,1]+x[0,2]], [x[2,0]*x[1,1], x[2 } ASTExecutionStack::destroy(); + ast->m_symbol_table->clearValues(); } } diff --git a/tests/test_TupleToVectorProcessor.cpp b/tests/test_TupleToVectorProcessor.cpp index ea370e56d..71475fbd5 100644 --- a/tests/test_TupleToVectorProcessor.cpp +++ b/tests/test_TupleToVectorProcessor.cpp @@ -48,6 +48,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_EVALUATION_THROWS_WITH(data, error_message) \ @@ -76,6 +77,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE_THROWS_WITH(eval(), error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_UnaryExpressionProcessor.cpp b/tests/test_UnaryExpressionProcessor.cpp index 4dd2aa383..e4c25a818 100644 --- a/tests/test_UnaryExpressionProcessor.cpp +++ b/tests/test_UnaryExpressionProcessor.cpp @@ -57,6 +57,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_UNARY_EXPRESSION_THROWS_WITH(data, error_message) \ @@ -71,6 +72,7 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ \ ASTExecutionStack::destroy(); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static @@ -147,6 +149,7 @@ TEST_CASE("UnaryExpressionProcessor", "[language]") ASTExecutionStack::destroy(); REQUIRE(value == double{-3.2}); + ast->m_symbol_table->clearValues(); } SECTION("unary not") diff --git a/tests/test_WhileProcessor.cpp b/tests/test_WhileProcessor.cpp index b6a04250b..7641f9ab2 100644 --- a/tests/test_WhileProcessor.cpp +++ b/tests/test_WhileProcessor.cpp @@ -48,6 +48,7 @@ ASTExecutionStack::destroy(); \ \ REQUIRE(value == expected_value); \ + ast->m_symbol_table->clearValues(); \ } #define CHECK_WHILE_PROCESSOR_THROWS_WITH(data, error_message) \ @@ -58,10 +59,11 @@ ASTExecutionStack::create(); \ \ ASTSymbolTableBuilder{*ast}; \ - \ + \ ASTExecutionStack::destroy(); \ \ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ + ast->m_symbol_table->clearValues(); \ } // clazy:excludeall=non-pod-global-static diff --git a/tests/test_checkpointing_Checkpoint.cpp b/tests/test_checkpointing_Checkpoint.cpp index 63107f702..cfcf67188 100644 --- a/tests/test_checkpointing_Checkpoint.cpp +++ b/tests/test_checkpointing_Checkpoint.cpp @@ -60,6 +60,7 @@ class ASTCheckpointsInfoTester CheckpointResumeRepository::destroy(); \ ParallelChecker::destroy(); \ ExecutionStatManager::destroy(); \ + ast->m_symbol_table->clearValues(); \ } #else // PUGS_HAS_HDF5 diff --git a/tests/test_checkpointing_Checkpoint_sequential.cpp b/tests/test_checkpointing_Checkpoint_sequential.cpp index d22e7ccb6..23ddd8074 100644 --- a/tests/test_checkpointing_Checkpoint_sequential.cpp +++ b/tests/test_checkpointing_Checkpoint_sequential.cpp @@ -62,6 +62,7 @@ class ASTCheckpointsInfoTester CheckpointResumeRepository::destroy(); \ ParallelChecker::destroy(); \ ExecutionStatManager::destroy(); \ + ast->m_symbol_table->clearValues(); \ } #else // PUGS_HAS_HDF5 diff --git a/tests/test_checkpointing_IBoundaryConditionDescriptor.cpp b/tests/test_checkpointing_IBoundaryConditionDescriptor.cpp index abbe5151f..f29242917 100644 --- a/tests/test_checkpointing_IBoundaryConditionDescriptor.cpp +++ b/tests/test_checkpointing_IBoundaryConditionDescriptor.cpp @@ -301,6 +301,7 @@ let i: R -> R, x -> x+3; REQUIRE(read_inflow_bc.functionSymbolId().id() == p_inflow_bc_descriptor->functionSymbolId().id()); checkpointing::ResumingData::destroy(); + ast->m_symbol_table->clearValues(); } } -- GitLab