mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
fixed bug in DELETE reported by laurin.wissmeier@web.de 2013-06-01
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@7755 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
6c6dacabab
commit
437c7c5a3a
@ -3417,4 +3417,53 @@ void TestIPhreeqc::TestCErrorReporter(void)
|
||||
//printf("\ntime = %g\n", double(t - t0));
|
||||
}
|
||||
|
||||
void TestIPhreeqc::TestDelete(void)
|
||||
{
|
||||
const char input[] =
|
||||
"SOLUTION 1 # definition of intial condition 1\n"
|
||||
"COPY cell 1 7405 # copy cell 1 to placeholder cell with index larger than the number of cells in the model domain\n"
|
||||
"END\n"
|
||||
"DELETE # delete initial condition 1 to allow for a redefinition of all reactions\n"
|
||||
"-cell 1\n"
|
||||
"END\n"
|
||||
"# define other initial conditions and copy to another placeholder cell\n"
|
||||
"\n"
|
||||
"COPY cell 7405 1 # copy back from placeholder cell to domain cell 1\n"
|
||||
"END\n"
|
||||
"MIX 1 # mix according to initial moisture content\n"
|
||||
" 1 0.25\n"
|
||||
"END\n"
|
||||
"RUN_CELLS\n"
|
||||
"-cells 1\n"
|
||||
"-start_time 0\n"
|
||||
"-time_step 0\n"
|
||||
"DELETE # remove mix reaction in subsequent runs\n"
|
||||
"-mix 1\n"
|
||||
"END\n"
|
||||
"RUN_CELLS\n"
|
||||
"-cells 1\n";
|
||||
|
||||
IPhreeqc obj;
|
||||
|
||||
char OUTPUT_FILE[80];
|
||||
sprintf(OUTPUT_FILE, "phreeqc.%lu.out", (unsigned long)obj.Index);
|
||||
|
||||
if (::FileExists(OUTPUT_FILE))
|
||||
{
|
||||
CPPUNIT_ASSERT(::DeleteFile(OUTPUT_FILE));
|
||||
}
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
CPPUNIT_ASSERT_EQUAL(0, obj.LoadDatabase("phreeqc.dat"));
|
||||
obj.SetOutputFileOn(0);
|
||||
obj.SetErrorFileOn(0);
|
||||
obj.SetLogFileOn(0);
|
||||
obj.SetSelectedOutputFileOn(0);
|
||||
obj.SetDumpFileOn(0);
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
CPPUNIT_ASSERT_EQUAL(0, obj.RunString(input));
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
if (::FileExists(OUTPUT_FILE))
|
||||
{
|
||||
CPPUNIT_ASSERT(::DeleteFile(OUTPUT_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,8 @@ class TestIPhreeqc : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST( TestLongUser_Punch );
|
||||
CPPUNIT_TEST( TestBasicSURF );
|
||||
CPPUNIT_TEST( TestCErrorReporter );
|
||||
CPPUNIT_TEST( TestDelete );
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -126,6 +128,8 @@ public:
|
||||
void TestLongUser_Punch(void);
|
||||
void TestBasicSURF(void);
|
||||
void TestCErrorReporter(void);
|
||||
void TestDelete(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);
|
||||
|
||||
@ -3908,3 +3908,60 @@ void TestIPhreeqcLib::TestIEEE(void)
|
||||
// COMMENT: {1/18/2013 6:34:57 PM} CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::DestroyIPhreeqc(n));
|
||||
// COMMENT: {1/18/2013 6:34:57 PM} }
|
||||
}
|
||||
|
||||
void TestIPhreeqcLib::TestDelete(void)
|
||||
{
|
||||
const char input[] =
|
||||
"SOLUTION 1 # definition of intial condition 1\n"
|
||||
"COPY cell 1 7405 # copy cell 1 to placeholder cell with index larger than the number of cells in the model domain\n"
|
||||
"END\n"
|
||||
"DELETE # delete initial condition 1 to allow for a redefinition of all reactions\n"
|
||||
"-cell 1\n"
|
||||
"END\n"
|
||||
"# define other initial conditions and copy to another placeholder cell\n"
|
||||
"\n"
|
||||
"COPY cell 7405 1 # copy back from placeholder cell to domain cell 1\n"
|
||||
"END\n"
|
||||
"MIX 1 # mix according to initial moisture content\n"
|
||||
" 1 0.25\n"
|
||||
"END\n"
|
||||
"RUN_CELLS\n"
|
||||
"-cells 1\n"
|
||||
"-start_time 0\n"
|
||||
"-time_step 0\n"
|
||||
"DELETE # remove mix reaction in subsequent runs\n"
|
||||
"-mix 1\n"
|
||||
"END\n"
|
||||
"RUN_CELLS\n"
|
||||
"-cells 1\n";
|
||||
|
||||
int n = ::CreateIPhreeqc();
|
||||
CPPUNIT_ASSERT(n >= 0);
|
||||
|
||||
char OUTPUT_FILE[80];
|
||||
sprintf(OUTPUT_FILE, "phreeqc.%d.out", n);
|
||||
|
||||
if (::FileExists(OUTPUT_FILE))
|
||||
{
|
||||
CPPUNIT_ASSERT(::DeleteFile(OUTPUT_FILE));
|
||||
}
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, ::LoadDatabase(n, "phreeqc.dat"));
|
||||
::SetOutputFileOn(n, 0);
|
||||
::SetErrorFileOn(n, 0);
|
||||
::SetLogFileOn(n, 0);
|
||||
::SetSelectedOutputFileOn(n, 0);
|
||||
::SetDumpFileOn(n, 0);
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
CPPUNIT_ASSERT_EQUAL(0, ::RunString(n, input));
|
||||
CPPUNIT_ASSERT_EQUAL(false, ::FileExists(OUTPUT_FILE));
|
||||
if (n >= 0)
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL(IPQ_OK, ::DestroyIPhreeqc(n));
|
||||
}
|
||||
if (::FileExists(OUTPUT_FILE))
|
||||
{
|
||||
CPPUNIT_ASSERT(::DeleteFile(OUTPUT_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ class TestIPhreeqcLib : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST( TestLongUser_Punch );
|
||||
CPPUNIT_TEST( TestBasicSURF );
|
||||
CPPUNIT_TEST( TestIEEE );
|
||||
CPPUNIT_TEST( TestDelete );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -140,6 +141,7 @@ public:
|
||||
void TestLongUser_Punch(void);
|
||||
void TestBasicSURF(void);
|
||||
void TestIEEE(void);
|
||||
void TestDelete(void);
|
||||
|
||||
protected:
|
||||
void TestFileOnOff(const char* FILENAME, int output_file_on, int error_file_on, int log_file_on, int selected_output_file_on, int dump_file_on);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user