Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Nektar::TestFile Class Reference

The TestData class is responsible for parsing a test XML file and storing the data. More...

#include <TestFile.h>

Public Member Functions

 TestFile (const fs::path &pFilename, po::variables_map &pVm)
 TestData constructor.
 
 TestFile (const TestFile &pSrc)
 
void Parse (TiXmlDocument *pDoc)
 Parse the test file and populate member variables for the test.
 
void SaveFile ()
 
std::vector< TestData * > GetTests ()
 

Private Attributes

po::variables_map m_cmdoptions
 
TiXmlDocument * m_doc
 
std::vector< TestData * > m_tests
 Vector of one or more tests to run.
 

Detailed Description

The TestData class is responsible for parsing a test XML file and storing the data.

Definition at line 58 of file TestFile.h.

Constructor & Destructor Documentation

◆ TestFile() [1/2]

Nektar::TestFile::TestFile ( const fs::path &  pFilename,
po::variables_map &  pVm 
)

TestData constructor.

The class is constructed with the path to the test XML file and a po::variables_map object containing the command-line options passed to the program.

Parameters
pFilename
pVm

Definition at line 57 of file TestFile.cpp.

58 : m_cmdoptions(pVm)
59{
60 // Process test file format.
61 m_doc = new TiXmlDocument(pFilename.string().c_str());
62
63 bool loadOkay = m_doc->LoadFile();
64
65 ASSERTL0(loadOkay,
66 "Failed to load test definition file: " + pFilename.string() +
67 "\n" + string(m_doc->ErrorDesc()));
68
69 Parse(m_doc);
70}
#define ASSERTL0(condition, msg)
TiXmlDocument * m_doc
Definition TestFile.h:75
po::variables_map m_cmdoptions
Definition TestFile.h:74
void Parse(TiXmlDocument *pDoc)
Parse the test file and populate member variables for the test.
Definition TestFile.cpp:78

References ASSERTL0, m_doc, and Parse().

◆ TestFile() [2/2]

Nektar::TestFile::TestFile ( const TestFile pSrc)

Definition at line 72 of file TestFile.cpp.

73{
74 boost::ignore_unused(pSrc);
75}

Member Function Documentation

◆ GetTests()

std::vector< TestData * > Nektar::TestFile::GetTests ( )
inline

Definition at line 68 of file TestFile.h.

69 {
70 return m_tests;
71 }
std::vector< TestData * > m_tests
Vector of one or more tests to run.
Definition TestFile.h:78

References m_tests.

Referenced by main().

◆ Parse()

void Nektar::TestFile::Parse ( TiXmlDocument *  pDoc)

Parse the test file and populate member variables for the test.

Definition at line 78 of file TestFile.cpp.

79{
80 TiXmlHandle handle(pDoc);
81 TiXmlElement *tmp, *testElement;
82
83 // Check to see whether the .tst file includes multiple <test> elements
84 // contained within the root document.
85 tmp = handle.FirstChildElement("tests").Element();
86 if (tmp)
87 {
88 testElement = tmp->FirstChildElement("test");
89 }
90 else
91 {
92 testElement = handle.FirstChildElement("test").Element();
93 }
94
95 ASSERTL0(testElement, "Cannot find 'test' or 'tests' root element.");
96
97 while (testElement)
98 {
99 m_tests.push_back(new TestData(testElement, m_cmdoptions));
100 testElement = testElement->NextSiblingElement("test");
101 }
102}

References ASSERTL0, m_cmdoptions, and m_tests.

Referenced by TestFile().

◆ SaveFile()

void Nektar::TestFile::SaveFile ( )

Definition at line 104 of file TestFile.cpp.

105{
106 m_doc->SaveFile();
107}

References m_doc.

Referenced by main().

Member Data Documentation

◆ m_cmdoptions

po::variables_map Nektar::TestFile::m_cmdoptions
private

Definition at line 74 of file TestFile.h.

Referenced by Parse().

◆ m_doc

TiXmlDocument* Nektar::TestFile::m_doc
private

Definition at line 75 of file TestFile.h.

Referenced by SaveFile(), and TestFile().

◆ m_tests

std::vector<TestData *> Nektar::TestFile::m_tests
private

Vector of one or more tests to run.

Definition at line 78 of file TestFile.h.

Referenced by GetTests(), and Parse().