8 #include <catch2/catch_test_macros.hpp>
19 using namespace nmodl;
20 using namespace visitor;
22 using namespace test_utils;
37 std::stringstream stream;
47 SCENARIO(
"Localizer test with single global block",
"[visitor][localizer]") {
48 GIVEN(
"Single derivative block with variable definition") {
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") {
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") {
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") {
205 static const std::string output_nmodl = R
"(
223 THEN("Localization is not done due to use of variable") {
227 REQUIRE(
result == expected_result);
Visitor for checking parents of ast nodes
Class that binds all pieces together for parsing nmodl file.
Visitor to inline local procedure and function calls
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor to transform global variable usage to local
void visit_program(const ast::Program &node) override
visit node of type ast::Program
Visitor for printing AST back to NMODL
void visit_program(const ast::Program &node) override
visit node of type ast::Program
Concrete visitor for constructing symbol table from AST.
void visit_program(ast::Program &node) override
visit node of type ast::Program
Visitor for checking parents of ast nodes
int check_ast(const ast::Ast &node)
A small wrapper to have a nicer call in parser.cpp.
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
Visitor to inline local procedure and function calls
std::string run_localize_visitor(const std::string &text)
SCENARIO("Localizer test with single global block", "[visitor][localizer]")
Visitor to transform global variable usage to local
std::string reindent_text(const std::string &text, int indent_level)
Reindent nmodl text for text-to-text comparison.
encapsulates code generation backend implementations
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
Auto generated AST classes declaration.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::parser::UnitDriver driver