Definition at line 11 of file getpot_test.C.
◆ CPPUNIT_TEST() [1/4]
◆ CPPUNIT_TEST() [2/4]
◆ CPPUNIT_TEST() [3/4]
◆ CPPUNIT_TEST() [4/4]
◆ CPPUNIT_TEST_SUITE()
◆ CPPUNIT_TEST_SUITE_END()
GetPotTest::CPPUNIT_TEST_SUITE_END |
( |
| ) |
|
◆ setUp()
void GetPotTest::setUp |
( |
| ) |
|
|
inline |
◆ setup_inputfile()
void GetPotTest::setup_inputfile |
( |
| ) |
|
|
inline |
Definition at line 31 of file getpot_test.C.
57 " [../../Subsection4]\n"
65 " unused_var = 'not_used'\n";
◆ testCommandLine()
void GetPotTest::testCommandLine |
( |
| ) |
|
|
inline |
◆ testSections()
void GetPotTest::testSections |
( |
| ) |
|
|
inline |
Definition at line 109 of file getpot_test.C.
112 CPPUNIT_ASSERT(
input.have_section(
"Section1/"));
113 CPPUNIT_ASSERT(
input.have_section(
"Section1/SubSection1/"));
114 CPPUNIT_ASSERT(
input.have_section(
"Section2/Subsection2/"));
115 CPPUNIT_ASSERT(
input.have_section(
"Section2/Subsection2/Subsection3/"));
116 CPPUNIT_ASSERT(
input.have_section(
"Section2/Subsection4/"));
117 CPPUNIT_ASSERT(
input.have_section(
"Section3/"));
120 CPPUNIT_ASSERT(
input.have_section(
"Section1"));
121 CPPUNIT_ASSERT(
input.have_section(
"Section1/SubSection1"));
122 CPPUNIT_ASSERT(
input.have_section(
"Section2/Subsection2/Subsection3"));
125 CPPUNIT_ASSERT(!
input.have_section(
"ImNotASection/"));
◆ testSubSections()
void GetPotTest::testSubSections |
( |
| ) |
|
|
inline |
Definition at line 128 of file getpot_test.C.
130 typedef std::vector<std::string>::size_type sz;
131 typedef std::string str;
133 const std::vector<std::string> subsections1 =
134 input.get_subsection_names(
"Section1");
136 CPPUNIT_ASSERT_EQUAL(subsections1.size(), sz(1));
137 CPPUNIT_ASSERT_EQUAL(subsections1[0], str(
"SubSection1"));
139 const std::vector<std::string> subsections1_1 =
140 input.get_subsection_names(
"Section1/Subsection1");
142 CPPUNIT_ASSERT(subsections1_1.empty());
144 const std::vector<std::string> subsections2 =
145 input.get_subsection_names(
"Section2");
147 CPPUNIT_ASSERT_EQUAL(subsections2.size(), sz(2));
148 CPPUNIT_ASSERT_EQUAL(subsections2[0], str(
"Subsection2"));
149 CPPUNIT_ASSERT_EQUAL(subsections2[1], str(
"Subsection4"));
151 const std::vector<std::string> subsections2_2 =
152 input.get_subsection_names(
"Section2/Subsection2");
154 CPPUNIT_ASSERT_EQUAL(subsections2_2.size(), sz(1));
155 CPPUNIT_ASSERT_EQUAL(subsections2_2[0], str(
"Subsection3"));
157 const std::vector<std::string> subsections2_4 =
158 input.get_subsection_names(
"Section2/Subsection4");
160 CPPUNIT_ASSERT(subsections2_4.empty());
162 const std::vector<std::string> subsections3 =
163 input.get_subsection_names(
"Section3");
165 CPPUNIT_ASSERT(subsections3.empty());
◆ testVariables()
void GetPotTest::testVariables |
( |
| ) |
|
|
inline |
Definition at line 76 of file getpot_test.C.
78 CPPUNIT_ASSERT(
input.have_variable(
"Section1/var1") );
80 CPPUNIT_ASSERT_EQUAL( var1,
Real(5));
82 CPPUNIT_ASSERT(
input.have_variable(
"Section1/SubSection1/var2") );
83 std::string var2 =
input(
"Section1/SubSection1/var2",
"DIE!");
84 CPPUNIT_ASSERT_EQUAL( var2, std::string(
"blah") );
87 CPPUNIT_ASSERT( !
input.have_variable(
"Section2/var3") );
88 int var3 =
input(
"Section2/var3", 314);
89 CPPUNIT_ASSERT_EQUAL( var3, 314 );
91 CPPUNIT_ASSERT(
input.have_variable(
"Section2/Subsection2/var4") );
92 bool var4 =
input(
"Section2/Subsection2/var4",
true);
93 CPPUNIT_ASSERT_EQUAL( var4,
false );
95 CPPUNIT_ASSERT(
input.have_variable(
"Section2/Subsection2/Subsection3/var5") );
96 Real var5 =
input(
"Section2/Subsection2/Subsection3/var5", 3.1415);
97 CPPUNIT_ASSERT_EQUAL( var5,
Real(6.02e23));
99 CPPUNIT_ASSERT(
input.have_variable(
"Section2/Subsection4/var6") );
100 unsigned int var6 =
input(
"Section2/Subsection4/var6", 21);
101 CPPUNIT_ASSERT_EQUAL( var6, (
unsigned int)42 );
104 std::vector<std::string> ufos =
input.unidentified_variables();
105 CPPUNIT_ASSERT_EQUAL( ufos.size(), (std::vector<std::string>::size_type)1 );
106 CPPUNIT_ASSERT_EQUAL( ufos[0], std::string(
"Section3/unused_var") );
References libMesh::Real.
◆ input
◆ inputfile
std::stringstream GetPotTest::inputfile |
|
protected |
The documentation for this class was generated from the following file: