![]() |
User Guide
|
custom type to represent nmodl construct for testing More...
custom type to represent nmodl construct for testing
Classes | |
struct | DiffEqTestCase |
represent differential equation test construct More... | |
struct | NmodlTestCase |
represent nmodl test construct More... | |
Functions | |
int | count_leading_spaces (std::string text) |
bool | is_empty (const std::string &text) |
check if string has only whitespaces More... | |
std::string | reindent_text (const std::string &text, int indent_level) |
Reindent nmodl text for text-to-text comparison. More... | |
Variables | |
const std::map< std::string, NmodlTestCase > | nmodl_invalid_constructs |
Guidelines for adding nmodl text constructs. More... | |
const std::map< std::string, NmodlTestCase > | nmodl_valid_constructs |
const std::vector< DiffEqTestCase > | diff_eq_constructs |
int nmodl::test_utils::count_leading_spaces | ( | std::string | text | ) |
Definition at line 17 of file test_utils.cpp.
bool nmodl::test_utils::is_empty | ( | const std::string & | text | ) |
check if string has only whitespaces
Definition at line 26 of file test_utils.cpp.
std::string nmodl::test_utils::reindent_text | ( | const std::string & | text, |
int | indent_level | ||
) |
Reindent nmodl text for text-to-text comparison.
Nmodl constructs defined in test database has extra leading whitespace. This is done for readability reason in nmodl_constructs.cpp. For example, we have following nmodl text with 8 leading whitespaces:
NEURON { RANGE x }
We convert above paragraph to:
NEURON { RANGE x }
i.e. we get first non-empty line and count number of leading whitespaces (X). Then for every sub-sequent line, we remove first X characters (assuming those all are whitespaces). This is done because when ast is transformed back to nmodl, the nmodl output is without "extra" whitespaces in the provided input.
count whitespaces for first non-empty line only
make sure we don't remove non whitespaces characters
discard empty lines at very beginning
Definition at line 53 of file test_utils.cpp.
const std::vector< DiffEqTestCase > nmodl::test_utils::diff_eq_constructs |
Definition at line 1309 of file nmodl_constructs.cpp.
const std::map< std::string, NmodlTestCase > nmodl::test_utils::nmodl_invalid_constructs |
Guidelines for adding nmodl text constructs.
As nmodl constructs are used to for testing ast to nmodl transformations, consider following points:
instead of
instead of
If nmodl transformation is different from input, third argument could be provided with the expected nmodl.
Definition at line 63 of file nmodl_constructs.cpp.
const std::map< std::string, NmodlTestCase > nmodl::test_utils::nmodl_valid_constructs |
Definition at line 181 of file nmodl_constructs.cpp.