QMCPACK
test_ReferencePointsInput.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2023 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
8 //
9 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include <stdio.h>
16 #include <sstream>
17 
18 #include "ReferencePointsInput.h"
20 #include "OhmmsData/Libxml2Doc.h"
21 
22 namespace qmcplusplus
23 {
24 
25 TEST_CASE("ReferencePointsInput::parseXML::valid", "[estimators]")
26 {
28  for (auto input_xml : Input::xml)
29  {
31  bool okay = doc.parseFromString(input_xml);
32  xmlNodePtr node = doc.getRoot();
33 
34  // Will throw if input is invalid.
36  }
37 }
38 
39 TEST_CASE("ReferencePointsInput::parseXML::invalid", "[estimators]")
40 {
42  for (auto input_xml : Input::xml)
43  {
45  bool okay = doc.parseFromString(input_xml);
46  REQUIRE(okay);
47  xmlNodePtr node = doc.getRoot();
48 
49  auto constructBadRefPoints = [](xmlNodePtr cur) { ReferencePointsInput rpi(cur); };
50  CHECK_THROWS_AS(constructBadRefPoints(node), UniformCommunicateError);
51  }
52 }
53 
54 TEST_CASE("ReferencePointsInput::makeReferencePointsInput", "[estimators]")
55 {
57  std::string value_label;
59  bool okay = doc.parseFromString(Input::xml[0]);
60  xmlNodePtr node = doc.getRoot();
61  makeReferencePointsInput(node, value_label);
62  CHECK(value_label == "referencepoints");
63 }
64 } // namespace qmcplusplus
class that handles xmlDoc
Definition: Libxml2Doc.h:76
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
if(!okay) throw std xmlNodePtr node
TEST_CASE("complex_helper", "[type_traits]")
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
std::any makeReferencePointsInput(xmlNodePtr cur, std::string &value_label)
factory function used by InputSection to make reference points Input
REQUIRE(std::filesystem::exists(filename))
This a subclass for runtime errors that will occur on all ranks.
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))