1 #include <catch2/catch_test_macros.hpp>
12 using namespace nmodl;
13 using namespace visitor;
15 using namespace test_utils;
30 TEST_CASE(
"Make sure CVODE block is generated properly",
"[visitor][cvode]") {
31 GIVEN(
"No DERIVATIVE block") {
34 THEN(
"No CVODE block is added") {
36 REQUIRE(blocks.empty());
39 GIVEN(
"DERIVATIVE block") {
56 THEN(
"CVODE block is added") {
58 REQUIRE(blocks.size() == 1);
59 THEN(
"No primed variables exist in the CVODE block") {
61 REQUIRE(primed_vars.empty());
63 THEN(
"No CONSERVE statements are present in the CVODE block") {
65 REQUIRE(conserved_stmts.empty());
69 GIVEN(
"Multiple DERIVATIVE blocks") {
81 DERIVATIVE equation2 {
85 THEN("An error is raised") {
Visitor for checking parents of ast nodes
Class that binds all pieces together for parsing nmodl file.
Visitor used for generating the necessary AST nodes for CVODE.
void visit_program(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
TEST_CASE("Make sure CVODE block is generated properly", "[visitor][cvode]")
auto run_cvode_visitor(const std::string &text)
Visitor used for generating the necessary AST nodes for CVODE.
@ CVODE_BLOCK
type of ast::CvodeBlock
@ CONSERVE
type of ast::Conserve
@ PRIME_NAME
type of ast::PrimeName
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
encapsulates code generation backend implementations
std::vector< std::shared_ptr< const ast::Ast > > collect_nodes(const ast::Ast &node, const std::vector< ast::AstNodeType > &types)
traverse node recursively and collect nodes of given types
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.