MCPcopy Create free account
hub / github.com/CompPhysVienna/n2p2 / nnpToolTestBody

Function nnpToolTestBody

test/cpp/test_nnp-train.cpp:18–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16NNP_TOOL_TEST_CASE()
17
18void nnpToolTestBody(Example_nnp_train const example)
19{
20 bool epochFound = false;
21 string line;
22 ifstream file;
23
24 // Grep for "CI-CHECK" for code changes if you want to review output files
25 // from non-interactive CI run.
26 //ifstream source("nnp-train.log.0000", ios::binary);
27 //ofstream dest("../nnp-train.log.0000." + example.name, ios::binary);
28 //dest << source.rdbuf();
29 //source.close();
30 //dest.close();
31 //ifstream source2("learning-curve.out", ios::binary);
32 //ofstream dest2("../learning-curve.out." + example.name, ios::binary);
33 //dest2 << source2.rdbuf();
34 //source2.close();
35 //dest2.close();
36
37 file.open("learning-curve.out");
38 BOOST_REQUIRE(file.is_open());
39 while (getline(file, line))
40 {
41 vector<string> columns = split(reduce(line));
42 if (columns.at(0) == to_string(example.lastEpoch))
43 {
44 epochFound = true;
45 BOOST_REQUIRE_SMALL(example.rmseEnergyTrain - stod(columns.at(1)),
46 example.accuracy);
47 BOOST_REQUIRE_SMALL(example.rmseEnergyTest - stod(columns.at(2)),
48 example.accuracy);
49 BOOST_REQUIRE_SMALL(example.rmseForcesTrain - stod(columns.at(9)),
50 example.accuracy);
51 BOOST_REQUIRE_SMALL(example.rmseForcesTest - stod(columns.at(10)),
52 example.accuracy);
53 }
54 }
55 file.close();
56 BOOST_REQUIRE_MESSAGE(epochFound,
57 string("ERROR: Epoch information was not "
58 "found in file."));
59
60 return;
61}

Callers

nothing calls this directly

Calls 2

splitFunction · 0.85
reduceFunction · 0.85

Tested by

no test coverage detected