16 #include <catch2/catch_test_macros.hpp>
17 #include <catch2/matchers/catch_matchers_string.hpp>
19 using namespace nmodl;
22 using Catch::Matchers::ContainsSubstring;
36 SCENARIO(
"Check insertion of implicit arguments",
"[codegen][implicit_arguments]") {
37 GIVEN(
"A mod file that calls functions that may need implicit arguments") {
46 nrn_ghk(-50(mV), .001(mM), 10(mM), 2)
47 nrn_ghk(-50(mV), .001(mM), 10(mM), 2, -273.15)
51 THEN(
"at_time should have nt as its first argument") {
52 REQUIRE_THAT(modified_nmodl, ContainsSubstring(
"at_time(nt, foo)"));
53 REQUIRE_THAT(modified_nmodl, ContainsSubstring(
"at_time(nt, a+b)"));
54 REQUIRE_THAT(modified_nmodl, ContainsSubstring(
"at_time(nt, flop)"));
56 THEN(
"nrn_ghk should have a temperature as its last argument") {
57 REQUIRE_THAT(modified_nmodl,
58 ContainsSubstring(
"nrn_ghk(-50(mV), .001(mM), 10(mM), 2, celsius)"));
59 REQUIRE_THAT(modified_nmodl,
60 ContainsSubstring(
"nrn_ghk(-50(mV), .001(mM), 10(mM), 2, -273.15)"));
Class that binds all pieces together for parsing nmodl file.
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
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
SCENARIO("Check insertion of implicit arguments", "[codegen][implicit_arguments]")
std::string generate_mod_after_implicit_argument_visitor(std::string const &text)
Visitor for adding implicit arguments to [Core]NEURON functions.
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.
Visitor for adding implicit arguments to [Core]NEURON functions.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
nmodl::parser::UnitDriver driver
Utility functions for visitors implementation.