Skip to content

Commit ecf8e33

Browse files
committed
Add unit tests of RBParameters::n_steps()
1 parent 2eb0688 commit ecf8e33

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/utils/rb_parameters_test.C

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public:
1414
CPPUNIT_TEST( testOldConstructor );
1515
CPPUNIT_TEST( testIterators );
1616
CPPUNIT_TEST( testAppend );
17+
CPPUNIT_TEST( testNSteps );
1718
CPPUNIT_TEST_SUITE_END();
1819

1920
public:
@@ -117,6 +118,25 @@ public:
117118
for (int i=0; i<3; ++i)
118119
CPPUNIT_ASSERT_EQUAL(params1.get_step_value("b", i), Real(i+3));
119120
}
121+
122+
void testNSteps()
123+
{
124+
LOG_UNIT_TEST;
125+
126+
// A default-constructed RBparameters object has 1 step by definition
127+
RBParameters params;
128+
CPPUNIT_ASSERT_EQUAL(params.n_steps(), static_cast<unsigned int>(1));
129+
130+
// Set the number of steps to use in the no-parameters case
131+
params.set_n_steps(10);
132+
CPPUNIT_ASSERT_EQUAL(params.n_steps(), static_cast<unsigned int>(10));
133+
134+
// Define multiple steps for a single parameter. Now we no longer
135+
// use the set_n_steps() value, since we have actual steps.
136+
params.push_back_value("a", 1.);
137+
params.push_back_value("a", 2.);
138+
CPPUNIT_ASSERT_EQUAL(params.n_steps(), static_cast<unsigned int>(2));
139+
}
120140
};
121141

122142
CPPUNIT_TEST_SUITE_REGISTRATION ( RBParametersTest );

0 commit comments

Comments
 (0)