From 9d0e42878129062bbd3016f8b53d1a3504286875 Mon Sep 17 00:00:00 2001 From: Scott R Charlton Date: Thu, 29 Dec 2011 00:12:28 +0000 Subject: [PATCH] renamed test cases git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/ErrorHandling@5956 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- unit/TestIPhreeqc.cpp | 94 ++++++++++++++++++++-------------------- unit/TestIPhreeqc.h | 23 +++++----- unit/TestIPhreeqcLib.cpp | 92 +++++++++++++++++++-------------------- unit/TestIPhreeqcLib.h | 22 +++++----- 4 files changed, 116 insertions(+), 115 deletions(-) diff --git a/unit/TestIPhreeqc.cpp b/unit/TestIPhreeqc.cpp index 14cc969e..085d4e1d 100644 --- a/unit/TestIPhreeqc.cpp +++ b/unit/TestIPhreeqc.cpp @@ -24,8 +24,6 @@ VRESULT USER_PUNCH(IPhreeqc& obj, const char* element, int max); VRESULT SELECTED_OUTPUT(IPhreeqc& obj); VRESULT DUMP(IPhreeqc& obj); -void TestOnOff(const char* FILENAME, bool output_on, bool error_on, bool log_on, bool selected_output_on, bool dump_on); - TestIPhreeqc::TestIPhreeqc(void) { } @@ -1272,7 +1270,7 @@ void TestIPhreeqc::TestPrintSelectedOutputFalse(void) CPPUNIT_ASSERT_EQUAL( 2, obj.GetSelectedOutputRowCount() ); } -void TestIPhreeqc::TestOutputOnOff() +void TestIPhreeqc::TestOutputFileOnOff() { #if defined(_WIN32) int n = ::_fcloseall(); @@ -1280,59 +1278,59 @@ void TestIPhreeqc::TestOutputOnOff() #endif bool onoff[5]; - onoff[0] = true; // output_on - onoff[1] = false; // error_on - onoff[2] = false; // log_on - onoff[3] = false; // selected_output_on - onoff[4] = false; // dump_on - ::TestOnOff("phreeqc.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = true; // output_file_on + onoff[1] = false; // error_file_on + onoff[2] = false; // log_file_on + onoff[3] = false; // selected_output_file_on + onoff[4] = false; // dump_file_on + TestFileOnOff("phreeqc.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqc::TestErrorOnOff() +void TestIPhreeqc::TestErrorFileOnOff() { bool onoff[5]; - onoff[0] = false; // output_on - onoff[1] = true; // error_on - onoff[2] = false; // log_on - onoff[3] = false; // selected_output_on - onoff[4] = false; // dump_on - ::TestOnOff("phreeqc.%d.err", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = false; // output_file_on + onoff[1] = true; // error_file_on + onoff[2] = false; // log_file_on + onoff[3] = false; // selected_output_file_on + onoff[4] = false; // dump_file_on + TestFileOnOff("phreeqc.%d.err", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqc::TestLogOnOff() +void TestIPhreeqc::TestLogFileOnOff() { bool onoff[5]; - onoff[0] = false; // output_on - onoff[1] = false; // error_on - onoff[2] = true; // log_on - onoff[3] = false; // selected_output_on - onoff[4] = false; // dump_on - ::TestOnOff("phreeqc.%d.log", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = false; // output_file_on + onoff[1] = false; // error_file_on + onoff[2] = true; // log_file_on + onoff[3] = false; // selected_output_file_on + onoff[4] = false; // dump_file_on + TestFileOnOff("phreeqc.%d.log", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqc::TestDumpOnOff() +void TestIPhreeqc::TestDumpFileOnOff() { bool onoff[5]; - onoff[0] = false; // output_on - onoff[1] = false; // error_on - onoff[2] = false; // log_on - onoff[3] = false; // selected_output_on - onoff[4] = true; // dump_on - ::TestOnOff("dump.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = false; // output_file_on + onoff[1] = false; // error_file_on + onoff[2] = false; // log_file_on + onoff[3] = false; // selected_output_file_on + onoff[4] = true; // dump_file_on + TestFileOnOff("dump.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqc::TestSelOutOnOff() +void TestIPhreeqc::TestSelOutFileOnOff() { bool onoff[5]; - onoff[0] = false; // output_on - onoff[1] = false; // error_on - onoff[2] = false; // log_on - onoff[3] = true; // selected_output_on - onoff[4] = false; // dump_on - ::TestOnOff("selected.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = false; // output_file_on + onoff[1] = false; // error_file_on + onoff[2] = false; // log_file_on + onoff[3] = true; // selected_output_file_on + onoff[4] = false; // dump_file_on + TestFileOnOff("selected.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestOnOff(const char* FILENAME_FORMAT, bool output_on, bool error_on, bool log_on, bool selected_output_on, bool dump_on) +void TestIPhreeqc::TestFileOnOff(const char* FILENAME_FORMAT, bool output_file_on, bool error_file_on, bool log_file_on, bool selected_output_file_on, bool dump_file_on) { IPhreeqc obj; @@ -1381,11 +1379,11 @@ void TestOnOff(const char* FILENAME_FORMAT, bool output_on, bool error_on, bool CPPUNIT_ASSERT_EQUAL( VR_OK, DUMP(obj) ); // run - obj.SetDumpFileOn(dump_on); - obj.SetErrorFileOn(error_on); - obj.SetLogFileOn(log_on); - obj.SetOutputFileOn(output_on); - obj.SetSelectedOutputFileOn(selected_output_on); + obj.SetDumpFileOn(dump_file_on); + obj.SetErrorFileOn(error_file_on); + obj.SetLogFileOn(log_file_on); + obj.SetOutputFileOn(output_file_on); + obj.SetSelectedOutputFileOn(selected_output_file_on); CPPUNIT_ASSERT_EQUAL( 0, obj.RunAccumulated() ); CPPUNIT_ASSERT_EQUAL( true, ::FileExists(FILENAME) ); CPPUNIT_ASSERT( ::DeleteFile(FILENAME) ); @@ -1421,11 +1419,11 @@ void TestOnOff(const char* FILENAME_FORMAT, bool output_on, bool error_on, bool CPPUNIT_ASSERT_EQUAL( VR_OK, DUMP(obj) ); // run - obj.SetDumpFileOn(dump_on); - obj.SetErrorFileOn(error_on); - obj.SetLogFileOn(log_on); - obj.SetOutputFileOn(output_on); - obj.SetSelectedOutputFileOn(selected_output_on); + obj.SetDumpFileOn(dump_file_on); + obj.SetErrorFileOn(error_file_on); + obj.SetLogFileOn(log_file_on); + obj.SetOutputFileOn(output_file_on); + obj.SetSelectedOutputFileOn(selected_output_file_on); CPPUNIT_ASSERT_EQUAL( 0, obj.RunAccumulated() ); CPPUNIT_ASSERT_EQUAL( true, ::FileExists(FILENAME) ); CPPUNIT_ASSERT( ::DeleteFile(FILENAME) ); diff --git a/unit/TestIPhreeqc.h b/unit/TestIPhreeqc.h index 5d322ae2..c562c45a 100644 --- a/unit/TestIPhreeqc.h +++ b/unit/TestIPhreeqc.h @@ -26,11 +26,11 @@ class TestIPhreeqc : public CppUnit::TestFixture CPPUNIT_TEST( TestCase1 ); CPPUNIT_TEST( TestCase2 ); CPPUNIT_TEST( TestPrintSelectedOutputFalse ); - CPPUNIT_TEST( TestOutputOnOff ); - CPPUNIT_TEST( TestErrorOnOff ); - CPPUNIT_TEST( TestLogOnOff ); - CPPUNIT_TEST( TestDumpOnOff ); - CPPUNIT_TEST( TestSelOutOnOff ); + CPPUNIT_TEST( TestOutputFileOnOff ); + CPPUNIT_TEST( TestErrorFileOnOff ); + CPPUNIT_TEST( TestLogFileOnOff ); + CPPUNIT_TEST( TestDumpFileOnOff ); + CPPUNIT_TEST( TestSelOutFileOnOff ); CPPUNIT_TEST( TestLongHeadings ); CPPUNIT_TEST( TestDatabaseKeyword ); CPPUNIT_TEST( TestDumpString ); @@ -72,11 +72,11 @@ public: void TestCase1(void); void TestCase2(void); void TestPrintSelectedOutputFalse(void); - void TestOutputOnOff(void); - void TestErrorOnOff(void); - void TestLogOnOff(void); - void TestDumpOnOff(void); - void TestSelOutOnOff(void); + void TestOutputFileOnOff(void); + void TestErrorFileOnOff(void); + void TestLogFileOnOff(void); + void TestDumpFileOnOff(void); + void TestSelOutFileOnOff(void); void TestLongHeadings(void); void TestDatabaseKeyword(void); void TestDumpString(void); @@ -91,6 +91,9 @@ public: void TestGetOutputString(void); void TestGetOutputStringLineCount(void); void TestGetOutputStringLine(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); }; #endif // TESTIPHREEQC_H_INCLUDED diff --git a/unit/TestIPhreeqcLib.cpp b/unit/TestIPhreeqcLib.cpp index b65b1d56..5f0e19e3 100644 --- a/unit/TestIPhreeqcLib.cpp +++ b/unit/TestIPhreeqcLib.cpp @@ -1447,62 +1447,62 @@ void TestIPhreeqcLib::TestPrintSelectedOutputFalse(void) } } -void TestIPhreeqcLib::TestOutputOnOff() +void TestIPhreeqcLib::TestOutputFileOnOff() { int onoff[5]; - onoff[0] = 1; // output_on - onoff[1] = 0; // error_on - onoff[2] = 0; // log_on - onoff[3] = 0; // selected_output_on - onoff[4] = 0; // dump_on - TestOnOff("phreeqc.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = 1; // output_file_on + onoff[1] = 0; // error_file_on + onoff[2] = 0; // log_file_on + onoff[3] = 0; // selected_output_file_on + onoff[4] = 0; // dump_file_on + TestFileOnOff("phreeqc.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqcLib::TestErrorOnOff() +void TestIPhreeqcLib::TestErrorFileOnOff() { int onoff[5]; - onoff[0] = 0; // output_on - onoff[1] = 1; // error_on - onoff[2] = 0; // log_on - onoff[3] = 0; // selected_output_on - onoff[4] = 0; // dump_on - TestOnOff("phreeqc.%d.err", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = 0; // output_file_on + onoff[1] = 1; // error_file_on + onoff[2] = 0; // log_file_on + onoff[3] = 0; // selected_output_file_on + onoff[4] = 0; // dump_file_on + TestFileOnOff("phreeqc.%d.err", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqcLib::TestLogOnOff() +void TestIPhreeqcLib::TestLogFileOnOff() { int onoff[5]; - onoff[0] = 0; // output_on - onoff[1] = 0; // error_on - onoff[2] = 1; // log_on - onoff[3] = 0; // selected_output_on - onoff[4] = 0; // dump_on - TestOnOff("phreeqc.%d.log", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = 0; // output_file_on + onoff[1] = 0; // error_file_on + onoff[2] = 1; // log_file_on + onoff[3] = 0; // selected_output_file_on + onoff[4] = 0; // dump_file_on + TestFileOnOff("phreeqc.%d.log", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqcLib::TestDumpOnOff() +void TestIPhreeqcLib::TestDumpFileOnOff() { int onoff[5]; - onoff[0] = 0; // output_on - onoff[1] = 0; // error_on - onoff[2] = 0; // log_on - onoff[3] = 0; // selected_output_on - onoff[4] = 1; // dump_on - TestOnOff("dump.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = 0; // output_file_on + onoff[1] = 0; // error_file_on + onoff[2] = 0; // log_file_on + onoff[3] = 0; // selected_output_file_on + onoff[4] = 1; // dump_file_on + TestFileOnOff("dump.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqcLib::TestSelOutOnOff() +void TestIPhreeqcLib::TestSelOutFileOnOff() { int onoff[5]; - onoff[0] = 0; // output_on - onoff[1] = 0; // error_on - onoff[2] = 0; // log_on - onoff[3] = 1; // selected_output_on - onoff[4] = 0; // dump_on - TestOnOff("selected.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); + onoff[0] = 0; // output_file_on + onoff[1] = 0; // error_file_on + onoff[2] = 0; // log_file_on + onoff[3] = 1; // selected_output_file_on + onoff[4] = 0; // dump_file_on + TestFileOnOff("selected.%d.out", onoff[0], onoff[1], onoff[2], onoff[3], onoff[4]); } -void TestIPhreeqcLib::TestOnOff(const char* FILENAME_FORMAT, int output_on, int error_on, int log_on, int selected_output_on, int dump_on) +void TestIPhreeqcLib::TestFileOnOff(const char* FILENAME_FORMAT, int output_file_on, int error_file_on, int log_file_on, int selected_output_file_on, int dump_file_on) { int dump_string_on = 0; @@ -1552,11 +1552,11 @@ void TestIPhreeqcLib::TestOnOff(const char* FILENAME_FORMAT, int output_on, int CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::DUMP(n) ); // run - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpFileOn(n, dump_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetErrorFileOn(n, error_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetLogFileOn(n, log_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetOutputFileOn(n, output_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetSelectedOutputFileOn(n, selected_output_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpFileOn(n, dump_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetErrorFileOn(n, error_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetLogFileOn(n, log_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetOutputFileOn(n, output_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetSelectedOutputFileOn(n, selected_output_file_on) ); CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpStringOn(n, dump_string_on) ); CPPUNIT_ASSERT_EQUAL( 0, ::RunAccumulated(n) ); CPPUNIT_ASSERT_EQUAL( true, ::FileExists(FILENAME) ); @@ -1593,11 +1593,11 @@ void TestIPhreeqcLib::TestOnOff(const char* FILENAME_FORMAT, int output_on, int CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::DUMP(n) ); // run - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpFileOn(n, dump_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetErrorFileOn(n, error_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetLogFileOn(n, log_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetOutputFileOn(n, output_on) ); - CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetSelectedOutputFileOn(n, selected_output_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpFileOn(n, dump_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetErrorFileOn(n, error_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetLogFileOn(n, log_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetOutputFileOn(n, output_file_on) ); + CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetSelectedOutputFileOn(n, selected_output_file_on) ); CPPUNIT_ASSERT_EQUAL( IPQ_OK, ::SetDumpStringOn(n, dump_string_on) ); CPPUNIT_ASSERT_EQUAL( 0, ::RunAccumulated(n) ); CPPUNIT_ASSERT_EQUAL( true, ::FileExists(FILENAME) ); diff --git a/unit/TestIPhreeqcLib.h b/unit/TestIPhreeqcLib.h index 75154b95..0af54e33 100644 --- a/unit/TestIPhreeqcLib.h +++ b/unit/TestIPhreeqcLib.h @@ -28,11 +28,11 @@ class TestIPhreeqcLib : public CppUnit::TestFixture CPPUNIT_TEST( TestCase1 ); CPPUNIT_TEST( TestCase2 ); CPPUNIT_TEST( TestPrintSelectedOutputFalse ); - CPPUNIT_TEST( TestOutputOnOff ); - CPPUNIT_TEST( TestErrorOnOff ); - CPPUNIT_TEST( TestLogOnOff ); - CPPUNIT_TEST( TestDumpOnOff ); - CPPUNIT_TEST( TestSelOutOnOff ); + CPPUNIT_TEST( TestOutputFileOnOff ); + CPPUNIT_TEST( TestErrorFileOnOff ); + CPPUNIT_TEST( TestLogFileOnOff ); + CPPUNIT_TEST( TestDumpFileOnOff ); + CPPUNIT_TEST( TestSelOutFileOnOff ); CPPUNIT_TEST( TestLongHeadings ); CPPUNIT_TEST( TestDatabaseKeyword ); CPPUNIT_TEST( TestDumpString ); @@ -81,11 +81,11 @@ public: void TestCase1(void); void TestCase2(void); void TestPrintSelectedOutputFalse(void); - void TestOutputOnOff(void); - void TestErrorOnOff(void); - void TestLogOnOff(void); - void TestDumpOnOff(void); - void TestSelOutOnOff(void); + void TestOutputFileOnOff(void); + void TestErrorFileOnOff(void); + void TestLogFileOnOff(void); + void TestDumpFileOnOff(void); + void TestSelOutFileOnOff(void); void TestLongHeadings(void); void TestDatabaseKeyword(); void TestDumpString(); @@ -107,7 +107,7 @@ public: void TestGetOutputStringLine(void); protected: - void TestOnOff(const char* FILENAME, int output_on, int error_on, int log_on, int selected_output_on, int dump_on); + 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); };