![Logo](logo.png) |
User Guide
|
Go to the documentation of this file. 1 #include <catch2/catch_test_macros.hpp>
12 using namespace nmodl;
13 using namespace visitor;
15 using namespace test_utils;
23 SymtabVisitor().visit_program(*ast);
24 CvodeVisitor().visit_program(*ast);
30 TEST_CASE(
"Make sure CVODE block is generated properly",
"[visitor][cvode]") {
31 GIVEN(
"No DERIVATIVE block") {
32 auto nmodl_text =
"NEURON { SUFFIX example }";
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") {
Class that binds all pieces together for parsing nmodl file.
encapsulates code generation backend implementations
@ PRIME_NAME
type of ast::PrimeName
@ CONSERVE
type of ast::Conserve
TEST_CASE("Make sure CVODE block is generated properly", "[visitor][cvode]")
auto run_cvode_visitor(const std::string &text)
Utility functions for visitors implementation.
Auto generated AST classes declaration.
nmodl::parser::UnitDriver driver
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
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
Visitor for checking parents of ast nodes
Visitor used for generating the necessary AST nodes for CVODE.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
@ CVODE_BLOCK
type of ast::CvodeBlock
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.