1 #include <catch2/catch_test_macros.hpp>
2 #include <catch2/matchers/catch_matchers_string.hpp>
10 using namespace visitor;
12 using Catch::Matchers::ContainsSubstring;
17 std::string mod_code = R
"(
22 FUNCTION foo(a, v, cai) {
26 PROCEDURE bar(tau, a, b, d) {
35 visitor.visit_program(*ast);
40 std::string expected = R
"(
41 FUNCTION foo(_la, _lv, _lcai) {
42 exp(tau+_la+_lv*_lcai)
46 REQUIRE_THAT(transformed_mod, ContainsSubstring(expected));
49 SECTION("PROCEDURE") {
50 std::string expected = R
"(
51 PROCEDURE bar(_ltau, _la, _lb, _ld) {
52 foo(_ltau, _la*_lb, _ld)
56 REQUIRE_THAT(transformed_mod, ContainsSubstring(expected));
Class that binds all pieces together for parsing nmodl file.
bool parse_string(const std::string &input)
parser Units provided as string (used for testing)
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.
Auto generated AST classes declaration.
TEST_CASE("Rename function arguments")
nmodl::parser::UnitDriver driver
Utility functions for visitors implementation.