8 #include <catch2/catch_test_macros.hpp>
19 using namespace nmodl;
20 using namespace visitor;
22 using namespace test_utils;
33 SymtabVisitor().visit_program(*ast);
34 InlineVisitor().visit_program(*ast);
35 LocalizeVisitor().visit_program(*ast);
37 std::stringstream stream;
38 NmodlPrintVisitor(stream).visit_program(*ast);
41 CheckParentVisitor().check_ast(*ast);
47 SCENARIO(
"Localizer test with single global block",
"[visitor][localizer]") {
48 GIVEN(
"Single derivative block with variable definition") {
49 static const std::string nmodl_text = R
"(
60 static const std::string output_nmodl = R
"(
72 THEN("tau variable gets localized") {
76 REQUIRE(result == expected_result);
81 SCENARIO(
"Localizer test with use of verbatim block",
"[visitor][localizer]") {
82 GIVEN(
"Verbatim block usage in one of the global block") {
83 static const std::string nmodl_text = R
"(
98 static const std::string output_nmodl = R
"(
113 THEN("Localization is disabled") {
117 REQUIRE(result == expected_result);
123 SCENARIO(
"Localizer test with multiple global blocks",
"[visitor][localizer]") {
124 GIVEN(
"Multiple global blocks with definition of variable") {
125 static const std::string nmodl_text = R
"(
150 static const std::string output_nmodl = R
"(
176 THEN("Localization across multiple blocks is done") {
180 REQUIRE(result == expected_result);
185 GIVEN(
"Two global blocks with definition and use of the variable") {
186 static const std::string nmodl_text = R
"(
205 static const std::string output_nmodl = R
"(
223 THEN("Localization is not done due to use of variable") {
227 REQUIRE(result == expected_result);