17 #include <catch2/catch_test_macros.hpp>
18 #include <catch2/matchers/catch_matchers_string.hpp>
20 using namespace nmodl;
23 using Catch::Matchers::ContainsSubstring;
36 SCENARIO(
"Check multiple INITIAL blocks are handled properly",
"[visitor][merge_initial_blocks]") {
37 GIVEN(
"A mod file with multiple INITIAL blocks") {
38 const auto nmodl_text_before = R
"(
40 SUFFIX InitialBlockTest
50 const auto nmodl_text_after = R
"(
52 SUFFIX InitialBlockTest
62 const auto program_expected =
to_nmodl(ast_expected);
65 THEN(
"expected and actual should be identical at the level of the AST") {
71 GIVEN(
"A mod file with an INITIAL block only inside of a NET_RECEIVE block") {
72 const auto nmodl_text_before = R
"(
86 THEN(
"leave the mod file as-is") {
90 GIVEN(
"A mod file with an INITIAL block, and one inside of a NET_RECEIVE block") {
96 const auto nmodl_text_before = R
"(
114 THEN(
"leave the mod file as-is") {
Class that binds all pieces together for parsing nmodl file.
Visitor which merges all INITIAL blocks into one.
void visit_program(ast::Program &node) override
visit node of type ast::Program
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
auto generate_mod_after_merge_initial_blocks_visitor(std::string const &text)
SCENARIO("Check multiple INITIAL blocks are handled properly", "[visitor][merge_initial_blocks]")
Visitor which merges all INITIAL blocks into one.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
std::string reindent_text(const std::string &text, int indent_level)
Reindent nmodl text for text-to-text comparison.
encapsulates code generation backend implementations
std::string to_nmodl(const ast::Ast &node, const std::set< ast::AstNodeType > &exclude_types)
Given AST node, return the NMODL string representation.
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
Utility functions for visitors implementation.