![]() |
NEURON
|
custom type to represent nmodl construct for testing More...
Classes | |
struct | NmodlTestCase |
represent nmodl test construct More... | |
struct | DiffEqTestCase |
represent differential equation test construct More... | |
class | LoggerCapture |
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 | |
std::map< std::string, NmodlTestCase > const | nmodl_invalid_constructs |
Guidelines for adding nmodl text constructs. More... | |
std::map< std::string, NmodlTestCase > const | nmodl_valid_constructs |
std::vector< DiffEqTestCase > const | diff_eq_constructs |
custom type to represent nmodl construct for testing
int nmodl::test_utils::count_leading_spaces | ( | std::string | text | ) |
Definition at line 19 of file test_utils.cpp.
bool nmodl::test_utils::is_empty | ( | const std::string & | text | ) |
check if string has only whitespaces
Definition at line 28 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 55 of file test_utils.cpp.
std::vector< DiffEqTestCase > const nmodl::test_utils::diff_eq_constructs |
Definition at line 1309 of file nmodl_constructs.cpp.
std::map< std::string, NmodlTestCase > const 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.
std::map< std::string, NmodlTestCase > const nmodl::test_utils::nmodl_valid_constructs |
Definition at line 181 of file nmodl_constructs.cpp.