all passing on windows

git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/ErrorHandling@5886 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2011-12-12 23:44:55 +00:00
parent f5733f7403
commit b6ddcdabc4
4 changed files with 20 additions and 33 deletions

View File

@ -20,21 +20,6 @@ const char ERROR_FILENAME[] = "phreeqc.err";
const char LOG_FILENAME[] = "phreeqc.log";
const char PUNCH_FILENAME[] = "selected.out";
int istream_getc(void *cookie)
{
if (cookie)
{
std::istream* is = (std::istream*)cookie;
int n = is->get();
if (n == 13 && is->peek() == 10)
{
n = is->get();
}
return n;
}
return EOF;
}
IPhreeqc::IPhreeqc(void)
: DatabaseLoaded(false)
, ClearAccumulated(false)

View File

@ -12,8 +12,8 @@ class TestIPhreeqc : public CppUnit::TestFixture
CPPUNIT_TEST( TestLoadDatabaseMissingFile );
CPPUNIT_TEST( TestLoadDatabaseWithErrors );
CPPUNIT_TEST( TestRunAccumulated );
// COMMENT: {12/12/2011 2:46:08 PM} CPPUNIT_TEST( TestRunWithErrors );
// COMMENT: {12/12/2011 2:46:23 PM} CPPUNIT_TEST( TestRunFile );
CPPUNIT_TEST( TestRunWithErrors );
CPPUNIT_TEST( TestRunFile );
CPPUNIT_TEST( TestRunString );
CPPUNIT_TEST( TestGetSelectedOutputRowCount );
CPPUNIT_TEST( TestGetSelectedOutputValue );
@ -45,8 +45,6 @@ public:
TestIPhreeqc(void);
~TestIPhreeqc(void);
// COMMENT: {3/30/2010 3:27:03 PM} static bool FileExists(const char *szPathName);
public:
void TestLoadDatabase(void);
void TestLoadDatabaseString(void);

View File

@ -2245,23 +2245,27 @@ void TestIPhreeqcLib::TestClearAccumulatedLines(void)
CPPUNIT_ASSERT_EQUAL(0, ::LoadDatabase(id, "../database/wateq4f.dat"));
// phreeqc can now handle pH of -2 (-r5885)
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "SOLUTION 1"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "pH -2") );
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "END") );
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " pH 7"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " Na 1"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "PHASES"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " Fix_H+"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " H+ = H+"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " log_k 0"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "EQUILIBRIUM_PHASES"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, " Fix_H+ -10 HCl 10"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "END"));
CPPUNIT_ASSERT_EQUAL(1, ::RunAccumulated(id));
CPPUNIT_ASSERT_EQUAL( 3, ::GetErrorStringLineCount(id) );
CPPUNIT_ASSERT_EQUAL(1, ::GetErrorStringLineCount(id));
#if defined(_MSC_VER)
CPPUNIT_ASSERT_EQUAL( std::string("ERROR: A(H2O) Activity of water has not converged. Residual: 1.590343e+000"), std::string(::GetErrorStringLine(id, 0)) );
#endif
#if defined(__GNUC__)
CPPUNIT_ASSERT_EQUAL( std::string("ERROR: A(H2O) Activity of water has not converged. Residual: 1.590343e+00"), std::string(::GetErrorStringLine(id, 0)) );
#endif
const char expected[] =
"ERROR: Numerical method failed on all combinations of convergence parameters\n";
const char* err = ::GetErrorString(id);
CPPUNIT_ASSERT_EQUAL( std::string(""), std::string(::GetErrorStringLine(id, 1)) );
CPPUNIT_ASSERT_EQUAL( std::string("ERROR: Model failed to converge for initial solution."), std::string(::GetErrorStringLine(id, 2)) );
CPPUNIT_ASSERT_EQUAL( std::string(expected), std::string(err) );
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "SOLUTION 1"));
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::AccumulateLine(id, "pH 2") );

View File

@ -14,8 +14,8 @@ class TestIPhreeqcLib : public CppUnit::TestFixture
CPPUNIT_TEST( TestLoadDatabaseMissingFile );
CPPUNIT_TEST( TestLoadDatabaseWithErrors );
CPPUNIT_TEST( TestRunAccumulated );
// COMMENT: {12/12/2011 2:46:47 PM} CPPUNIT_TEST( TestRunWithErrors );
// COMMENT: {12/12/2011 2:46:59 PM} CPPUNIT_TEST( TestRunFile );
CPPUNIT_TEST( TestRunWithErrors );
CPPUNIT_TEST( TestRunFile );
CPPUNIT_TEST( TestRunString );
CPPUNIT_TEST( TestGetSelectedOutputRowCount );
CPPUNIT_TEST( TestGetSelectedOutputValue );
@ -45,7 +45,7 @@ class TestIPhreeqcLib : public CppUnit::TestFixture
CPPUNIT_TEST( TestLogFileOn ); // new
CPPUNIT_TEST( TestGetWarningStringLine );
CPPUNIT_TEST( TestPitzer );
// COMMENT: {12/12/2011 2:47:15 PM} CPPUNIT_TEST( TestClearAccumulatedLines );
CPPUNIT_TEST( TestClearAccumulatedLines );
CPPUNIT_TEST_SUITE_END();
public: