NEURON
cover.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 #include "oc_ansi.h"
3 
4 extern bool hoc_valid_stmt(const char*, Object*);
5 
6 #include <catch2/catch_test_macros.hpp>
7 
8 // Help cover PR's
9 
10 // #2675 NrnProperty handles extracellular and no longer creates/wraps a Prop structure.
11 // 8 missing lines in Codecov Report
12 // Difficult to cover with the interpreter as it requires manual mouse
13 // interaction with a SymbolChooser or "Plot what?" of Graph.
14 #include "symdir.h"
15 TEST_CASE("Cover #2675 ivoc/symdir.cpp", "[SymDirectory]") {
16  REQUIRE(hoc_valid_stmt(
17  ""
18  "// Create a POINT_PROCESS sufficient to cover SymDirectoryImpl::load_mechanism\n"
19  "begintemplate Mech1\n"
20  " public a, b, c\n"
21  " double b[3], c[8]\n"
22  " a = 0\n"
23  "endtemplate Mech1\n"
24  "make_mechanism(\"mech1\", \"Mech1\")\n"
25  "create soma\n"
26  "insert mech1\n"
27  "objref ic\n"
28  "ic = new IClamp(.5) // just to cover one line.\n",
29  nullptr) == 1);
30  std::string parent_path{""};
31  auto* somasym = hoc_lookup("soma");
32  REQUIRE(somasym);
33  auto symdir = new SymDirectory(parent_path, nullptr, somasym, 0, 0);
34  for (int i = 0; i < symdir->count(); ++i) {
35  printf("%d %s\n", i, symdir->name(i).c_str());
36  }
37  REQUIRE(symdir->count() == 10);
38  REQUIRE(symdir->name(4) == "c_mech1[all]( 0.5 )");
39  delete symdir;
40  REQUIRE(hoc_valid_stmt("objref ic\nsoma { delete_section() }", nullptr) == 1);
41 }
#define i
Definition: md1redef.h:19
TEST_CASE("Cover #2675 ivoc/symdir.cpp", "[SymDirectory]")
Definition: cover.cpp:15
bool hoc_valid_stmt(const char *, Object *)
Definition: ocjump.cpp:21
Symbol * hoc_lookup(const char *)
Definition: symbol.cpp:59
printf
Definition: extdef.h:5
HOC interpreter function declarations (included by hocdec.h)
Definition: hocdec.h:173