1 #include <../../nrnconf.h>
10 #include <catch2/catch_test_macros.hpp>
12 SCENARIO(
"Test fast_imem calculation",
"[Neuron][fast_imem]") {
14 REQUIRE(
hoc_oc(
"create s\n") == 0);
15 WHEN(
"fast_imem is allocated") {
18 THEN(
"nrn_fast_imem should not be nullptr") {
26 WHEN(
"fast_imem is created") {
27 REQUIRE(
hoc_oc(
"objref cvode\n"
28 "cvode = new CVode()\n"
29 "cvode.use_fast_imem(1)\n") == 0);
30 WHEN(
"iinitialize and run nrn_calc_fast_imem") {
31 REQUIRE(
hoc_oc(
"finitialize(-65)\n") == 0);
35 THEN(
"The current in this section is 0") {
37 auto const vec_sav_rhs = nt->node_sav_rhs_storage();
38 for (
int i = 0;
i < nt->end; ++
i) {
39 REQUIRE(vec_sav_rhs[
i] == 0.0);
46 REQUIRE(
hoc_oc(
"delete_section()") == 0);
50 TEST_CASE(
"Test return code of execerror",
"[NEURON][execerror]") {
51 REQUIRE(
hoc_oc(
"execerror(\"test error\")") > 0);
55 TEST_CASE(
"Test Oc::run(cmd)",
"[NEURON]") {
57 REQUIRE(oc.
run(
"foo", 1) == 1);
58 REQUIRE(oc.
run(
"foo", 0) == 1);
64 #if !defined(NRN_ASAN_ENABLED) && !defined(NRN_TSAN_ENABLED)
65 TEST_CASE(
"Test nrn_mallinfo returns non-zero",
"[NEURON][nrn_mallinfo]") {
69 "if (nrn_mallinfo(0) <= 0) { execerror(\"nrn_mallinfo returned <= 0 in HOC\") }") ==
TEST_CASE("Test return code of execerror", "[NEURON][execerror]")
SCENARIO("Test fast_imem calculation", "[Neuron][fast_imem]")
int run(int argc, const char **argv)
int hoc_oc(const char *buf)
double nrn_mallinfo(void)
Returns current memory usage in KBs.
void nrn_fast_imem_alloc()
void nrn_calc_fast_imem(NrnThread *nt)
Represent main neuron object computed by single thread.