SqlStringAsciiTest Class Reference

Inheritance diagram for SqlStringAsciiTest:

TestBase TraceSource TraceTarget List of all members.

Public Member Functions

 SqlStringAsciiTest ()
virtual ~SqlStringAsciiTest ()
TestSuitereleaseTestSuite ()
void beforeTestCase (std::string testCaseName)
void afterTestCase (std::string testCaseName)
virtual void testCaseSetUp ()
 Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.
virtual void testCaseTearDown ()
 Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.
virtual void notifyTrace (std::string source, TraceLevel level, std::string message)
 Receives notification when a trace event occurs.
virtual TraceLevel getSourceTraceLevel (std::string source)
 Gets the level at which a particular source should be traced.
virtual void initTraceSource (SharedTraceTarget pTraceTarget, std::string name)
 For use when initialization has to be deferred until after construction.
void trace (TraceLevel level, std::string message) const
 Records a trace message.
bool isTracing () const
 
Returns:
true iff tracing is enabled for this source

bool isTracingLevel (TraceLevel level) const
 Determines whether a particular level is being traced.
TraceTargetgetTraceTarget () const
 
Returns:
the TraceTarget for this source

SharedTraceTarget getSharedTraceTarget () const
 
Returns:
the SharedTraceTarget for this source

std::string getTraceSourceName () const
 Gets the name of this source.
void setTraceSourceName (std::string const &n)
 Sets the name of this source.
TraceLevel getMinimumTraceLevel () const
void disableTracing ()

Static Public Member Functions

static void readParams (int argc, char **argv)
 Parses the command line.

Static Public Attributes

static ParamName paramTestSuiteName
static ParamName paramTraceFileName
static ParamName paramDictionaryFileName
static ParamName paramTraceLevel
static ParamName paramStatsFileName
static ParamName paramTraceStdout
static ParamName paramDegreeOfParallelism
static ConfigMap configMap
 Configuration parameters.

Protected Member Functions

void snooze (uint nSeconds)

Protected Attributes

TestSuitepTestSuite
 Boost test suite.
boost::shared_ptr< TestBasepTestObj
std::ofstream traceStream
 Output file stream for tracing.
StrictMutex traceMutex
 Protects traceStream.
std::string testName
 Name of test.
TraceLevel traceLevel
 Level at which to trace test execution.
FileStatsTarget statsTarget
 Output for stats.
StatsTimer statsTimer
 Timer for stats collection.
bool traceStdout
 Copy trace output to stdout.
bool traceFile
 Copy trace output to file.
TestCaseGroup defaultTests
TestCaseGroup extraTests

Static Protected Attributes

static bool runAll
 Run all test cases, including the extra tests.
static std::string runSingle
 Run only the test case of this name.

Private Member Functions

void testSqlStringBuffer_Ascii ()
void testSqlStringCat_Ascii_Fix ()
void testSqlStringCat_Ascii_Var ()
void testSqlStringCat_Ascii_Var2 ()
void testSqlStringCmp_Ascii_Fix_DiffLen ()
void testSqlStringCmp_Ascii_Fix_EqLen ()
void testSqlStringCmp_Ascii_Var_DiffLen ()
void testSqlStringCmp_Ascii_Var_EqLen ()
void testSqlStringLenBit_Ascii ()
void testSqlStringLenChar_Ascii ()
void testSqlStringLenOct_Ascii ()
void testSqlStringOverlay_Ascii ()
void testSqlStringPos_Ascii ()
void testSqlStringSubStr_Ascii ()
void testSqlStringToLower_Ascii ()
void testSqlStringToUpper_Ascii ()
void testSqlStringTrim_Ascii ()
void testSqlStringCmp_Ascii_Var_Helper (SqlStringBuffer &src1, int src1_len, SqlStringBuffer &src2, int src2_len)
void testSqlStringCmp_Ascii_Fix_Helper (SqlStringBuffer &src1, int src1_storage, int src1_len, SqlStringBuffer &src2, int src2_storage, int src2_len)
int testSqlStringNormalizeLexicalCmp (int v)

Detailed Description

Definition at line 52 of file SqlStringAsciiTest.cpp.


Constructor & Destructor Documentation

SqlStringAsciiTest::SqlStringAsciiTest (  )  [inline, explicit]

Definition at line 88 of file SqlStringAsciiTest.cpp.

References testSqlStringBuffer_Ascii(), testSqlStringCat_Ascii_Fix(), testSqlStringCat_Ascii_Var(), testSqlStringCat_Ascii_Var2(), testSqlStringCmp_Ascii_Fix_DiffLen(), testSqlStringCmp_Ascii_Fix_EqLen(), testSqlStringCmp_Ascii_Var_DiffLen(), testSqlStringCmp_Ascii_Var_EqLen(), testSqlStringLenBit_Ascii(), testSqlStringLenChar_Ascii(), testSqlStringLenOct_Ascii(), testSqlStringOverlay_Ascii(), testSqlStringPos_Ascii(), testSqlStringSubStr_Ascii(), testSqlStringToLower_Ascii(), testSqlStringToUpper_Ascii(), and testSqlStringTrim_Ascii().

00089         : TraceSource(shared_from_this(),"SqlStringAsciiTest")
00090     {
00091         srand(time(NULL));
00092         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringBuffer_Ascii);
00093         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringCat_Ascii_Fix);
00094         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringCat_Ascii_Var2);
00095         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringCat_Ascii_Var);
00096         FENNEL_UNIT_TEST_CASE(
00097             SqlStringAsciiTest, testSqlStringCmp_Ascii_Fix_DiffLen);
00098         FENNEL_UNIT_TEST_CASE(
00099             SqlStringAsciiTest, testSqlStringCmp_Ascii_Fix_EqLen);
00100         FENNEL_UNIT_TEST_CASE(
00101             SqlStringAsciiTest, testSqlStringCmp_Ascii_Var_DiffLen);
00102         FENNEL_UNIT_TEST_CASE(
00103             SqlStringAsciiTest, testSqlStringCmp_Ascii_Var_EqLen);
00104         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringLenBit_Ascii);
00105         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringLenChar_Ascii);
00106         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringLenOct_Ascii);
00107         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringOverlay_Ascii);
00108         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringPos_Ascii);
00109         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringSubStr_Ascii);
00110         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringToLower_Ascii);
00111         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringToUpper_Ascii);
00112         FENNEL_UNIT_TEST_CASE(SqlStringAsciiTest, testSqlStringTrim_Ascii);
00113     }

virtual SqlStringAsciiTest::~SqlStringAsciiTest (  )  [inline, virtual]

Definition at line 115 of file SqlStringAsciiTest.cpp.

00116     {
00117     }


Member Function Documentation

void SqlStringAsciiTest::testSqlStringBuffer_Ascii (  )  [private]

Definition at line 121 of file SqlStringAsciiTest.cpp.

References SqlStringBuffer::mBumperChar, SqlStringBuffer::mLeftP, SqlStringBuffer::mLeftPad, SqlStringBuffer::mRightBump, SqlStringBuffer::mRightP, SqlStringBuffer::mRightPad, SqlStringBuffer::mS, SqlStringBuffer::mSize, SqlStringBuffer::mStorage, SqlStringBuffer::mStr, SqlStringBuffer::randomize(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00122 {
00123     int storage, size, leftpad, rightpad;
00124     int leftbump = 2;
00125     int rightbump = 2;
00126     int k;
00127 
00128     for (storage = 0; storage <= 5; storage++) {
00129         for (size = 0; size <= storage; size++) {
00130             for (leftpad = 0; leftpad <= storage - size; leftpad++) {
00131                 rightpad = (storage - size) - leftpad;
00132 
00133                 SqlStringBuffer t(
00134                     storage, size,
00135                     leftpad, rightpad,
00136                     'x', ' ',
00137                     leftbump, rightbump);
00138 
00139                 BOOST_CHECK_EQUAL(t.mStorage, storage);
00140                 BOOST_CHECK_EQUAL(t.mSize, size);
00141                 BOOST_CHECK_EQUAL(t.mLeftPad, leftpad);
00142                 BOOST_CHECK_EQUAL(t.mRightPad, rightpad);
00143                 BOOST_CHECK_EQUAL(
00144                     static_cast<int>(t.mS.size()),
00145                     storage + leftbump + rightbump);
00146 
00147                 BOOST_CHECK(t.verify());
00148 
00149                 char *p = t.mLeftP;
00150                 // left bumper
00151                 for (k = 0; k < leftbump; k++) {
00152                     BOOST_CHECK_EQUAL(*(p++), SqlStringBuffer::mBumperChar);
00153                 }
00154                 BOOST_CHECK(p == t.mStr);
00155                 // left padding
00156                 for (k = 0; k < leftpad; k++) {
00157                     BOOST_CHECK_EQUAL(*(p++), ' ');
00158                 }
00159                 // text
00160                 for (k = 0; k < size; k++) {
00161                     BOOST_CHECK_EQUAL(*(p++), 'x');
00162                 }
00163                 // right padding
00164                 for (k = 0; k < rightpad; k++) {
00165                     BOOST_CHECK_EQUAL(*(p++), ' ');
00166                 }
00167                 BOOST_CHECK(p == t.mRightP);
00168                 // right bumper
00169                 for (k = 0; k < rightbump; k++) {
00170                     BOOST_CHECK_EQUAL(*(p++), SqlStringBuffer::mBumperChar);
00171                 }
00172                 BOOST_CHECK_EQUAL(
00173                     static_cast<int>(p - t.mLeftP),
00174                     storage + leftbump + rightbump);
00175 
00176                 BOOST_CHECK(t.verify());
00177 
00178                 for (k = 0; k < size; k++) {
00179                     *(t.mStr + k) = '0' + (k % 10);
00180                 }
00181                 BOOST_CHECK(t.verify());
00182 
00183                 *(t.mLeftP) = 'X';
00184                 BOOST_CHECK(!t.verify());
00185                 *(t.mLeftP) = SqlStringBuffer::mBumperChar;
00186                 BOOST_CHECK(t.verify());
00187 
00188                 *(t.mStr - 1) = 'X';
00189                 BOOST_CHECK(!t.verify());
00190                 *(t.mStr - 1) = SqlStringBuffer::mBumperChar;
00191                 BOOST_CHECK(t.verify());
00192 
00193                 *(t.mRightP) = 'X';
00194                 BOOST_CHECK(!t.verify());
00195                 *(t.mRightP) = SqlStringBuffer::mBumperChar;
00196                 BOOST_CHECK(t.verify());
00197 
00198                 *(t.mRightP + t.mRightBump - 1) = 'X';
00199                 BOOST_CHECK(!t.verify());
00200                 *(t.mRightP + t.mRightBump - 1) = SqlStringBuffer::mBumperChar;
00201                 BOOST_CHECK(t.verify());
00202 
00203                 t.randomize();
00204                 BOOST_CHECK(t.verify());
00205             }
00206         }
00207     }
00208 }

void SqlStringAsciiTest::testSqlStringCat_Ascii_Fix (  )  [private]

Definition at line 213 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::mStr, SqlStrCat_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00214 {
00215     int src1_storage, src2_storage, src3_storage, dst_storage;
00216     int src1_len, src2_len, src3_len;
00217     bool caught;
00218     int newlen = 0;
00219 
00220     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
00221         for (src1_storage = 0; src1_storage < MAXLEN; src1_storage++) {
00222             for (src1_len = 0; src1_len <= src1_storage; src1_len++) {
00223                 for (src2_storage = 0; src2_storage < MAXLEN; src2_storage++) {
00224                     for (src2_len = 0; src2_len <= src2_storage; src2_len++) {
00225                         for (src3_storage = 0; src3_storage < MAXLEN;
00226                              src3_storage++)
00227                         {
00228                             for (src3_len = 0; src3_len <= src3_storage;
00229                                  src3_len++)
00230                             {
00231                                 SqlStringBuffer dst(
00232                                     dst_storage, 0,
00233                                     0, dst_storage,
00234                                     'd', ' ');
00235                                 SqlStringBuffer src1(
00236                                     src1_storage, src1_len,
00237                                     0, src1_storage - src1_len,
00238                                     '1', ' ');
00239                                 SqlStringBuffer src2(
00240                                     src2_storage, src2_len,
00241                                     0, src2_storage - src2_len,
00242                                     '2', ' ');
00243                                 SqlStringBuffer src3(
00244                                     src3_storage, src3_len,
00245                                     0, src3_storage - src3_len,
00246                                     '3', ' ');
00247 
00248                                 caught = false;
00249                                 try {
00250                                     newlen = SqlStrCat_Ascii(
00251                                         dst.mStr, dst_storage,
00252                                         src1.mStr, src1_storage,
00253                                         src2.mStr, src2_storage);
00254                                 } catch (const char *str) {
00255                                     caught = true;
00256                                     BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
00257                                     BOOST_CHECK(
00258                                         src1_storage + src2_storage
00259                                         > dst_storage);
00260                                     BOOST_CHECK(dst.verify());
00261                                     BOOST_CHECK(src1.verify());
00262                                     BOOST_CHECK(src2.verify());
00263                                 } catch (...) {
00264                                     BOOST_CHECK(false);
00265                                 }
00266                                 if (!caught) {
00267                                     BOOST_CHECK(
00268                                         src1_storage + src2_storage
00269                                         <= dst_storage);
00270                                     BOOST_CHECK(dst.verify());
00271                                     BOOST_CHECK(src1.verify());
00272                                     BOOST_CHECK(src2.verify());
00273 
00274                                     caught = false;
00275                                     try {
00276                                         newlen = SqlStrCat_Ascii(
00277                                             dst.mStr,
00278                                             dst_storage,
00279                                             newlen,
00280                                             src3.mStr,
00281                                             src3_storage);
00282                                     } catch (const char *str) {
00283                                         caught = true;
00284                                         BOOST_CHECK_EQUAL(
00285                                             strcmp(str, "22001"),
00286                                             0);
00287                                         BOOST_CHECK(
00288                                             (src1_storage +
00289                                              src2_storage +
00290                                              src3_storage)
00291                                             > dst_storage);
00292                                         BOOST_CHECK(dst.verify());
00293                                         BOOST_CHECK(src1.verify());
00294                                         BOOST_CHECK(src2.verify());
00295                                         BOOST_CHECK(src3.verify());
00296                                     } catch (...) {
00297                                         BOOST_CHECK(false);
00298                                     }
00299                                     if (!caught) {
00300                                         BOOST_CHECK(dst.verify());
00301                                         BOOST_CHECK(src1.verify());
00302                                         BOOST_CHECK(src2.verify());
00303                                         BOOST_CHECK(src3.verify());
00304                                         BOOST_CHECK_EQUAL(
00305                                             newlen,
00306                                             (src1_storage +
00307                                              src2_storage +
00308                                              src3_storage));
00309 
00310                                         string result(dst.mStr, newlen);
00311                                         string expect(src1.mStr, src1_storage);
00312                                         expect.append(src2.mStr, src2_storage);
00313                                         expect.append(src3.mStr, src3_storage);
00314 
00315                                         BOOST_CHECK(!result.compare(expect));
00316                                     }
00317                                 }
00318                             }
00319                         }
00320                     }
00321                 }
00322             }
00323         }
00324     }
00325 
00326 }

void SqlStringAsciiTest::testSqlStringCat_Ascii_Var (  )  [private]

Definition at line 395 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::mStr, SqlStrCat_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00396 {
00397     int src_storage, dst_storage, src_len, dst_len;
00398     int newlen = 0;
00399     bool caught;
00400 
00401     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
00402         for (dst_len = 0; dst_len <= dst_storage; dst_len++) {
00403             for (src_storage = 0; src_storage < MAXLEN; src_storage++) {
00404                 for (src_len = 0; src_len <= src_storage; src_len++) {
00405                     SqlStringBuffer dst(
00406                         dst_storage, dst_len,
00407                         0, dst_storage - dst_len,
00408                         'd', ' ');
00409                     SqlStringBuffer src(
00410                         src_storage, src_len,
00411                         0, src_storage - src_len,
00412                         's', ' ');
00413                     caught = false;
00414                     try {
00415                         newlen = SqlStrCat_Ascii(
00416                             dst.mStr,
00417                             dst_storage,
00418                             dst_len,
00419                             src.mStr,
00420                             src_len);
00421                     } catch (const char *str) {
00422                         caught = true;
00423                         BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
00424                         BOOST_CHECK(src_len + dst_len > dst_storage);
00425                     } catch (...) {
00426                         BOOST_CHECK(false);
00427                     }
00428                     if (!caught) {
00429                         BOOST_CHECK(src_len + dst_len <= dst_storage);
00430                         BOOST_CHECK_EQUAL(newlen, src_len + dst_len);
00431 
00432                         string expect;
00433                         expect.append(dst_len, 'd');
00434                         expect.append(src_len, 's');
00435 
00436                         string result(dst.mStr, newlen);
00437 
00438                         BOOST_CHECK(!result.compare(expect));
00439                         BOOST_CHECK(!expect.compare(result));
00440                     }
00441                     BOOST_CHECK(dst.verify());
00442                     BOOST_CHECK(src.verify());
00443                 }
00444             }
00445         }
00446     }
00447 }

void SqlStringAsciiTest::testSqlStringCat_Ascii_Var2 (  )  [private]

Definition at line 330 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::mStr, SqlStrCat_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00331 {
00332     int src1_storage, src2_storage, dst_storage, src1_len, src2_len;
00333     int newlen = 0;
00334     bool caught;
00335 
00336     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
00337         for (src1_storage = 0; src1_storage < MAXLEN; src1_storage++) {
00338             for (src1_len = 0; src1_len <= src1_storage; src1_len++) {
00339                 for (src2_storage = 0; src2_storage < MAXLEN; src2_storage++) {
00340                     for (src2_len = 0; src2_len <= src2_storage; src2_len++) {
00341                         SqlStringBuffer dst(
00342                             dst_storage, 0,
00343                             0, dst_storage,
00344                             'd', ' ');
00345                         SqlStringBuffer src1(
00346                             src1_storage, src1_len,
00347                             0, src1_storage - src1_len,
00348                             's', ' ');
00349                         SqlStringBuffer src2(
00350                             src2_storage, src2_len,
00351                             0, src2_storage - src2_len,
00352                             'S', ' ');
00353 
00354                         caught = false;
00355                         try {
00356                             newlen = SqlStrCat_Ascii(
00357                                 dst.mStr,
00358                                 dst_storage,
00359                                 src1.mStr,
00360                                 src1_len,
00361                                 src2.mStr,
00362                                 src2_len);
00363                         } catch (const char *str) {
00364                             caught = true;
00365                             BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
00366                             BOOST_CHECK(src1_len + src2_len > dst_storage);
00367                         } catch (...) {
00368                             BOOST_CHECK(false);
00369                         }
00370                         if (!caught) {
00371                             BOOST_CHECK(src1_len + src2_len <= dst_storage);
00372                             BOOST_CHECK_EQUAL(newlen, src1_len + src2_len);
00373 
00374                             string expect;
00375                             expect.append(src1_len, 's');
00376                             expect.append(src2_len, 'S');
00377 
00378                             string result(dst.mStr, newlen);
00379 
00380                             BOOST_CHECK(!result.compare(expect));
00381                             BOOST_CHECK(!expect.compare(result));
00382                         }
00383                         BOOST_CHECK(dst.verify());
00384                         BOOST_CHECK(src1.verify());
00385                         BOOST_CHECK(src2.verify());
00386                     }
00387                 }
00388             }
00389         }
00390     }
00391 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_DiffLen (  )  [private]

Definition at line 521 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::patternfill(), and testSqlStringCmp_Ascii_Fix_Helper().

Referenced by SqlStringAsciiTest().

00522 {
00523     int src1_storage, src2_storage, src1_len, src2_len;
00524     unsigned char startchar;
00525 
00526     for (src1_storage = 0; src1_storage <= MAXLEN; src1_storage++) {
00527         for (src1_len = 0; src1_len < src1_storage; src1_len++) {
00528             for (src2_storage = 0; src2_storage <= MAXLEN; src2_storage++) {
00529                 for (src2_len = 0; src2_len < src2_storage; src2_len++) {
00530                     // can't test w/ 0, confuses strcmp and/or std:string
00531                     for (startchar = 1; startchar < 255; startchar++) {
00532                         SqlStringBuffer src1(
00533                             src1_storage, src1_len,
00534                             0, src1_storage - src1_len,
00535                             'd', ' ');
00536                         SqlStringBuffer src2(
00537                             src2_storage, src2_len,
00538                             0, src2_storage - src2_len,
00539                             's', ' ');
00540 
00541                         src1.patternfill(startchar, 1, 255);
00542                         src2.patternfill(startchar, 1, 255);
00543 
00544                         testSqlStringCmp_Ascii_Fix_Helper(
00545                             src1, src1_storage, src1_len,
00546                             src2, src2_storage, src2_len);
00547                     }
00548                 }
00549             }
00550         }
00551     }
00552 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_EqLen (  )  [private]

Definition at line 556 of file SqlStringAsciiTest.cpp.

References MAXCMPLEN, MAXCMPRANDOM, SqlStringBuffer::randomize(), and testSqlStringCmp_Ascii_Fix_Helper().

Referenced by SqlStringAsciiTest().

00557 {
00558     int src1_storage, src2_storage, src1_len, src2_len, randX;
00559 
00560     // not much point large length, chances of 2 random strings being equal
00561     // are very low. test forces an equality check anyway.
00562     src1_storage = MAXCMPLEN;
00563     src2_storage = MAXCMPLEN;
00564     for (src1_len = 0; src1_len < src1_storage; src1_len++) {
00565         src2_len = src1_len;
00566         for (randX = 0; randX <= MAXCMPRANDOM; randX++) {
00567             SqlStringBuffer src1(
00568                 src1_storage, src1_len,
00569                 0, src1_storage - src1_len,
00570                 'd', ' ');
00571             SqlStringBuffer src2(
00572                 src2_storage, src2_len,
00573                 0, src2_storage - src2_len,
00574                 's', ' ');
00575 
00576             // can't test w/ 0, confuses strcmp and/or std:string
00577             src1.randomize(1, 1, 255);
00578             src2.randomize(1, 1, 255);
00579 
00580             testSqlStringCmp_Ascii_Fix_Helper(
00581                 src1, src1_storage, src1_len,
00582                 src2, src2_storage, src2_len);
00583         }
00584     }
00585 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_DiffLen (  )  [private]

Definition at line 641 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::patternfill(), and testSqlStringCmp_Ascii_Var_Helper().

Referenced by SqlStringAsciiTest().

00642 {
00643     int src1_storage, src2_storage, src1_len, src2_len;
00644     unsigned char startchar;
00645 
00646     for (src1_storage = 0; src1_storage <= MAXLEN; src1_storage++) {
00647         src1_len = src1_storage;
00648         for (src2_storage = 0; src2_storage <= MAXLEN; src2_storage++) {
00649             src2_len = src2_storage;
00650             // can't test w/ 0, confuses strcmp and/or std:string
00651             for (startchar = 1; startchar < 255; startchar++) {
00652                 SqlStringBuffer src1(
00653                     src1_storage, src1_len,
00654                     0, src1_storage - src1_len,
00655                     'd', ' ');
00656                 SqlStringBuffer src2(
00657                     src2_storage, src2_len,
00658                     0, src2_storage - src2_len,
00659                     's', ' ');
00660 
00661                 src1.patternfill(startchar, 1, 255);
00662                 src2.patternfill(startchar, 1, 255);
00663 
00664                 testSqlStringCmp_Ascii_Var_Helper(
00665                     src1, src1_len,
00666                     src2, src2_len);
00667             }
00668         }
00669     }
00670 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_EqLen (  )  [private]

Definition at line 674 of file SqlStringAsciiTest.cpp.

References MAXCMPLEN, MAXCMPRANDOM, SqlStringBuffer::randomize(), and testSqlStringCmp_Ascii_Var_Helper().

Referenced by SqlStringAsciiTest().

00675 {
00676     int src1_storage, src2_storage, src1_len, src2_len, randX;
00677 
00678     // not much point large length, chances of 2 random strings being equal
00679     // are very low. test forces an equality check anyway.
00680     src1_storage = MAXCMPLEN;
00681     src1_len = src1_storage;
00682     src2_storage = src1_storage;
00683     src2_len = src1_storage;
00684     for (randX = 0; randX <= MAXCMPRANDOM; randX++) {
00685         SqlStringBuffer src1(
00686             src1_storage, src1_len,
00687             0, src1_storage - src1_len,
00688             'd', ' ');
00689         SqlStringBuffer src2(
00690             src2_storage, src2_len,
00691             0, src2_storage - src2_len,
00692             's', ' ');
00693 
00694         // can't test w/ 0, confuses strcmp and/or std:string
00695         src1.randomize(1, 1, 255);
00696         src2.randomize(1, 1, 255);
00697 
00698         testSqlStringCmp_Ascii_Var_Helper(
00699             src1, src1_len,
00700             src2, src2_len);
00701     }
00702 }

void SqlStringAsciiTest::testSqlStringLenBit_Ascii (  )  [private]

Definition at line 706 of file SqlStringAsciiTest.cpp.

References MAXLEN, and SqlStrLenBit_Ascii().

Referenced by SqlStringAsciiTest().

00707 {
00708     int src_storage, src_len;
00709     int newlen = 0;
00710 
00711     src_storage = MAXLEN;
00712     for (src_storage = 0; src_storage <= MAXLEN; src_storage++) {
00713         for (src_len = 0; src_len <= src_storage; src_len++) {
00714             SqlStringBuffer src(
00715                 src_storage, src_len,
00716                 0, src_storage - src_len,
00717                 's', ' ');
00718 
00719             newlen = SqlStrLenBit_Ascii(
00720                 src.mStr,
00721                 src_len);
00722             BOOST_CHECK_EQUAL(newlen, src_len * 8);
00723             BOOST_CHECK(src.verify());
00724 
00725             newlen = SqlStrLenBit_Ascii(
00726                 src.mStr,
00727                 src_storage);
00728             BOOST_CHECK_EQUAL(newlen, src_storage * 8);
00729             BOOST_CHECK(src.verify());
00730         }
00731     }
00732 }

void SqlStringAsciiTest::testSqlStringLenChar_Ascii (  )  [private]

Definition at line 736 of file SqlStringAsciiTest.cpp.

References MAXLEN, and SqlStrLenChar_Ascii().

Referenced by SqlStringAsciiTest().

00737 {
00738     int src_storage, src_len;
00739     int newlen = 0;
00740 
00741     src_storage = MAXLEN;
00742     for (src_storage = 0; src_storage <= MAXLEN; src_storage++) {
00743         for (src_len = 0; src_len <= src_storage; src_len++) {
00744             SqlStringBuffer src(
00745                 src_storage, src_len,
00746                 0, src_storage - src_len,
00747                 's', ' ');
00748 
00749             newlen = SqlStrLenChar_Ascii(
00750                 src.mStr,
00751                 src_len);
00752             BOOST_CHECK_EQUAL(newlen, src_len);
00753             BOOST_CHECK(src.verify());
00754 
00755             newlen = SqlStrLenChar_Ascii(
00756                 src.mStr,
00757                 src_storage);
00758             BOOST_CHECK_EQUAL(newlen, src_storage);
00759             BOOST_CHECK(src.verify());
00760         }
00761     }
00762 }

void SqlStringAsciiTest::testSqlStringLenOct_Ascii (  )  [private]

Definition at line 766 of file SqlStringAsciiTest.cpp.

References MAXLEN, and SqlStrLenOct_Ascii().

Referenced by SqlStringAsciiTest().

00767 {
00768     int src_storage, src_len;
00769     int newlen = 0;
00770 
00771     src_storage = MAXLEN;
00772     for (src_storage = 0; src_storage <= MAXLEN; src_storage++) {
00773         for (src_len = 0; src_len <= src_storage; src_len++) {
00774             SqlStringBuffer src(
00775                 src_storage, src_len,
00776                 0, src_storage - src_len,
00777                 's', ' ');
00778 
00779             newlen = SqlStrLenOct_Ascii(
00780                 src.mStr,
00781                 src_len);
00782             BOOST_CHECK_EQUAL(newlen, src_len);
00783             BOOST_CHECK(src.verify());
00784 
00785             newlen = SqlStrLenOct_Ascii(
00786                 src.mStr,
00787                 src_storage);
00788             BOOST_CHECK_EQUAL(newlen, src_storage);
00789             BOOST_CHECK(src.verify());
00790         }
00791     }
00792 }

void SqlStringAsciiTest::testSqlStringOverlay_Ascii (  )  [private]

Definition at line 796 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::mStr, SqlStringBuffer::patternfill(), SqlStrOverlay_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00797 {
00798     int dst_storage, src_storage, src_len, over_storage, over_len;
00799     int position, length, lengthI;
00800     int exLeftLen, exMidLen, exRightLen;
00801     char *exLeftP, *exMidP, *exRightP;
00802     bool lenSpecified;
00803     bool caught;
00804     int newlen = 0;
00805 
00806     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
00807         for (src_storage = 0; src_storage < MAXLEN; src_storage++) {
00808             src_len = src_storage;
00809             for (over_storage = 0; over_storage < MAXLEN; over_storage++) {
00810                 over_len = over_storage;
00811                 for (position = 0; position < MAXLEN; position++) {
00812                     for (lengthI = -1; lengthI < MAXLEN; lengthI++) {
00813                         if (lengthI == -1) {
00814                             lenSpecified = false;
00815                             length = over_len;
00816                         } else {
00817                             lenSpecified = true;
00818                             length = lengthI;
00819                         }
00820 #if 0
00821                         BOOST_MESSAGE(
00822                             " dst_storage=" << dst_storage <<
00823                             " src_storage=" << src_storage <<
00824                             " over_storage=" << over_storage <<
00825                             " pos=" << position <<
00826                             " length=" << length <<
00827                             " spec=" << lenSpecified);
00828 #endif
00829                         SqlStringBuffer dst(
00830                             dst_storage, dst_storage,
00831                             0, 0,
00832                             'd', ' ');
00833                         SqlStringBuffer src(
00834                             src_storage, src_len,
00835                             0, src_storage - src_len,
00836                             's', ' ');
00837                         SqlStringBuffer over(
00838                             over_storage, over_len,
00839                             0, over_storage - over_len,
00840                             'o', ' ');
00841 
00842                         src.patternfill('a', 'a', 'z');
00843                         over.patternfill('A', 'A', 'Z');
00844 
00845                         // ex* vars are 0-indexed. for loops are 1-indexed
00846                         exLeftP = src.mStr;
00847                         if (position >= 1 && src_len >= 1) {
00848                             exLeftLen = position - 1;  // 1-idx -> 0-idx
00849                             if (exLeftLen > src_len) {
00850                                 exLeftLen = src_len;
00851                             }
00852                         } else {
00853                             exLeftLen = 0;
00854                         }
00855 
00856                         exMidP = over.mStr;
00857                         exMidLen = over_len;
00858 
00859                         exRightLen = src_len - (exLeftLen + length);
00860                         if (exRightLen < 0) {
00861                             exRightLen = 0;
00862                         }
00863                         exRightP = exLeftP + (src_len - exRightLen);
00864 
00865                         string expect(exLeftP, exLeftLen);
00866                         expect.append(exMidP, exMidLen);
00867                         expect.append(exRightP, exRightLen);
00868 
00869                         caught = false;
00870                         try {
00871                             newlen = SqlStrOverlay_Ascii(
00872                                 dst.mStr,
00873                                 dst_storage,
00874                                 src.mStr,
00875                                 src_len,
00876                                 over.mStr,
00877                                 over_len,
00878                                 position,
00879                                 length,
00880                                 lenSpecified);
00881                         } catch (const char *str) {
00882                             caught = true;
00883                             if (!strcmp(str, "22011")) {
00884                                 BOOST_CHECK(
00885                                     position < 1
00886                                     || (lenSpecified && length < 1));
00887                             } else if (!strcmp(str, "22001")) {
00888                                 BOOST_CHECK(src_len + over_len > dst_storage);
00889                             } else {
00890                                 BOOST_CHECK(false);
00891                             }
00892                         }
00893                         if (!caught) {
00894                             BOOST_CHECK(position > 0);
00895                             if (lenSpecified) {
00896                                 BOOST_CHECK(length >= 0);
00897                             }
00898 
00899                             BOOST_CHECK(dst.verify());
00900                             BOOST_CHECK(src.verify());
00901                             BOOST_CHECK(over.verify());
00902 
00903                             string result(dst.mStr, newlen);
00904 
00905                             BOOST_CHECK(!result.compare(expect));
00906                             BOOST_CHECK(!expect.compare(result));
00907                         }
00908                     }
00909                 }
00910             }
00911         }
00912     }
00913 }

void SqlStringAsciiTest::testSqlStringPos_Ascii (  )  [private]

Definition at line 916 of file SqlStringAsciiTest.cpp.

References MAXLEN, MAXRANDOM, SqlStringBuffer::mStr, and SqlStrPos_Ascii().

Referenced by SqlStringAsciiTest().

00917 {
00918     int src_storage, find_start, find_len, randX;
00919     int alter_char;
00920 
00921     int foundpos;
00922 
00923     for (src_storage = 0; src_storage < MAXLEN; src_storage++) {
00924         for (randX = 0; randX < MAXRANDOM; randX++) {
00925             SqlStringBuffer src(
00926                 src_storage, src_storage,
00927                 0, 0,
00928                 's', ' ');
00929             src.randomize('a', 'a', 'z');
00930 
00931             // find all possible valid substrings
00932             for (find_start = 0; find_start <= src_storage; find_start++) {
00933                 for (find_len = 0; find_len <= src_storage - find_start;
00934                      find_len++)
00935                 {
00936                     string validsubstr(src.mStr + find_start, find_len);
00937                     SqlStringBuffer find(
00938                         find_len, find_len,
00939                         0, 0,
00940                         'X', ' ');
00941                     memcpy(find.mStr, validsubstr.c_str(), find_len);
00942 
00943                     foundpos = SqlStrPos_Ascii(
00944                         src.mStr,
00945                         src_storage,
00946                         find.mStr,
00947                         find_len);
00948                     BOOST_CHECK(src.verify());
00949                     BOOST_CHECK(find.verify());
00950 
00951                     if (find_len) {
00952                         // foundpos is 1-indexed. find_start is 0-indexed.
00953                         BOOST_CHECK_EQUAL(foundpos, find_start + 1);
00954                     } else {
00955                         BOOST_CHECK_EQUAL(
00956                             foundpos, static_cast<int>(1));  // Case A.
00957                     }
00958 
00959                     // alter valid substring to prevent match
00960                     for (alter_char = 0; alter_char < find_len; alter_char++) {
00961                         char save = *(find.mStr + alter_char);
00962                         // 'X' not between 'a' and 'z'
00963                         *(find.mStr + alter_char) = 'X';
00964 
00965                         foundpos  = SqlStrPos_Ascii(
00966                             src.mStr,
00967                             src_storage,
00968                             find.mStr,
00969                             find_len);
00970                         BOOST_CHECK(src.verify());
00971                         BOOST_CHECK(find.verify());
00972 
00973                         BOOST_CHECK_EQUAL(foundpos, static_cast<int>(0));
00974 
00975                         *(find.mStr + alter_char) = save;
00976                     }
00977                 }
00978             }
00979         }
00980     }
00981 }

void SqlStringAsciiTest::testSqlStringSubStr_Ascii (  )  [private]

Definition at line 984 of file SqlStringAsciiTest.cpp.

References MAXLEN, SqlStringBuffer::mLeftP, SqlStringBuffer::mStr, SqlStringBuffer::randomize(), SqlStrSubStr_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

00985 {
00986     int src_storage, src_len, dst_storage, newlen = 0;
00987     int sub_start, sub_len;
00988     bool caught;
00989     char const * resultP;
00990 
00991     // must test where substart and/or sublen larger than src_storage and
00992     // less than 0
00993 
00994     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
00995         for (src_storage = 0; src_storage <= dst_storage; src_storage++) {
00996             for (src_len = 0; src_len <= src_storage; src_len++) {
00997                 for (sub_start = -3; sub_start <= 3 + src_storage;
00998                      sub_start++)
00999                 {
01000                     for (sub_len = -3; sub_len <= 3 + src_storage; sub_len++) {
01001                         SqlStringBuffer dst(
01002                             dst_storage, dst_storage,
01003                             0, 0,
01004                             'd', ' ');
01005                         SqlStringBuffer src(
01006                             src_storage, src_len,
01007                             0, src_storage - src_len,
01008                             's', ' ');
01009                         src.randomize();
01010 #if 0
01011                         BOOST_MESSAGE(
01012                             "src =|" << src.mLeftP <<
01013                             "| dest_storage=" << dst_storage <<
01014                             " src_storage=" << src_storage <<
01015                             " src_len=" << src_len <<
01016                             " sub_start=" << sub_start <<
01017                             " sub_len=" << sub_len);
01018 #endif
01019                         int exsubstart = sub_start;
01020                         int exlen = sub_len;
01021                         if (exsubstart < 1) {
01022                             // will grab fewer characters
01023                             exlen += (exsubstart - 1);
01024                         }
01025                         exsubstart--;                       // convert index
01026                         if (exsubstart < 0) {
01027                             exsubstart = 0; // clean up for std::string
01028                         }
01029                         if (exlen < 0) {
01030                             exlen = 0;           // clean up for std::string
01031                         }
01032 
01033                         if (exsubstart + exlen > src_storage) {
01034                             if (exsubstart > src_storage) {
01035                                 exlen = 0;
01036                             } else {
01037                                 exlen = src_storage - exsubstart;
01038                             }
01039                         }
01040                         if (exsubstart < 0) {
01041                             exsubstart = 0; // clean up for std::string
01042                         }
01043                         if (exlen < 0) {
01044                             exlen = 0;           // clean up for std::string
01045                         }
01046 
01047                         string expect(src.mStr + exsubstart, exlen);
01048 
01049                         caught = false;
01050                         try {
01051                             newlen = SqlStrSubStr_Ascii(
01052                                 &resultP, dst_storage,
01053                                 src.mStr, src_storage,
01054                                 sub_start, sub_len, true);
01055                         } catch (const char *str) {
01056                             caught = true;
01057                             if (!strcmp(str, "22011")) {
01058                                 BOOST_CHECK(sub_len < 0);
01059                             } else if (!strcmp(str, "22001")) {
01060                                 BOOST_CHECK(sub_len > dst_storage);
01061                                 BOOST_CHECK(sub_len >= 0);
01062                             } else {
01063                                 BOOST_CHECK(false);
01064                             }
01065                         }
01066                         if (!caught) {
01067                             BOOST_CHECK(sub_len >= 0);
01068                             string result(resultP, newlen);
01069 #if 0
01070                             BOOST_MESSAGE("expect |" << expect << "|");
01071                             BOOST_MESSAGE("result |" << result << "|");
01072 #endif
01073                             BOOST_CHECK(!result.compare(expect));
01074                             BOOST_CHECK(!expect.compare(result));
01075                         }
01076                         BOOST_CHECK(dst.verify());
01077                         BOOST_CHECK(src.verify());
01078 
01079                         // length unspecified mode
01080                         // test when length is at or past the storage
01081                         if (sub_start > 0 && sub_len > 0 &&
01082                             sub_start + sub_len - 1 > src_storage) {
01083                             caught = false;
01084                             try {
01085                                 newlen = SqlStrSubStr_Ascii(
01086                                     &resultP, dst_storage,
01087                                     src.mStr, src_storage,
01088                                     sub_start, 0, false);
01089                             } catch (const char *str) {
01090                                 caught = true;
01091                                 if (!strcmp(str, "22011")) {
01092                                     BOOST_CHECK(sub_len < 0);
01093                                 } else if (!strcmp(str, "22001")) {
01094                                     BOOST_CHECK(sub_len > dst_storage);
01095                                 } else {
01096                                     BOOST_CHECK(false);
01097                                 }
01098                             }
01099                             if (!caught) {
01100                                 // BOOST_MESSAGE(
01101                                 //     " len=" << sub_len
01102                                 //     << " start=" << sub_start);
01103                                 string result(resultP, newlen);
01104 #if 0
01105                                 BOOST_MESSAGE("expect |" << expect << "|");
01106                                 BOOST_MESSAGE("result |" << result << "|");
01107 #endif
01108                                 BOOST_CHECK(!result.compare(expect));
01109                                 BOOST_CHECK(!expect.compare(result));
01110                             }
01111                             BOOST_CHECK(dst.verify());
01112                             BOOST_CHECK(src.verify());
01113                         }
01114                     }
01115                 }
01116             }
01117         }
01118     }
01119 }

void SqlStringAsciiTest::testSqlStringToLower_Ascii (  )  [private]

Definition at line 1122 of file SqlStringAsciiTest.cpp.

References count(), MAXLEN, MAXRANDOM, SqlStringBuffer::mStr, SqlStringBuffer::randomize(), SqlStrToLower_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

01123 {
01124     int dest_storage, dest_len, src_storage, src_len, randX;
01125     int newlen = 0;
01126     bool caught;
01127 
01128     for (dest_storage = 0; dest_storage < MAXLEN; dest_storage++) {
01129         dest_len = dest_storage;
01130         for (src_storage = 0; src_storage < MAXLEN; src_storage++) {
01131             src_len = src_storage;
01132             for (randX = 0; randX < MAXRANDOM; randX++) {
01133                 SqlStringBuffer dest(
01134                     dest_storage, dest_len,
01135                     0, 0,
01136                     'd', ' ');
01137                 SqlStringBuffer src(
01138                     src_storage, src_len,
01139                     0, src_storage - src_len,
01140                     's', ' ');
01141                 src.randomize('A');
01142 
01143                 string save(src.mStr, src_len);
01144                 string::iterator itr;
01145                 char const *s;
01146                 int count;
01147 
01148                 // copy
01149                 caught = false;
01150                 try {
01151                     newlen = SqlStrToLower_Ascii(
01152                         dest.mStr, dest_storage, src.mStr, src_len);
01153                 } catch (const char *str) {
01154                     caught = true;
01155                     BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
01156                     BOOST_CHECK(src_len > dest_storage);
01157                 } catch (...) {
01158                     BOOST_CHECK(false);
01159                 }
01160                 if (!caught) {
01161                     BOOST_CHECK(src_len <= dest_storage);
01162                     BOOST_CHECK(src.verify());
01163                     BOOST_CHECK(dest.verify());
01164                     BOOST_CHECK_EQUAL(newlen, src_len);
01165 
01166                     itr = save.begin();
01167                     s = dest.mStr;
01168                     count = 0;
01169                     while (itr != save.end()) {
01170                         if (*itr >= 'A' && *itr <= 'Z') {
01171                             BOOST_CHECK_EQUAL(*s, (*itr + ('a' - 'A')));
01172                         } else {
01173                             BOOST_CHECK_EQUAL(*itr, *s);
01174                         }
01175                         s++;
01176                         itr++;
01177                         count++;
01178                     }
01179                     BOOST_CHECK_EQUAL(count, src_len);
01180                 }
01181             }
01182         }
01183     }
01184 }

void SqlStringAsciiTest::testSqlStringToUpper_Ascii (  )  [private]

Definition at line 1188 of file SqlStringAsciiTest.cpp.

References count(), MAXLEN, MAXRANDOM, SqlStringBuffer::mStr, SqlStringBuffer::randomize(), SqlStrToUpper_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

01189 {
01190     int dest_storage, dest_len, src_storage, src_len, randX;
01191     int newlen = 0;
01192     bool caught;
01193 
01194 
01195     for (dest_storage = 0; dest_storage < MAXLEN; dest_storage++) {
01196         dest_len = dest_storage;
01197         for (src_storage = 0; src_storage < MAXLEN; src_storage++) {
01198             src_len = src_storage;
01199             for (randX = 0; randX < MAXRANDOM; randX++) {
01200                 SqlStringBuffer dest(
01201                     dest_storage, dest_len,
01202                     0, 0,
01203                     'd', ' ');
01204                 SqlStringBuffer src(
01205                     src_storage, src_len,
01206                     0, src_storage - src_len,
01207                     's', ' ');
01208                 src.randomize('a');
01209 
01210                 string save(src.mStr, src_len);
01211                 string::iterator itr;
01212                 char const *s;
01213                 int count;
01214 
01215                 // copy
01216                 caught = false;
01217                 try {
01218                     newlen = SqlStrToUpper_Ascii(
01219                         dest.mStr, dest_storage, src.mStr, src_len);
01220                 } catch (const char *str) {
01221                     caught = true;
01222                     BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
01223                     BOOST_CHECK(src_len > dest_storage);
01224                 } catch (...) {
01225                     BOOST_CHECK(false);
01226                 }
01227                 if (!caught) {
01228                     BOOST_CHECK(src_len <= dest_storage);
01229                     BOOST_CHECK(src.verify());
01230                     BOOST_CHECK(dest.verify());
01231                     BOOST_CHECK_EQUAL(newlen, src_len);
01232 
01233                     itr = save.begin();
01234                     s = dest.mStr;
01235                     count = 0;
01236 
01237                     while (itr != save.end()) {
01238                         if (*itr >= 'a' && *itr <= 'z') {
01239                             BOOST_CHECK_EQUAL(*s, (*itr - ('a' - 'A')));
01240                         } else {
01241                             BOOST_CHECK_EQUAL(*itr, *s);
01242                         }
01243                         s++;
01244                         itr++;
01245                         count++;
01246                     }
01247                     BOOST_CHECK_EQUAL(count, src_len);
01248                 }
01249             }
01250         }
01251     }
01252 }

void SqlStringAsciiTest::testSqlStringTrim_Ascii (  )  [private]

Definition at line 1255 of file SqlStringAsciiTest.cpp.

References MAXLEN, MAXRANDOM, SqlStringBuffer::mStr, SqlStrTrim_Ascii(), and SqlStringBuffer::verify().

Referenced by SqlStringAsciiTest().

01256 {
01257     int dst_storage, src_storage, src_len, leftpad, rightpad, randX, i;
01258     char padchar = ' ';
01259     char textchar = 's';
01260     bool caught;
01261 
01262     BOOST_REQUIRE(MAXLEN >= 5); // 2 pad + 1 text + 2 pad
01263 
01264     for (dst_storage = 0; dst_storage < MAXLEN; dst_storage++) {
01265         for (src_storage = 0; src_storage < dst_storage + 5; src_storage++) {
01266             for (src_len = 0; src_len <= src_storage; src_len++) {
01267                 for (leftpad = 0; leftpad <= src_storage - src_len; leftpad++) {
01268                     rightpad = src_storage - (src_len + leftpad);
01269                     for (randX = 0; randX < MAXRANDOM; randX++) {
01270                         BOOST_REQUIRE(
01271                            leftpad + rightpad + src_len == src_storage);
01272                         for (i = 0; i < 4; i++) {
01273                             int newsize;
01274                             int expectsize;
01275                             string resultByReference;
01276                             string resultCopy;
01277                             string expect;
01278                             SqlStringBuffer src(
01279                                 src_storage, src_len,
01280                                 leftpad, rightpad,
01281                                 textchar, padchar);
01282                             SqlStringBuffer dst(
01283                                 dst_storage, dst_storage,
01284                                 0, 0,
01285                                 textchar, padchar);
01286 
01287                             int lefttrim = false, righttrim = false;
01288                             switch (i) {
01289                             case 0:
01290                                 lefttrim = true;
01291                                 righttrim = true;
01292                                 expect.append(src_len, textchar);
01293                                 expectsize = src_len;
01294                                 break;
01295                             case 1:
01296                                 lefttrim = true;
01297                                 righttrim = false;
01298                                 expect.append(src_len, textchar);
01299                                 // if no text, everything is trimmed
01300                                 if (src_len) {
01301                                     expect.append(rightpad, padchar);
01302                                 }
01303                                 expectsize = src_len + (src_len ? rightpad : 0);
01304                                 break;
01305                             case 2:
01306                                 lefttrim = false;
01307                                 righttrim = true;
01308                                 // if no text, everything is trimmed
01309                                 if (src_len) {
01310                                     expect.append(leftpad, padchar);
01311                                 }
01312                                 expect.append(src_len, textchar);
01313                                 expectsize = src_len + (src_len ? leftpad : 0);
01314                                 break;
01315                             case 3:
01316                                 lefttrim = false;
01317                                 righttrim = false;
01318                                 expect.append(leftpad, padchar);
01319                                 expect.append(src_len, textchar);
01320                                 expect.append(rightpad, padchar);
01321                                 expectsize = src_len + leftpad + rightpad;
01322                                 break;
01323                             }
01324 
01325                             // test copy implementation
01326                             caught = false;
01327                             try {
01328                                 newsize =
01329                                     SqlStrTrim_Ascii(
01330                                         dst.mStr,
01331                                         dst_storage,
01332                                         src.mStr,
01333                                         src_len + leftpad + rightpad,
01334                                         lefttrim,
01335                                         righttrim);
01336                             } catch (const char *str) {
01337                                 caught = true;
01338                                 BOOST_CHECK_EQUAL(strcmp(str, "22001"), 0);
01339                                 BOOST_CHECK(expectsize > dst_storage);
01340                             } catch (...) {
01341                                 BOOST_CHECK(false);
01342                             }
01343 
01344                             if (!caught) {
01345                                 BOOST_CHECK(expectsize <= dst_storage);
01346 
01347                                 BOOST_CHECK(src.verify());
01348                                 BOOST_CHECK(dst.verify());
01349                                 BOOST_CHECK_EQUAL(newsize, expectsize);
01350                                 resultCopy = string(dst.mStr, newsize);
01351 
01352                                 BOOST_CHECK(!resultCopy.compare(expect));
01353                                 BOOST_CHECK(!expect.compare(resultCopy));
01354                             }
01355 
01356 
01357                             // test by reference
01358                             char const * start;
01359                             newsize = SqlStrTrim_Ascii(
01360                                 &start,
01361                                 src.mStr,
01362                                 src_len + leftpad + rightpad,
01363                                 lefttrim,
01364                                 righttrim);
01365 
01366                             BOOST_CHECK(start >= src.mStr);
01367                             BOOST_CHECK(start <= src.mStr + src_storage);
01368                             BOOST_CHECK(src.verify());
01369                             BOOST_CHECK(dst.verify());
01370                             BOOST_CHECK_EQUAL(newsize, expectsize);
01371                             resultByReference = string(start, newsize);
01372 
01373                             BOOST_CHECK(!resultByReference.compare(expect));
01374                             BOOST_CHECK(!expect.compare(resultByReference));
01375                         }
01376                     }
01377                 }
01378             }
01379         }
01380     }
01381 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Var_Helper ( SqlStringBuffer src1,
int  src1_len,
SqlStringBuffer src2,
int  src2_len 
) [private]

Definition at line 589 of file SqlStringAsciiTest.cpp.

References SqlStringBuffer::mStr, SqlStrCmp_Ascii_Var(), testSqlStringNormalizeLexicalCmp(), and SqlStringBuffer::verify().

Referenced by testSqlStringCmp_Ascii_Var_DiffLen(), and testSqlStringCmp_Ascii_Var_EqLen().

00594 {
00595     int result;
00596 
00597     string s1(src1.mStr, src1_len);
00598     string s2(src2.mStr, src2_len);
00599 
00600     int expected = testSqlStringNormalizeLexicalCmp(s1.compare(s2));
00601     char const * const s1p = s1.c_str();
00602     char const * const s2p = s2.c_str();
00603     int expected2 = testSqlStringNormalizeLexicalCmp(strcmp(s1p, s2p));
00604     BOOST_CHECK_EQUAL(expected, expected2);
00605 
00606 
00607     result = SqlStrCmp_Ascii_Var(
00608         src1.mStr, src1_len,
00609         src2.mStr, src2_len);
00610     BOOST_CHECK(src1.verify());
00611     BOOST_CHECK(src2.verify());
00612 
00613 #if 0
00614     BOOST_MESSAGE(" src1=|" << s1 << "|" <<
00615                   " src2=|" << s2 << "|" <<
00616                   " expect=" << expected <<
00617                   " expect2=" << expected2 <<
00618                   " result=" << result);
00619 #endif
00620     BOOST_CHECK_EQUAL(result, expected);
00621 
00622     // check the exact opposite, even if equal
00623     int result2 = SqlStrCmp_Ascii_Var(
00624         src2.mStr, src2_len,
00625         src1.mStr, src1_len);
00626     BOOST_CHECK(src1.verify());
00627     BOOST_CHECK(src2.verify());
00628     BOOST_CHECK_EQUAL(result2 * -1, result);
00629 
00630     // force check of equal strings
00631     result = SqlStrCmp_Ascii_Var(
00632         src1.mStr, src1_len,
00633         src1.mStr, src1_len);
00634     BOOST_CHECK(src1.verify());
00635     BOOST_CHECK_EQUAL(result, 0);
00636 
00637 }

void SqlStringAsciiTest::testSqlStringCmp_Ascii_Fix_Helper ( SqlStringBuffer src1,
int  src1_storage,
int  src1_len,
SqlStringBuffer src2,
int  src2_storage,
int  src2_len 
) [private]

Definition at line 464 of file SqlStringAsciiTest.cpp.

References SqlStringBuffer::mStr, SqlStrCmp_Ascii_Fix(), testSqlStringNormalizeLexicalCmp(), and SqlStringBuffer::verify().

Referenced by testSqlStringCmp_Ascii_Fix_DiffLen(), and testSqlStringCmp_Ascii_Fix_EqLen().

00471 {
00472     int result;
00473 
00474     string s1(src1.mStr, src1_len);
00475     string s2(src2.mStr, src2_len);
00476 
00477     // It is possible that test string ends with a space. Remove it.
00478     s1.erase(s1.find_last_not_of(" ") + 1);
00479     s2.erase(s2.find_last_not_of(" ") + 1);
00480 
00481     int expected = testSqlStringNormalizeLexicalCmp(s1.compare(s2));
00482     char const * const s1p = s1.c_str();
00483     char const * const s2p = s2.c_str();
00484     int expected2 = testSqlStringNormalizeLexicalCmp(strcmp(s1p, s2p));
00485     BOOST_CHECK_EQUAL(expected, expected2);
00486 
00487     result = SqlStrCmp_Ascii_Fix(
00488         src1.mStr, src1_storage,
00489         src2.mStr, src2_storage);
00490     BOOST_CHECK(src1.verify());
00491     BOOST_CHECK(src2.verify());
00492 
00493 #if 0
00494     BOOST_MESSAGE(" src1=|" << s1 << "|" <<
00495                   " src2=|" << s2 << "|" <<
00496                   " expect=" << expected <<
00497                   " expect2=" << expected2 <<
00498                   " result=" << result);
00499 #endif
00500     BOOST_CHECK_EQUAL(result, expected);
00501 
00502     // check the exact opposite, even if equal
00503     int result2 = SqlStrCmp_Ascii_Fix(
00504         src2.mStr, src2_storage,
00505         src1.mStr, src1_storage);
00506     BOOST_CHECK(src1.verify());
00507     BOOST_CHECK(src2.verify());
00508     BOOST_CHECK_EQUAL(result2 * -1, result);
00509 
00510     // force check of equal strings
00511     result = SqlStrCmp_Ascii_Fix(
00512         src1.mStr, src1_storage,
00513         src1.mStr, src1_storage);
00514     BOOST_CHECK(src1.verify());
00515     BOOST_CHECK_EQUAL(result, 0);
00516 
00517 }

int SqlStringAsciiTest::testSqlStringNormalizeLexicalCmp ( int  v  )  [private]

Definition at line 450 of file SqlStringAsciiTest.cpp.

Referenced by testSqlStringCmp_Ascii_Fix_Helper(), and testSqlStringCmp_Ascii_Var_Helper().

00451 {
00452     if (v < 0) {
00453         return -1;
00454     }
00455     if (v > 0) {
00456         return 1;
00457     }
00458     return 0;
00459 }

void TestBase::snooze ( uint  nSeconds  )  [protected, inherited]

Definition at line 263 of file TestBase.cpp.

Referenced by DatabaseTest::executeForceTxn(), ThreadedTestBase::runThreadedTestCase(), PagingTestBase::testCacheResize(), BTreeTxnTest::testCheckpoint(), PagingTestBase::testCheckpointGuarded(), PagingTestBase::testPrefetch(), and PagingTestBase::testPrefetchBatch().

00264 {
00265 #ifdef __MSVC__
00266     ::_sleep(nSeconds*1000);
00267 #else
00268     ::sleep(nSeconds);
00269 #endif
00270 }

void TestBase::readParams ( int  argc,
char **  argv 
) [static, inherited]

Parses the command line.

format: [-v] [-t TEST | -all] {param=val}* [CONFIGFILE | -] Normally, the test program runs the default test cases. With the option "-all", runs the extra test cases as well. With the option "-t TEST", runs only the single test case named TEST. CONFIGFILE is read to load configuration parameters. Configuration parameters can also be set ad hoc, from the command line, as pairs name=val. These take precedence.

Definition at line 108 of file TestBase.cpp.

References TestBase::configMap, ConfigMap::dumpParams(), ConfigMap::isParamSet(), ConfigMap::mergeFrom(), TestBase::paramDictionaryFileName, ConfigMap::readParams(), TestBase::runAll, TestBase::runSingle, ConfigMap::setStringParam(), and verbose.

00109 {
00110     bool verbose = false;
00111     ConfigMap adhocMap;
00112 
00113     for (int i = 1; i < argc; ++i) {
00114         std::string arg = argv[i];
00115         if (argv[i][0] == '-') {
00116             if (arg == "-v") {
00117                 verbose = true;
00118             } else if (arg == "-") {
00119                 configMap.readParams(std::cin);
00120             } else if (arg == "-all") {
00121                 runAll = true;
00122             } else if (arg == "-t") {   // -t TEST
00123                 permAssert(i + 1 < argc);
00124                 runSingle = argv[++i];
00125             } else if (arg[1] == 't') { // allow -tTEST
00126                 runSingle = arg.substr(2);
00127             }
00128         } else {
00129             int i = arg.find("=");
00130             if ((0 < i) && (i < arg.size())) {
00131                 // an ad hoc parameter
00132                 std::string key = arg.substr(0,i);
00133                 std::string val = arg.substr(i + 1);
00134                 adhocMap.setStringParam(key,val);
00135             } else {
00136                 // a config file name
00137                 std::ifstream configFile(arg.c_str());
00138                 assert(configFile.good());
00139                 configMap.readParams(configFile);
00140             }
00141         }
00142     }
00143     configMap.mergeFrom(adhocMap);
00144 
00145     // set a default dictionary file location for use by tests that need a
00146     // small non-random sorted data set
00147     if (!configMap.isParamSet(paramDictionaryFileName)) {
00148         std::string dictFileName = "dictWords";
00149         configMap.setStringParam(paramDictionaryFileName,dictFileName);
00150     }
00151 
00152     if (verbose) {
00153         configMap.dumpParams(std::cout);
00154     }
00155 }

TestSuite * TestBase::releaseTestSuite (  )  [inherited]

Definition at line 157 of file TestBase.cpp.

References TestBase::TestCaseGroup::addAllToTestSuite(), TestBase::defaultTests, TestBase::extraTests, TestBase::TestCaseGroup::findTest(), TestBase::pTestObj, TestBase::pTestSuite, TestBase::runAll, TestBase::runSingle, and TestBase::testName.

00158 {
00159     assert(pTestObj);
00160     assert(pTestObj.use_count() > 1);
00161 
00162     // release self-reference now that all test cases have been registered
00163     pTestObj.reset();
00164 
00165     TestSuite* pTestSuite = BOOST_TEST_SUITE(testName.c_str());
00166 
00167     if (runSingle.size()) {
00168         test_unit *p =  defaultTests.findTest(runSingle);
00169         if (!p) {
00170             p = extraTests.findTest(runSingle);
00171         }
00172         if (!p) {
00173             std::cerr << "test " << runSingle << " not found\n";
00174             exit(2);
00175         }
00176         pTestSuite->add(p);
00177     } else {
00178         defaultTests.addAllToTestSuite(pTestSuite);
00179         if (runAll) {
00180             extraTests.addAllToTestSuite(pTestSuite);
00181         }
00182     }
00183     return pTestSuite;
00184 }

void TestBase::beforeTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 214 of file TestBase.cpp.

References TestBase::configMap, TraceSource::initTraceSource(), AutoBacktrace::install(), TestBase::notifyTrace(), AutoBacktrace::setOutputStream(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00215 {
00216     notifyTrace(testName,TRACE_INFO,"ENTER:  " + testCaseName);
00217 
00218     // Install the AutoBacktrace signal handler now, after
00219     // boost::execution_monitor::catch_signals() has installed its own, so that
00220     // on SIGABRT AutoBacktrace goes first, prints the backtrace, then chains
00221     // to boost, which handles the error.
00222     AutoBacktrace::setOutputStream();
00223     AutoBacktrace::setTraceTarget(shared_from_this());
00224     AutoBacktrace::install();
00225     configMap.initTraceSource(shared_from_this(), "testConfig");
00226 }

void TestBase::afterTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 228 of file TestBase.cpp.

References TestBase::configMap, TraceSource::disableTracing(), TestBase::notifyTrace(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00229 {
00230     AutoBacktrace::setTraceTarget();
00231     configMap.disableTracing();
00232     notifyTrace(testName,TRACE_INFO,"LEAVE:  " + testCaseName);
00233 }

void TestBase::testCaseSetUp (  )  [virtual, inherited]

Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.

Default is no-op.

Reimplemented in LbmEntryTest, LbmExecStreamTestBase, LbmLoadBitmapTest, LbmSearchTest, LbmSplicerExecStreamTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, LcsRowScanExecStreamTest, BTreeReadersTest, BTreeTest, BTreeTxnTest, ExecStreamGovernorTest, ExecStreamTestBase, ExecStreamUnitTestBase, ExternalSortExecStreamTest, LhxHashTableTest, LogicalTxnTest, and SnapshotSegmentTestBase.

Definition at line 235 of file TestBase.cpp.

Referenced by ExecStreamTestBase::testCaseSetUp().

00236 {
00237 }

void TestBase::testCaseTearDown (  )  [virtual, inherited]

Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.

Default is no-op.

Reimplemented in LbmEntryTest, LbmLoadBitmapTest, LbmSearchTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, LcsRowScanExecStreamTest, BTreeReadersTest, BTreeTest, BTreeTxnTest, CacheTestBase, DatabaseTest, ExecStreamTestBase, LhxHashTableTest, RandomAccessFileDeviceTest, and SparseBitmapTest.

Definition at line 239 of file TestBase.cpp.

Referenced by SparseBitmapTest::testCaseTearDown().

00240 {
00241 }

void TestBase::notifyTrace ( std::string  source,
TraceLevel  level,
std::string  message 
) [virtual, inherited]

Receives notification when a trace event occurs.

Parameters:
source the facility from which the message originated
level the trace event severity level
message the text of the message

Implements TraceTarget.

Definition at line 243 of file TestBase.cpp.

References TestBase::traceFile, TestBase::traceMutex, TestBase::traceStdout, and TestBase::traceStream.

Referenced by TestBase::afterTestCase(), and TestBase::beforeTestCase().

00244 {
00245     if (traceFile || traceStdout) {
00246         StrictMutexGuard traceMutexGuard(traceMutex);
00247         if (traceFile) {
00248             traceStream << "[" << source << "] " << message << std::endl;
00249             traceStream.flush();
00250         }
00251         if (traceStdout) {
00252             std::cout << "[" << source << "] " << message << std::endl;
00253             std::cout.flush();
00254         }
00255     }
00256 }

TraceLevel TestBase::getSourceTraceLevel ( std::string  source  )  [virtual, inherited]

Gets the level at which a particular source should be traced.

Parameters:
source name of source to be traced
Returns:
minimum severity level which should be traced

Implements TraceTarget.

Definition at line 258 of file TestBase.cpp.

References TestBase::traceLevel.

Referenced by LbmExecStreamTestBase::generateBitmaps().

00259 {
00260     return traceLevel;
00261 }

void TraceSource::initTraceSource ( SharedTraceTarget  pTraceTarget,
std::string  name 
) [virtual, inherited]

For use when initialization has to be deferred until after construction.

Parameters:
pTraceTarget the TraceTarget to which messages will be sent
name the name of this source

Definition at line 46 of file TraceSource.cpp.

References TraceSource::isTracing(), TraceSource::minimumLevel, TraceSource::name, TraceSource::pTraceTarget, and TRACE_OFF.

Referenced by TestBase::beforeTestCase(), TestBase::TestBase(), and TraceSource::TraceSource().

00049 {
00050     assert(!pTraceTarget.get());
00051 
00052     pTraceTarget = pTraceTargetInit;
00053     name = nameInit;
00054     if (isTracing()) {
00055         minimumLevel = pTraceTarget->getSourceTraceLevel(name);
00056     } else {
00057         minimumLevel = TRACE_OFF;
00058     }
00059 }

void TraceSource::trace ( TraceLevel  level,
std::string  message 
) const [inherited]

Records a trace message.

Normally only called via FENNEL_TRACE.

Parameters:
level severity level of event being trace
message the text of the message

Definition at line 61 of file TraceSource.cpp.

References TraceSource::getTraceTarget(), TraceSource::isTracing(), TraceSource::name, and TraceTarget::notifyTrace().

Referenced by Calculator::exec(), and ExecStreamScheduler::traceStreamBufferContents().

00062 {
00063     if (isTracing()) {
00064         getTraceTarget().notifyTrace(name,level,message);
00065     }
00066 }

bool TraceSource::isTracing (  )  const [inline, inherited]

Returns:
true iff tracing is enabled for this source

Definition at line 88 of file TraceSource.h.

Referenced by TraceSource::initTraceSource(), CalcExecStream::prepare(), and TraceSource::trace().

00089     {
00090         return pTraceTarget.get() ? true : false;
00091     }

bool TraceSource::isTracingLevel ( TraceLevel  level  )  const [inline, inherited]

Determines whether a particular level is being traced.

Parameters:
level trace level to test
Returns:
true iff tracing is enabled for the given level

Definition at line 100 of file TraceSource.h.

Referenced by ExecStreamScheduler::addGraph(), SimpleExecStreamGovernor::assignCachePages(), SimpleExecStreamGovernor::distributeCachePages(), Calculator::exec(), ExecStreamScheduler::ExecStreamScheduler(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterNodeWriter::moveFromTempToIndex(), JavaSinkExecStream::stuffByteBuffer(), and ExecStreamScheduler::traceStreamBuffers().

00101     {
00102         return level >= minimumLevel;
00103     }

TraceTarget& TraceSource::getTraceTarget (  )  const [inline, inherited]

Returns:
the TraceTarget for this source

Definition at line 108 of file TraceSource.h.

Referenced by TraceSource::trace().

00109     {
00110         assert(isTracing());
00111         return *(pTraceTarget.get());
00112     }

SharedTraceTarget TraceSource::getSharedTraceTarget (  )  const [inline, inherited]

Returns:
the SharedTraceTarget for this source

Definition at line 117 of file TraceSource.h.

Referenced by Database::init(), LcsClusterAppendExecStream::initLoad(), and CalcExecStream::prepare().

00118     {
00119         return pTraceTarget;
00120     }

std::string TraceSource::getTraceSourceName (  )  const [inline, inherited]

Gets the name of this source.

Useful to construct nested names for subcomponents that are also TraceSources.

Returns:
the name

Definition at line 127 of file TraceSource.h.

Referenced by LcsClusterAppendExecStream::initLoad().

00128     {
00129         return name;
00130     }

void TraceSource::setTraceSourceName ( std::string const &  n  )  [inline, inherited]

Sets the name of this source.

Useful to construct dynamic names for fine-grained filtering.

Definition at line 136 of file TraceSource.h.

00137     {
00138         name = n;
00139     }

TraceLevel TraceSource::getMinimumTraceLevel (  )  const [inline, inherited]

Definition at line 141 of file TraceSource.h.

00142     {
00143         return minimumLevel;
00144     }

void TraceSource::disableTracing (  )  [inherited]

Definition at line 68 of file TraceSource.cpp.

References TraceSource::minimumLevel, TraceSource::pTraceTarget, and TRACE_OFF.

Referenced by TestBase::afterTestCase().

00069 {
00070     pTraceTarget.reset();
00071     minimumLevel = TRACE_OFF;
00072 }


Member Data Documentation

TestSuite* TestBase::pTestSuite [protected, inherited]

Boost test suite.

Definition at line 59 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

boost::shared_ptr<TestBase> TestBase::pTestObj [protected, inherited]

Definition at line 61 of file TestBase.h.

Referenced by TestBase::releaseTestSuite(), and TestBase::TestBase().

std::ofstream TestBase::traceStream [protected, inherited]

Output file stream for tracing.

Definition at line 66 of file TestBase.h.

Referenced by TestBase::notifyTrace(), TestBase::TestBase(), and TestBase::~TestBase().

StrictMutex TestBase::traceMutex [protected, inherited]

Protects traceStream.

Definition at line 71 of file TestBase.h.

Referenced by TestBase::notifyTrace().

std::string TestBase::testName [protected, inherited]

Name of test.

Definition at line 76 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), TestBase::releaseTestSuite(), TestBase::TestBase(), LhxHashTableTest::testInsert1Ka(), and LhxHashTableTest::testInsert1Kb().

TraceLevel TestBase::traceLevel [protected, inherited]

Level at which to trace test execution.

Definition at line 81 of file TestBase.h.

Referenced by TestBase::getSourceTraceLevel(), and TestBase::TestBase().

FileStatsTarget TestBase::statsTarget [protected, inherited]

Output for stats.

Definition at line 86 of file TestBase.h.

StatsTimer TestBase::statsTimer [protected, inherited]

Timer for stats collection.

Definition at line 91 of file TestBase.h.

Referenced by CacheTestBase::closeStorage(), CacheTestBase::openStorage(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCaseTearDown(), and BTreeTxnTest::testTxns().

bool TestBase::traceStdout [protected, inherited]

Copy trace output to stdout.

Definition at line 99 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::traceFile [protected, inherited]

Copy trace output to file.

Definition at line 104 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::runAll [static, protected, inherited]

Run all test cases, including the extra tests.

(static, since set by readParams())

Definition at line 110 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

std::string TestBase::runSingle [static, protected, inherited]

Run only the test case of this name.

(static, since set by readParams())

Definition at line 116 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

TestCaseGroup TestBase::defaultTests [protected, inherited]

Definition at line 139 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

TestCaseGroup TestBase::extraTests [protected, inherited]

Definition at line 140 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

ParamName TestBase::paramTestSuiteName [static, inherited]

Definition at line 143 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramTraceFileName [static, inherited]

Definition at line 144 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDictionaryFileName [static, inherited]

Definition at line 145 of file TestBase.h.

Referenced by TestBase::readParams(), SegStreamTest::testRead(), and SegStreamTest::testWrite().

ParamName TestBase::paramTraceLevel [static, inherited]

Definition at line 146 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramStatsFileName [static, inherited]

Definition at line 147 of file TestBase.h.

ParamName TestBase::paramTraceStdout [static, inherited]

Definition at line 148 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDegreeOfParallelism [static, inherited]

Definition at line 149 of file TestBase.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

ConfigMap TestBase::configMap [static, inherited]

Configuration parameters.

The reason this is static is so that no constructor parameters (which burden virtual bases) are needed.

Definition at line 155 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), BTreeTxnTest::BTreeTxnTest(), CacheTestBase::CacheTestBase(), BackupRestoreTest::createSnapshotData(), DatabaseTest::DatabaseTest(), TestOptionsTest::extra(), DatabaseTest::loadDatabase(), SparseBitmapTest::openStorage(), PagingTestBase::PagingTestBase(), ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest(), RandomAccessFileDeviceTest::RandomAccessFileDeviceTest(), TestBase::readParams(), SegStorageTestBase::SegStorageTestBase(), TestOptionsTest::test1(), TestOptionsTest::test2(), BackupRestoreTest::testBackupCleanup(), TestBase::TestBase(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCheckpoint(), DatabaseTest::testCreateEmpty(), DatabaseTest::testForceTxns(), BackupRestoreTest::testHeaderBackupRestore(), SegPageEntryIterTest::testIter(), SegStreamTest::testRead(), BTreeTxnTest::testTxns(), SegStreamTest::testWrite(), ThreadedTestBase::ThreadedTestBase(), and TestBase::~TestBase().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:47 2009 for Fennel by  doxygen 1.5.1