8 #include <catch2/catch_test_macros.hpp>
9 #include <catch2/matchers/catch_matchers_string.hpp>
18 using Catch::Matchers::ContainsSubstring;
20 using namespace nmodl;
21 using namespace visitor;
28 const std::string& simulator =
"coreneuron") {
32 return CodegenCompatibilityVisitor(simulator).find_unhandled_ast_nodes(*ast);
35 SCENARIO(
"Uncompatible constructs should failed",
"[codegen][compatibility_visitor]") {
36 GIVEN(
"A mod file containing an EXTERNAL construct") {
43 THEN("should fail for CoreNEURON") {
48 THEN(
"but succeed for NEURON") {
53 GIVEN(
"A mod file containing a written GLOBAL var") {
64 THEN("should failed") {
69 GIVEN(
"A mod file containing a written un-writtable var") {
80 THEN("should failed") {
85 GIVEN(
"A mod file with BBCOREPOINTER without bbcore_read / bbcore_write") {
92 THEN("should failed") {
97 GIVEN(
"A mod file with BBCOREPOINTER without bbcore_write") {
104 static void bbcore_read(double* x, int* d, int* xx, int* offset, _threadargsproto_) {
109 THEN("should failed") {
114 GIVEN(
"A mod file with BBCOREPOINTER without bbcore_read") {
121 static void bbcore_write(double* x, int* d, int* xx, int* offset, _threadargsproto_) {
126 THEN("should failed") {
131 GIVEN(
"A mod file with BBCOREPOINTER with bbcore_read / bbcore_write") {
138 static void bbcore_read(double* x, int* d, int* xx, int* offset, _threadargsproto_) {
140 static void bbcore_write(double* x, int* d, int* xx, int* offset, _threadargsproto_) {
145 THEN("should succeed") {
150 GIVEN(
"A mod file with a no SOLVE method") {
157 THEN("should succeed") {
162 GIVEN(
"A mod file with a invalid SOLVE method") {
165 SOLVE state METHOD runge
169 THEN("should failed") {
Class that binds all pieces together for parsing nmodl file.
std::shared_ptr< ast::Program > parse_string(const std::string &input)
parser nmodl provided as string (used for testing)
Visitor for measuring performance related information
void visit_program(const 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
Visitor for printing compatibility issues of the mod file
encapsulates code generation backend implementations
Visitor for measuring performance related information
Auto generated AST classes declaration.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
bool runCompatibilityVisitor(const std::string &nmodl_text, const std::string &simulator="coreneuron")
Return true if it failed and false otherwise.
SCENARIO("Uncompatible constructs should failed", "[codegen][compatibility_visitor]")