QMCPACK
test_WFOptDriverInput.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) 2019 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
8 // Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
9 //
10 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #include "catch.hpp"
15 
18 #include "OhmmsData/Libxml2Doc.h"
19 
20 namespace qmcplusplus
21 {
22 TEST_CASE("WFOptDriverInput Instantiation", "[drivers]") { WFOptDriverInput driver_input; }
23 
24 TEST_CASE("WFOptDriverInput readXML", "[drivers]")
25 {
26  auto xml_test = [](const char* driver_xml) {
28  bool okay = doc.parseFromString(driver_xml);
29  REQUIRE(okay);
30  xmlNodePtr node = doc.getRoot();
31  WFOptDriverInput wfoptdriver_input;
32  wfoptdriver_input.readXML(node);
33 
34  if (wfoptdriver_input.get_opt_method() == "")
35  {
36  REQUIRE(wfoptdriver_input.get_opt_num_crowds() == 0);
37  REQUIRE(wfoptdriver_input.get_opt_crowd_size() == 1);
38  }
39  else if (wfoptdriver_input.get_opt_method() == "test")
40  {
41  REQUIRE(wfoptdriver_input.get_opt_num_crowds() == 4);
42  REQUIRE(wfoptdriver_input.get_opt_crowd_size() == 8);
43  }
44  else
45  {
46  std::cout << "Unknown opt method: " << wfoptdriver_input.get_opt_method() << std::endl;
47  REQUIRE(false); // optimizer method name not one of the two options
48  }
49  };
50 
51  std::for_each(testing::valid_opt_input_sections.begin(), testing::valid_opt_input_sections.end(), xml_test);
52 }
53 } // namespace qmcplusplus
class that handles xmlDoc
Definition: Libxml2Doc.h:76
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
if(!okay) throw std xmlNodePtr node
const std::string & get_opt_method() const
TEST_CASE("complex_helper", "[type_traits]")
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr std::array< const char *, 2 > valid_opt_input_sections
As far as I can tell these are no longer valid.
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
void readXML(xmlNodePtr xml_input)
avoids many repeated xml heredoc sections