added test for correct exception handling

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8948 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2014-09-11 03:23:50 +00:00
parent 5bd2cae399
commit 0272550872
2 changed files with 23 additions and 0 deletions

View File

@ -4475,3 +4475,24 @@ void TestIPhreeqc::TestGetAccumulatedLinesAfterRunString(void)
CPPUNIT_ASSERT_EQUAL( std::string(expected), obj.GetAccumulatedLines() );
}
}
void TestIPhreeqc::TestPBasicStopThrow(void)
{
IPhreeqc obj;
CPPUNIT_ASSERT_EQUAL(0, obj.LoadDatabase("../database/phreeqc.dat"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("SOLUTION 1 # Mine water from Bain et al., 2001"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("USER_PRINT"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("10 print -(0.006^0.9)"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("20 print TOTMOL(\"H\"), TOTMOLE(\"H\"), TOTMOLES(\"H\")"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("110 print (-0.2)^3"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("120 print (-0.2)^3.0"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("130 print (-0.2)^-2"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("140 print (-0.2)^-3"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("150 print -0.2^2.2"));
CPPUNIT_ASSERT_EQUAL(VR_OK, obj.AccumulateLine("END"));
obj.SetOutputFileOn(true);
CPPUNIT_ASSERT_EQUAL( 5, obj.RunAccumulated() );
}

View File

@ -85,6 +85,7 @@ class TestIPhreeqc : public CppUnit::TestFixture
CPPUNIT_TEST( TestGetAccumulatedLines );
CPPUNIT_TEST( TestGetAccumulatedLinesAfterRunFile );
CPPUNIT_TEST( TestGetAccumulatedLinesAfterRunString );
CPPUNIT_TEST( TestPBasicStopThrow );
CPPUNIT_TEST_SUITE_END();
public:
@ -170,6 +171,7 @@ public:
void TestGetAccumulatedLines(void);
void TestGetAccumulatedLinesAfterRunFile(void);
void TestGetAccumulatedLinesAfterRunString(void);
void TestPBasicStopThrow(void);
protected:
void TestFileOnOff(const char* FILENAME, bool output_file_on, bool error_file_on, bool log_file_on, bool selected_output_file_on, bool dump_file_on);