QMCPACK
test_EngineHandle.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) 2022 QMCPACK developers.
6 //
7 // File developed by: Leon Otis, leon_otis@berkeley.edu, University of California Berkeley
8 //
9 // File created by: Leon Otis, leon_otis@berkeley.edu, University of California Berkeley
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #include "catch.hpp"
13 
14 #include "OhmmsData/Libxml2Doc.h"
17 #include "Configuration.h"
18 #include "Message/Communicate.h"
19 
20 namespace qmcplusplus
21 {
22 
25 
26 ///This provides a basic test of constructing an EngineHandle object and checking information in it
27 TEST_CASE("EngineHandle construction", "[drivers]")
28 {
30 
31 
32  const std::string engine_input("<tmp> </tmp>");
33 
35  bool okay = doc.parseFromString(engine_input);
36  REQUIRE(okay);
37 
38  xmlNodePtr fakeXML = doc.getRoot();
39 
40  DescentEngine descentEngineObj = DescentEngine(c, fakeXML);
41 
42  descentEngineObj.processXML(fakeXML);
43 
44  app_log() << "Test of DescentEngineHandle construction" << std::endl;
45  std::unique_ptr<DescentEngineHandle> handle = std::make_unique<DescentEngineHandle>(descentEngineObj);
46 
47 
48  const int fake_num_params = 5;
49  const int fake_sample_num = 100;
50  handle->prepareSampling(fake_num_params, fake_sample_num);
51  auto& test_der_rat_samp = handle->getVector();
52 
53  REQUIRE(test_der_rat_samp.size() == 6);
54  REQUIRE(test_der_rat_samp[0] == 0.0);
55 }
56 } // namespace qmcplusplus
class that handles xmlDoc
Definition: Libxml2Doc.h:76
qmcplusplus::QMCTraits::FullPrecValueType FullPrecValueType
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::ostream & app_log()
Definition: OutputManager.h:65
TEST_CASE("complex_helper", "[type_traits]")
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
QTFull::ValueType FullPrecValueType
Definition: Configuration.h:67
QTBase::ValueType ValueType
Definition: Configuration.h:60
REQUIRE(std::filesystem::exists(filename))
bool processXML(const xmlNodePtr cur)
process xml node
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
LatticeGaussianProduct::ValueType ValueType