User Guide
nmodl_constructs.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Blue Brain Project, EPFL.
3  * See the top-level LICENSE file for details.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #pragma once
9 
10 #include <map>
11 #include <string>
12 #include <vector>
13 
14 namespace nmodl {
15 namespace test_utils {
16 
17 /// represent nmodl test construct
18 struct NmodlTestCase {
19  /// name of the test
20  std::string name;
21 
22  /// input nmodl construct
23  std::string input;
24 
25  /// expected nmodl output
26  std::string output;
27 
28  /// \todo : add associated json (to use in visitor test)
29 
30  NmodlTestCase() = delete;
31 
32  NmodlTestCase(std::string name, std::string input)
33  : name(name)
34  , input(input)
35  , output(input) {}
36 
37  NmodlTestCase(std::string name, std::string input, std::string output)
38  : name(name)
39  , input(input)
40  , output(output) {}
41 };
42 
43 /// represent differential equation test construct
45  /// name of the mod file
46  std::string name;
47 
48  /// differential equation to solve
49  std::string equation;
50 
51  /// expected solution
52  std::string solution;
53 
54  /// solve method
55  std::string method;
56 };
57 
58 extern std::map<std::string, NmodlTestCase> const nmodl_invalid_constructs;
59 extern std::map<std::string, NmodlTestCase> const nmodl_valid_constructs;
60 extern std::vector<DiffEqTestCase> const diff_eq_constructs;
61 
62 } // namespace test_utils
63 } // namespace nmodl
nmodl::test_utils::nmodl_valid_constructs
const std::map< std::string, NmodlTestCase > nmodl_valid_constructs
Definition: nmodl_constructs.cpp:181
nmodl
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
nmodl::test_utils::NmodlTestCase::name
std::string name
name of the test
Definition: nmodl_constructs.hpp:20
nmodl::test_utils::DiffEqTestCase::method
std::string method
solve method
Definition: nmodl_constructs.hpp:55
nmodl::test_utils::DiffEqTestCase::name
std::string name
name of the mod file
Definition: nmodl_constructs.hpp:46
nmodl::test_utils::diff_eq_constructs
const std::vector< DiffEqTestCase > diff_eq_constructs
Definition: nmodl_constructs.cpp:1309
nmodl::test_utils::nmodl_invalid_constructs
const std::map< std::string, NmodlTestCase > nmodl_invalid_constructs
Guidelines for adding nmodl text constructs.
Definition: nmodl_constructs.cpp:63
nmodl::test_utils::NmodlTestCase::output
std::string output
expected nmodl output
Definition: nmodl_constructs.hpp:26
nmodl::test_utils::NmodlTestCase
represent nmodl test construct
Definition: nmodl_constructs.hpp:18
nmodl::test_utils::NmodlTestCase::NmodlTestCase
NmodlTestCase(std::string name, std::string input, std::string output)
Definition: nmodl_constructs.hpp:37
nmodl::test_utils::DiffEqTestCase::equation
std::string equation
differential equation to solve
Definition: nmodl_constructs.hpp:49
nmodl::test_utils::NmodlTestCase::NmodlTestCase
NmodlTestCase()=delete
nmodl::test_utils::DiffEqTestCase
represent differential equation test construct
Definition: nmodl_constructs.hpp:44
nmodl::test_utils::DiffEqTestCase::solution
std::string solution
expected solution
Definition: nmodl_constructs.hpp:52
nmodl::test_utils::NmodlTestCase::NmodlTestCase
NmodlTestCase(std::string name, std::string input)
Definition: nmodl_constructs.hpp:32
nmodl::test_utils::NmodlTestCase::input
std::string input
input nmodl construct
Definition: nmodl_constructs.hpp:23