MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / test_parser

Function test_parser

Tests/Parser2/main.cpp:11–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9double f (int icase, double x, double y, double z);
10
11bool test_parser(int icase, std::string const& expr)
12{
13 double x = 1.23, y = 2.34, z = 3.45;
14 auto result_native = f(icase, x, y, z);
15
16 amrex::Print() << "\ncase " << icase << ": " << expr << "\n";
17
18 Parser parser(expr);
19 parser.registerVariables({"x","y","z"});
20
21 parser.print();
22
23 auto const exe = parser.compile<3>();
24 auto result_parser = exe(x,y,z);
25
26 parser.printExe();
27
28 return amrex::almostEqual(result_native, result_parser, 10);
29}
30
31int main (int argc, char* argv[])
32{

Callers 1

mainFunction · 0.85

Calls 5

PrintClass · 0.85
printExeMethod · 0.80
fFunction · 0.70
registerVariablesMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected