diff --git a/test/unit/visitor/sympy_solver.cpp b/test/unit/visitor/sympy_solver.cpp index 9d853d49fd..f9a940e674 100644 --- a/test/unit/visitor/sympy_solver.cpp +++ b/test/unit/visitor/sympy_solver.cpp @@ -2130,7 +2130,7 @@ SCENARIO("Solve NONLINEAR block using SympySolver Visitor", "[visitor][solver][s } } SCENARIO("Solve KINETIC block using SympySolver Visitor", "[visitor][solver][sympy][kinetic]") { - GIVEN("NONLINEAR block with not inlined function should work") { + GIVEN("KINETIC block with not inlined function should work") { std::string nmodl_text = R"( BREAKPOINT { SOLVE kstates METHOD sparse @@ -2145,8 +2145,33 @@ SCENARIO("Solve KINETIC block using SympySolver Visitor", "[visitor][solver][sym KINETIC kstates { ~ C1 <-> C2 (alfa(v), alfa(v)) })"; + std::string expected_text = R"( + DERIVATIVE kstates { + EIGEN_NEWTON_SOLVE[2]{ + LOCAL old_C1, old_C2 + }{ + old_C1 = C1 + old_C2 = C2 + }{ + nmodl_eigen_x[0] = C1 + nmodl_eigen_x[1] = C2 + }{ + nmodl_eigen_f[0] = -nmodl_eigen_x[0]*dt*alfa(v)-nmodl_eigen_x[0]+nmodl_eigen_x[1]*dt*alfa(v)+old_C1 + nmodl_eigen_j[0] = -dt*alfa(v)-1.0 + nmodl_eigen_j[2] = dt*alfa(v) + nmodl_eigen_f[1] = nmodl_eigen_x[0]*dt*alfa(v)-nmodl_eigen_x[1]*dt*alfa(v)-nmodl_eigen_x[1]+old_C2 + nmodl_eigen_j[1] = dt*alfa(v) + nmodl_eigen_j[3] = -dt*alfa(v)-1.0 + }{ + C1 = nmodl_eigen_x[0] + C2 = nmodl_eigen_x[1] + }{ + } + })"; THEN("Run Kinetic and Sympy Visitor") { - REQUIRE_NOTHROW(run_sympy_solver_visitor(nmodl_text, false, false, {}, true)); + std::vector result; + REQUIRE_NOTHROW(result = run_sympy_solver_visitor(nmodl_text, false, false, AstNodeType::DERIVATIVE_BLOCK, true)); + compare_blocks(reindent_text(result[0]), reindent_text(expected_text)); } } }