CalcExtStringTest Class Reference

Inheritance diagram for CalcExtStringTest:

TestBase TraceSource TraceTarget List of all members.

Public Member Functions

 CalcExtStringTest ()
virtual ~CalcExtStringTest ()
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 testCalcExtStringCatA2 ()
void testCalcExtStringCatA3 ()
void testCalcExtStringCmpA ()
void testCalcExtStringCmpOct ()
void testCalcExtStringLenBitA ()
void testCalcExtStringLenCharA ()
void testCalcExtStringLenOctA ()
void testCalcExtStringOverlayA4 ()
void testCalcExtStringOverlayA5 ()
void testCalcExtStringPosA ()
void testCalcExtStringSubStringA3 ()
void testCalcExtStringSubStringA4 ()
void testCalcExtStringToANull ()
void testCalcExtStringToLower ()
void testCalcExtStringToUpper ()
void testCalcExtStringTrim ()
int cmpTupStr (TupleDatum const &tup, char const *const str)
int cmpTupInt (TupleDatum const &tup, int val)
int cmpTupNull (TupleDatum const &tup)
void printOutput (TupleData const &tup, Calculator const &calc)
void refLocalOutput (ostringstream &pg, int count)

Static Private Attributes

static const char * truncErr
static const char * substrErr

Detailed Description

Definition at line 43 of file CalcExtStringTest.cpp.


Constructor & Destructor Documentation

CalcExtStringTest::CalcExtStringTest (  )  [inline, explicit]

Definition at line 79 of file CalcExtStringTest.cpp.

References CalcInit::instance(), testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringCmpA(), testCalcExtStringCmpOct(), testCalcExtStringLenBitA(), testCalcExtStringLenCharA(), testCalcExtStringLenOctA(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringPosA(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToANull(), testCalcExtStringToLower(), testCalcExtStringToUpper(), and testCalcExtStringTrim().

00080         : TraceSource(shared_from_this(),"CalcExtStringTest")
00081     {
00082         srand(time(NULL));
00083         CalcInit::instance();
00084         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringCatA2);
00085         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringCatA3);
00086         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringCmpA);
00087         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringCmpOct);
00088         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringLenBitA);
00089         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringLenCharA);
00090         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringLenOctA);
00091         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringOverlayA4);
00092         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringOverlayA5);
00093         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringPosA);
00094         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringSubStringA3);
00095         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringSubStringA4);
00096         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringToANull);
00097         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringToLower);
00098         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringToUpper);
00099         FENNEL_UNIT_TEST_CASE(CalcExtStringTest, testCalcExtStringTrim);
00100     }

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

Definition at line 102 of file CalcExtStringTest.cpp.

00103     {
00104     }


Member Function Documentation

void CalcExtStringTest::testCalcExtStringCatA2 (  )  [private]

Definition at line 173 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and truncErr.

Referenced by CalcExtStringTest().

00174 {
00175     ostringstream pg(""), outloc("");
00176     int i;
00177 
00178     for (i = 0; i <= 2; i++) {
00179         outloc << "vc,5, ";
00180     }
00181     outloc << "c,5, ";
00182     outloc << "vc,1, c,1;" << endl;    // right truncate
00183 
00184     pg << "O " << outloc.str();
00185     pg << "L " << outloc.str();
00186     pg << "C vc,5, vc,2, vc,2, ";  // varchar data[0-2]
00187     pg << "c,5, ";                 // char data[3]
00188     pg << "vc,5, c,5;" << endl;    // nulls[4-5]
00189     pg << "V 0x" << stringToHex("AB");
00190     pg << ", 0x" << stringToHex("CD");
00191     pg << ", 0x" << stringToHex("");
00192     pg << ", 0x" << stringToHex("GHIJ ");
00193     pg << ",,;" << endl;
00194     pg << "T;" << endl;
00195     // varchar common case
00196     // first, clear output string
00197     pg << "CALL 'strCpyA(L0, C2);" << endl;
00198     pg << "CALL 'strCatA2(L0, C0);" << endl;
00199     // append to first string
00200     pg << "CALL 'strCatA2(L0, C1);" << endl;
00201     // zero length case
00202     // first, clear output string
00203     pg << "CALL 'strCpyA(L1, C2);" << endl;
00204     pg << "CALL 'strCatA2(L1, C2);" << endl;
00205     // varchar null case
00206     pg << "CALL 'strCatA2(L2, C4);" << endl;
00207     // varchar right truncate
00208     pg << "CALL 'strCatA2(L4, C0);" << endl;
00209 
00210     // char common case: can't test fixed common case w/o
00211     // using strCatAF3 as well to have length set
00212     // correctly. tested elsewhere
00213     // char null case
00214     pg << "CALL 'strCatA2(L3, C5);" << endl;
00215     // char right truncate
00216     pg << "CALL 'strCatA2(L5, C3);" << endl;
00217     // make output available
00218     refLocalOutput(pg, 6);
00219 
00220     Calculator calc(0);
00221 
00222     try {
00223         calc.assemble(pg.str().c_str());
00224     } catch (FennelExcn& ex) {
00225         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00226         BOOST_MESSAGE(pg.str());
00227         BOOST_REQUIRE(0);
00228     }
00229 
00230     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00231     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00232 
00233     calc.bind(&inTuple, &outTuple);
00234     calc.exec();
00235     printOutput(outTuple, calc);
00236     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
00237 
00238     // varchar common case
00239     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "ABCD"));
00240     // varchar zero length case
00241     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[1], ""));
00242     // varchar null case
00243     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00244     // varchar right truncation
00245     BOOST_CHECK_EQUAL(iter->pc, 6);
00246     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00247     iter++;
00248     // char null case
00249     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
00250     // char right truncation
00251     BOOST_CHECK_EQUAL(iter->pc, 8);
00252     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00253     iter++;
00254     BOOST_CHECK(iter == calc.mWarnings.end());
00255 }

void CalcExtStringTest::testCalcExtStringCatA3 (  )  [private]

Definition at line 257 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and truncErr.

Referenced by CalcExtStringTest().

00258 {
00259     ostringstream pg(""), outloc("");
00260     int i;
00261 
00262     for (i = 0; i <= 3; i++) {
00263         outloc << "vc,5, ";
00264     }
00265     for (i = 4; i <= 6; i++) {
00266         outloc << "c,5, ";
00267     }
00268     outloc << "vc,1, c,1;" << endl;    // right truncate
00269 
00270     pg << "O " << outloc.str();
00271     pg << "L " << outloc.str();
00272     pg << "C vc,5, vc,2, vc,2, ";  // varchar data[0-2]
00273     pg << "c,3, c,2, ";            // char data[3-4]
00274     pg << "vc,5, c,5;" << endl;    // nulls[5-6]
00275     pg << "V 0x" << stringToHex("AB");
00276     pg << ", 0x" << stringToHex("CD");
00277     pg << ", 0x" << stringToHex("");
00278     pg << ", 0x" << stringToHex("GHI");
00279     pg << ", 0x" << stringToHex("JK");
00280     pg << ",,;" << endl;
00281     pg << "T;" << endl;
00282     // varchar common case
00283     pg << "CALL 'strCatA3(L0, C0, C1);" << endl;
00284     // zero length case
00285     pg << "CALL 'strCatA3(L1, C2, C2);" << endl;
00286     // varchar null cases
00287     pg << "CALL 'strCatA3(L2, C5, C1);" << endl;
00288     pg << "CALL 'strCatA3(L3, C0, C5);" << endl;
00289     // varchar right truncate
00290     pg << "CALL 'strCatA3(L7, C0, C0);" << endl;
00291 
00292     // char common case
00293     pg << "CALL 'strCatA3(L4, C3, C4);" << endl;
00294     // char null cases
00295     pg << "CALL 'strCatA3(L5, C6, C4);" << endl;
00296     pg << "CALL 'strCatA3(L6, C3, C6);" << endl;
00297     // char right truncate
00298     pg << "CALL 'strCatA3(L8, C3, C4);" << endl;
00299     // make output available
00300     refLocalOutput(pg, 9);
00301 
00302     Calculator calc(0);
00303 
00304     try {
00305         calc.assemble(pg.str().c_str());
00306     } catch (FennelExcn& ex) {
00307         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00308         BOOST_MESSAGE(pg.str());
00309         BOOST_REQUIRE(0);
00310     }
00311 
00312     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00313     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00314 
00315     calc.bind(&inTuple, &outTuple);
00316     calc.exec();
00317     printOutput(outTuple, calc);
00318     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
00319 
00320     // varchar common case
00321     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "ABCD"));
00322     // varchar zero length case
00323     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[1], ""));
00324     // varchar null cases
00325     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00326     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
00327     // varchar right truncation
00328     BOOST_CHECK_EQUAL(iter->pc, 4);
00329     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00330     iter++;
00331     // char common case
00332     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[4], "GHIJK"));
00333     // char null cases
00334     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
00335     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[6]));
00336     // char right truncation
00337     BOOST_CHECK_EQUAL(iter->pc, 8);
00338     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00339     iter++;
00340     BOOST_CHECK(iter == calc.mWarnings.end());
00341 }

void CalcExtStringTest::testCalcExtStringCmpA (  )  [private]

Definition at line 344 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

00345 {
00346     ostringstream pg(""), outloc("");
00347     int i;
00348 
00349     for (i = 0; i <= 11; i++) {
00350         outloc << "s4, ";
00351     }
00352     outloc << "s4;" << endl;
00353 
00354     pg << "O " << outloc.str();
00355     pg << "L " << outloc.str();
00356     pg << "C vc,2, vc,2, vc,2, "; // varchar data[0-2]
00357     pg << "c,2, c,2, c,2, ";      // char data[3-5]
00358     pg << "vc,5, c,5;" << endl;  // nulls[6-7]
00359     pg << "V 0x" << stringToHex("AB");
00360     pg << ", 0x" << stringToHex("CD");
00361     pg << ", 0x" << stringToHex("EF");
00362     pg << ", 0x" << stringToHex("GH");
00363     pg << ", 0x" << stringToHex("IJ");
00364     pg << ", 0x" << stringToHex("EF");
00365     pg << ",,;" << endl;
00366     pg << "T;" << endl;
00367     // varchar common cases
00368     pg << "CALL 'strCmpA(L0, C0, C0);" << endl;
00369     pg << "CALL 'strCmpA(L1, C1, C0);" << endl;
00370     pg << "CALL 'strCmpA(L2, C0, C1);" << endl;
00371     // varchar null cases
00372     pg << "CALL 'strCmpA(L3, C6, C0);" << endl;
00373     pg << "CALL 'strCmpA(L4, C0, C6);" << endl;
00374     // char common cases
00375     pg << "CALL 'strCmpA(L5, C3, C3);" << endl;
00376     pg << "CALL 'strCmpA(L6, C4, C3);" << endl;
00377     pg << "CALL 'strCmpA(L7, C3, C4);" << endl;
00378     // char null cases
00379     pg << "CALL 'strCmpA(L8, C7, C2);" << endl;
00380     pg << "CALL 'strCmpA(L9, C2, C7);" << endl;
00381     // mixed common cases
00382     pg << "CALL 'strCmpA(L10, C2, C5);" << endl;
00383     pg << "CALL 'strCmpA(L11, C0, C3);" << endl;
00384     pg << "CALL 'strCmpA(L12, C3, C0);" << endl;
00385 
00386     // make output available
00387     refLocalOutput(pg, 13);
00388 
00389     Calculator calc(0);
00390 
00391     try {
00392         calc.assemble(pg.str().c_str());
00393     } catch (FennelExcn& ex) {
00394         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00395         BOOST_MESSAGE(pg.str());
00396         BOOST_REQUIRE(0);
00397     }
00398 
00399     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00400     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00401 
00402     calc.bind(&inTuple, &outTuple);
00403     calc.exec();
00404     printOutput(outTuple, calc);
00405 
00406     // varchar common cases
00407     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 0));
00408     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 1));
00409     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[2], -1));
00410     // varchar null cases
00411     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
00412     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[4]));
00413     // char common case
00414     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[5], 0));
00415     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[6], 1));
00416     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[7], -1));
00417     // char null cases
00418     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[8]));
00419     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[9]));
00420     // mixed cases
00421     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[10], 0));
00422     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[11], -1));
00423     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[12], 1));
00424 }

void CalcExtStringTest::testCalcExtStringCmpOct (  )  [private]

Definition at line 427 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), and refLocalOutput().

Referenced by CalcExtStringTest().

00428 {
00429     ostringstream pg(""), outloc("");
00430     int i;
00431 
00432     for (i = 0; i <= 11; i++) {
00433         outloc << "s4, ";
00434     }
00435     outloc << "s4;" << endl;
00436 
00437     pg << "O " << outloc.str();
00438     pg << "L " << outloc.str();
00439     pg << "C vb,1, vb,1, vb,1, "; // varbinary data[0-2]
00440     //disabling binaries for now since they seem to be failing in the assembler
00441     pg << "b,1, b,1, b,1, ";      // binary data[3-5]
00442     pg << "vb,0, b,0; " << endl;  // nulls[6-7]
00443     pg << "V 0xAA";
00444     pg << ", 0xBB";
00445     pg << ", 0xCC";
00446     pg << ", 0xDD";
00447     pg << ", 0xEE";
00448     pg << ", 0xCC";
00449     pg << ",,;" << endl;
00450 
00451     pg << "T;" << endl;
00452     // varchar common cases
00453     pg << "CALL 'strCmpOct(L0, C0, C0);" << endl;
00454     pg << "CALL 'strCmpOct(L1, C1, C0);" << endl;
00455     pg << "CALL 'strCmpOct(L2, C0, C1);" << endl;
00456     // varchar null cases
00457     pg << "CALL 'strCmpOct(L3, C6, C0);" << endl;
00458     pg << "CALL 'strCmpOct(L4, C0, C6);" << endl;
00459     // char common cases
00460     pg << "CALL 'strCmpOct(L5, C3, C3);" << endl;
00461     pg << "CALL 'strCmpOct(L6, C4, C3);" << endl;
00462     pg << "CALL 'strCmpOct(L7, C3, C4);" << endl;
00463     // char null cases
00464     pg << "CALL 'strCmpOct(L8, C7, C3);" << endl;
00465     pg << "CALL 'strCmpOct(L9, C3, C7);" << endl;
00466     // mixed common cases
00467     pg << "CALL 'strCmpOct(L10, C2, C2);" << endl;
00468     pg << "CALL 'strCmpOct(L11, C0, C3);" << endl;
00469     pg << "CALL 'strCmpOct(L12, C3, C0);" << endl;
00470     // make output available
00471     refLocalOutput(pg, 13);
00472 
00473     Calculator calc(0);
00474 
00475     try {
00476         calc.assemble(pg.str().c_str());
00477     } catch (FennelExcn& ex) {
00478         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00479         BOOST_MESSAGE(pg.str());
00480         BOOST_REQUIRE(0);
00481     }
00482 
00483     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00484     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00485 
00486     calc.bind(&inTuple, &outTuple);
00487     calc.exec();
00488     printOutput(outTuple, calc);
00489 
00490     // varchar common cases
00491     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 0));
00492     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 1));
00493     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[2], -1));
00494     // varchar null cases
00495     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
00496     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[4]));
00497     // char common case
00498     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[5], 0));
00499     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[6], 1));
00500     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[7], -1));
00501     // char null cases
00502     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[8]));
00503     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[9]));
00504     // check mixed cases
00505     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[10], 0));
00506     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[11], -1));
00507     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[12], 1));
00508 }

void CalcExtStringTest::testCalcExtStringLenBitA (  )  [private]

Definition at line 511 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

00512 {
00513     ostringstream pg(""), outloc("");
00514     int i;
00515 
00516     for (i = 0; i <= 8; i++) {
00517         outloc << "s4, ";
00518     }
00519     outloc << "s4;" << endl;
00520 
00521     pg << "O " << outloc.str();
00522     pg << "L " << outloc.str();
00523     pg << "C vc,2, vc,2, ";      // varchar data[0-1]
00524     pg << "c,2, c,2, ";          // char data[2-3]
00525     pg << "vc,5, c,5;" << endl;  // nulls[4-5]
00526     pg << "V 0x" << stringToHex("AB");
00527     pg << ", 0x" << stringToHex("");
00528     pg << ", 0x" << stringToHex("GH");
00529     pg << ", 0x" << stringToHex("  ");
00530     pg << ",,;" << endl;
00531     pg << "T;" << endl;
00532     // varchar common cases
00533     pg << "CALL 'strLenBitA(L0, C0);" << endl;
00534     pg << "CALL 'strLenBitA(L1, C1);" << endl;
00535     // varchar null case
00536     pg << "CALL 'strLenBitA(L2, C4);" << endl;
00537     // char common cases
00538     pg << "CALL 'strLenBitA(L3, C2);" << endl;
00539     pg << "CALL 'strLenBitA(L4, C3);" << endl;
00540     // char null case
00541     pg << "CALL 'strLenBitA(L5, C5);" << endl;
00542     // make output available
00543     refLocalOutput(pg, 6);
00544 
00545     Calculator calc(0);
00546 
00547     try {
00548         calc.assemble(pg.str().c_str());
00549     } catch (FennelExcn& ex) {
00550         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00551         BOOST_MESSAGE(pg.str());
00552         BOOST_REQUIRE(0);
00553     }
00554 
00555     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00556     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00557 
00558     calc.bind(&inTuple, &outTuple);
00559     calc.exec();
00560     printOutput(outTuple, calc);
00561 
00562     // varchar common cases
00563     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 16));
00564     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 0));
00565     // varchar null case
00566     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00567     // char common case
00568     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[3], 16));
00569     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[4], 16));
00570     // char null case
00571     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
00572 }

void CalcExtStringTest::testCalcExtStringLenCharA (  )  [private]

Definition at line 575 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

00576 {
00577     ostringstream pg(""), outloc("");
00578     int i;
00579 
00580     for (i = 0; i <= 8; i++) {
00581         outloc << "s4, ";
00582     }
00583     outloc << "s4;" << endl;
00584 
00585     pg << "O " << outloc.str();
00586     pg << "L " << outloc.str();
00587     pg << "C vc,2, vc,2, ";      // varchar data[0-1]
00588     pg << "c,2, c,2, ";          // char data[2-3]
00589     pg << "vc,5, c,5;" << endl;  // nulls[4-5]
00590     pg << "V 0x" << stringToHex("AB");
00591     pg << ", 0x" << stringToHex("");
00592     pg << ", 0x" << stringToHex("GH");
00593     pg << ", 0x" << stringToHex("  ");
00594     pg << ",,;" << endl;
00595     pg << "T;" << endl;
00596     // varchar common cases
00597     pg << "CALL 'strLenCharA(L0, C0);" << endl;
00598     pg << "CALL 'strLenCharA(L1, C1);" << endl;
00599     // varchar null case
00600     pg << "CALL 'strLenCharA(L2, C4);" << endl;
00601     // char common cases
00602     pg << "CALL 'strLenCharA(L3, C2);" << endl;
00603     pg << "CALL 'strLenCharA(L4, C3);" << endl;
00604     // char null case
00605     pg << "CALL 'strLenCharA(L5, C5);" << endl;
00606     // make output available
00607     refLocalOutput(pg, 10);
00608 
00609     Calculator calc(0);
00610 
00611     try {
00612         calc.assemble(pg.str().c_str());
00613     } catch (FennelExcn& ex) {
00614         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00615         BOOST_MESSAGE(pg.str());
00616         BOOST_REQUIRE(0);
00617     }
00618 
00619     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00620     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00621 
00622     calc.bind(&inTuple, &outTuple);
00623     calc.exec();
00624     printOutput(outTuple, calc);
00625 
00626     // varchar common cases
00627     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 2));
00628     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 0));
00629     // varchar null case
00630     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00631     // char common case
00632     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[3], 2));
00633     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[4], 2));
00634     // char null case
00635     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
00636 }

void CalcExtStringTest::testCalcExtStringLenOctA (  )  [private]

Definition at line 639 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

00640 {
00641     ostringstream pg(""), outloc("");
00642     int i;
00643 
00644     for (i = 0; i <= 8; i++) {
00645         outloc << "s4, ";
00646     }
00647     outloc << "s4;" << endl;
00648 
00649     pg << "O " << outloc.str();
00650     pg << "L " << outloc.str();
00651     pg << "C vc,2, vc,2, ";      // varchar data[0-1]
00652     pg << "c,2, c,2, ";          // char data[2-3]
00653     pg << "vc,5, c,5;" << endl;  // nulls[4-5]
00654     pg << "V 0x" << stringToHex("AB");
00655     pg << ", 0x" << stringToHex("");
00656     pg << ", 0x" << stringToHex("GH");
00657     pg << ", 0x" << stringToHex("  ");
00658     pg << ",,;" << endl;
00659     pg << "T;" << endl;
00660     // varchar common cases
00661     pg << "CALL 'strLenOctA(L0, C0);" << endl;
00662     pg << "CALL 'strLenOctA(L1, C1);" << endl;
00663     // varchar null case
00664     pg << "CALL 'strLenOctA(L2, C4);" << endl;
00665     // char common cases
00666     pg << "CALL 'strLenOctA(L3, C2);" << endl;
00667     pg << "CALL 'strLenOctA(L4, C3);" << endl;
00668     // char null case
00669     pg << "CALL 'strLenOctA(L5, C5);" << endl;
00670     // make output available
00671     refLocalOutput(pg, 6);
00672 
00673     Calculator calc(0);
00674 
00675     try {
00676         calc.assemble(pg.str().c_str());
00677     } catch (FennelExcn& ex) {
00678         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00679         BOOST_MESSAGE(pg.str());
00680         BOOST_REQUIRE(0);
00681     }
00682 
00683     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00684     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00685 
00686     calc.bind(&inTuple, &outTuple);
00687     calc.exec();
00688     printOutput(outTuple, calc);
00689 
00690     // varchar common cases
00691     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 2));
00692     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 0));
00693     // varchar null case
00694     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00695     // char common case
00696     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[3], 2));
00697     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[4], 2));
00698     // char null case
00699     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
00700 }

void CalcExtStringTest::testCalcExtStringOverlayA4 (  )  [private]

Definition at line 703 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), substrErr, and truncErr.

Referenced by CalcExtStringTest().

00704 {
00705     ostringstream pg(""), outloc("");
00706     int i;
00707 
00708     for (i = 0; i <= 9; i++) {
00709         outloc << "vc,5, ";
00710     }
00711     outloc << "vc,1, vc,1;" << endl;          // right truncate
00712 
00713     pg << "O " << outloc.str();
00714     pg << "L " << outloc.str();
00715     pg << "C vc,5, vc,2, c,5, c,2, s4, "; // data[0-4]
00716     pg << "s4, ";                         // negative[5]
00717     pg << "vc,5, c,5, s4;" << endl;       // nulls[6-8]
00718     pg << "V 0x" << stringToHex("ABCD");
00719     pg << ", 0x" << stringToHex("EF");
00720     pg << ", 0x" << stringToHex("GHIJ ");
00721     pg << ", 0x" << stringToHex("KL");
00722     pg << ", 2,-2,,,;" << endl;
00723     pg << "T;" << endl;
00724     // varchar common case
00725     pg << "CALL 'strOverlayA4(L0, C0, C1, C4);" << endl;
00726     // varhcar null cases
00727     pg << "CALL 'strOverlayA4(L1, C6, C1, C4);" << endl;
00728     pg << "CALL 'strOverlayA4(L2, C0, C6, C4);" << endl;
00729     pg << "CALL 'strOverlayA4(L3, C0, C1, C8);" << endl;
00730     // varchar substring error
00731     pg << "CALL 'strOverlayA4(L4, C0, C1, C5);" << endl;
00732     // varchar right truncate
00733     pg << "CALL 'strOverlayA4(L10, C0, C1, C4);" << endl;
00734 
00735     // char common case
00736     pg << "CALL 'strOverlayA4(L5, C2, C3, C4);" << endl;
00737     // char null cases
00738     pg << "CALL 'strOverlayA4(L6, C7, C3, C4);" << endl;
00739     pg << "CALL 'strOverlayA4(L7, C2, C7, C4);" << endl;
00740     pg << "CALL 'strOverlayA4(L8, C2, C3, C8);" << endl;
00741     // varchar substring error
00742     pg << "CALL 'strOverlayA4(L9, C2, C3, C5);" << endl;
00743     // char right truncate
00744     pg << "CALL 'strOverlayA4(L11, C2, C3, C4);" << endl;
00745     // make output available
00746     refLocalOutput(pg, 12);
00747 
00748     Calculator calc(0);
00749 
00750     try {
00751         calc.assemble(pg.str().c_str());
00752     } catch (FennelExcn& ex) {
00753         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00754         BOOST_MESSAGE(pg.str());
00755         BOOST_REQUIRE(0);
00756     }
00757 
00758     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00759     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00760 
00761     calc.bind(&inTuple, &outTuple);
00762     calc.exec();
00763     printOutput(outTuple, calc);
00764     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
00765 
00766     // varchar common case
00767     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "AEFD"));
00768     // varchar null cases
00769     for (i = 1; i <= 3; i++) {
00770         BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i]));
00771     }
00772     // varchar substr errors
00773     BOOST_CHECK_EQUAL(iter->pc, 4);
00774     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00775     iter++;
00776     // varchar right truncation
00777     BOOST_CHECK_EQUAL(iter->pc, 5);
00778     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00779     iter++;
00780     // char common case
00781     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[5], "GKLJ "));
00782     // char null cases
00783     for (i = 6; i <= 8; i++) {
00784         BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i]));
00785     }
00786     // char substr errors
00787     BOOST_CHECK_EQUAL(iter->pc, 10);
00788     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00789     iter++;
00790     // varchar right truncation
00791     BOOST_CHECK_EQUAL(iter->pc, 11);
00792     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00793     iter++;
00794     BOOST_CHECK(iter == calc.mWarnings.end());
00795 }

void CalcExtStringTest::testCalcExtStringOverlayA5 (  )  [private]

Definition at line 798 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), substrErr, and truncErr.

Referenced by CalcExtStringTest().

00799 {
00800     ostringstream pg(""), outloc("");
00801     int i;
00802 
00803     for (i = 0; i <= 13; i++) {
00804         outloc << "vc,5, ";
00805     }
00806     outloc << "vc,1, vc,1;" << endl;             // right truncate
00807 
00808     pg << "O " << outloc.str();
00809     pg << "L " << outloc.str();
00810     pg << "C vc,5, vc,2, c,5, c,2, s4, s4, ";// data [0-5]
00811     pg << "s4, ";                            // negative [6]
00812     pg << "vc,5, c,5, s4;" << endl;          // nulls [7-9]
00813     pg << "V 0x" << stringToHex("ABCD");
00814     pg << ", 0x" << stringToHex("EF");
00815     pg << ", 0x" << stringToHex("GHIJ ");
00816     pg << ", 0x" << stringToHex("KL");
00817     pg << ", 1, 2,-2,,,;" << endl;
00818     pg << "T;" << endl;
00819     // varchar common case
00820     pg << "CALL 'strOverlayA5(L0, C0, C1, C4, C5);" << endl;
00821     // varchar null cases
00822     pg << "CALL 'strOverlayA5(L1, C7, C1, C4, C5);" << endl;
00823     pg << "CALL 'strOverlayA5(L2, C0, C7, C4, C5);" << endl;
00824     pg << "CALL 'strOverlayA5(L3, C0, C1, C9, C5);" << endl;
00825     pg << "CALL 'strOverlayA5(L4, C0, C1, C4, C9);" << endl;
00826     // varchar substring error
00827     pg << "CALL 'strOverlayA5(L5, C0, C1, C6, C5);" << endl;
00828     pg << "CALL 'strOverlayA5(L6, C0, C1, C4, C6);" << endl;
00829     // varchar right truncate
00830     pg << "CALL 'strOverlayA5(L14, C0, C1, C4, C5);" << endl;
00831 
00832     // char common case
00833     pg << "CALL 'strOverlayA5(L7, C2, C3, C4, C5);" << endl;
00834     // char null cases
00835     pg << "CALL 'strOverlayA5(L8, C8, C3, C4, C5);" << endl;
00836     pg << "CALL 'strOverlayA5(L9, C2, C8, C4, C5);" << endl;
00837     pg << "CALL 'strOverlayA5(L10, C2, C3, C9, C5);" << endl;
00838     pg << "CALL 'strOverlayA5(L11, C2, C3, C4, C9);" << endl;
00839     // char substring error
00840     pg << "CALL 'strOverlayA5(L12, C2, C3, C6, C5);" << endl;
00841     pg << "CALL 'strOverlayA5(L13, C2, C3, C4, C6);" << endl;
00842     // char right truncate
00843     pg << "CALL 'strOverlayA5(L15, C2, C3, C4, C5);" << endl;
00844     // make output available
00845     refLocalOutput(pg, 16);
00846 
00847     Calculator calc(0);
00848 
00849     try {
00850         calc.assemble(pg.str().c_str());
00851     } catch (FennelExcn& ex) {
00852         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00853         BOOST_MESSAGE(pg.str());
00854         BOOST_REQUIRE(0);
00855     }
00856 
00857     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00858     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00859 
00860     calc.bind(&inTuple, &outTuple);
00861     calc.exec();
00862     printOutput(outTuple, calc);
00863     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
00864 
00865     // varchar common case
00866     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "EFCD"));
00867     // varchar null cases
00868     for (i = 1; i <= 4; i++) {
00869         BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i]));
00870     }
00871     // varchar substr errors
00872     BOOST_CHECK_EQUAL(iter->pc, 5);
00873     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00874     iter++;
00875     BOOST_CHECK_EQUAL(iter->pc, 6);
00876     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00877     iter++;
00878     // varchar right truncation
00879     BOOST_CHECK_EQUAL(iter->pc, 7);
00880     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00881     iter++;
00882     // char common case
00883     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[7], "KLIJ "));
00884     // char null cases
00885     for (i = 8; i <= 11; i++) {
00886         BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i]));
00887     }
00888     // char substr errors
00889     BOOST_CHECK_EQUAL(iter->pc, 13);
00890     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00891     iter++;
00892     BOOST_CHECK_EQUAL(iter->pc, 14);
00893     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
00894     iter++;
00895     // char right truncation
00896     BOOST_CHECK_EQUAL(iter->pc, 15);
00897     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
00898     iter++;
00899     BOOST_CHECK(iter == calc.mWarnings.end());
00900 }

void CalcExtStringTest::testCalcExtStringPosA (  )  [private]

Definition at line 903 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupInt(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

00904 {
00905     ostringstream pg(""), outloc("");
00906     int i;
00907 
00908     for (i = 0; i <= 7; i++) {
00909         outloc << "s4, ";
00910     }
00911     outloc << "s4;" << endl;
00912 
00913     pg << "O " << outloc.str();
00914     pg << "L " << outloc.str();
00915     pg << "C vc,5, vc,4, vc,4, ";   // vc data[0-2]
00916     pg << "c,5, c,2, c,2, ";         // c data[3-5]
00917     pg << "vc,5, c,5";              // nulls[6-7]
00918     pg << ";" << endl;
00919     pg << "V 0x" << stringToHex("ABCD");
00920     pg << ", 0x" << stringToHex("BC");
00921     pg << ", 0x" << stringToHex("XX");
00922     pg << ", 0x" << stringToHex("GHIJ ");
00923     pg << ", 0x" << stringToHex("HI");
00924     pg << ", 0x" << stringToHex("XX");
00925     pg << ",,;" << endl;
00926     pg << "T;" << endl;
00927     // varchar common
00928     pg << "CALL 'strPosA(L0, C1, C0);" << endl;
00929     pg << "CALL 'strPosA(L1, C2, C0);" << endl;
00930     // varchar null
00931     pg << "CALL 'strPosA(L2, C1, C6);" << endl;
00932     pg << "CALL 'strPosA(L3, C6, C0);" << endl;
00933     // char common
00934     pg << "CALL 'strPosA(L4, C4, C3);" << endl;
00935     pg << "CALL 'strPosA(L5, C5, C3);" << endl;
00936     // char null
00937     pg << "CALL 'strPosA(L6, C4, C7);" << endl;
00938     pg << "CALL 'strPosA(L7, C7, C3);" << endl;
00939     // make output available
00940     refLocalOutput(pg, 8);
00941 
00942     Calculator calc(0);
00943 
00944     try {
00945         calc.assemble(pg.str().c_str());
00946     } catch (FennelExcn& ex) {
00947         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
00948         BOOST_MESSAGE(pg.str());
00949         BOOST_REQUIRE(0);
00950     }
00951 
00952     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
00953     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
00954 
00955     calc.bind(&inTuple, &outTuple);
00956     calc.exec();
00957     printOutput(outTuple, calc);
00958 
00959     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[0], 2));
00960     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[1], 0));
00961     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
00962     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
00963     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[4], 2));
00964     BOOST_CHECK_EQUAL(0, cmpTupInt(outTuple[5], 0));
00965     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[6]));
00966     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[7]));
00967 }

void CalcExtStringTest::testCalcExtStringSubStringA3 (  )  [private]

Definition at line 970 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and truncErr.

Referenced by CalcExtStringTest().

00971 {
00972     ostringstream pg(""), outloc("");
00973     int i;
00974 
00975     for (i = 0; i <= 5; i++) {
00976         outloc << "vc,5, ";
00977     }
00978     outloc << "vc,1, vc,1;" << endl;    // right truncate
00979 
00980     pg << "O " << outloc.str();
00981     pg << "L " << outloc.str();
00982     pg << "C vc,5, c,5, s4, ";      // data[0-2]
00983     pg << "vc,5, c,5, s4;" << endl; // nulls[3-5]
00984 
00985     pg << "V 0x" << stringToHex("ABCD");
00986     pg << ", 0x" << stringToHex("GHIJ ");
00987     pg << ", 2,,,;" << endl;
00988     pg << "T;" << endl;
00989     // varchar common case
00990     pg << "CALL 'strSubStringA3(L0, C0, C2);" << endl;
00991     // varchar null cases
00992     pg << "CALL 'strSubStringA3(L1, C3, C2);" << endl;
00993     pg << "CALL 'strSubStringA3(L2, C0, C5);" << endl;
00994     // substring error not possible if len is unspecified
00995     // varchar right trunaction
00996     pg << "CALL 'strSubStringA3(L6, C0, C2);" << endl;
00997     // char common case
00998     pg << "CALL 'strSubStringA3(L3, C1, C2);" << endl;
00999     // char null cases
01000     pg << "CALL 'strSubStringA3(L4, C4, C2);" << endl;
01001     pg << "CALL 'strSubStringA3(L5, C1, C5);" << endl;
01002     // substring error not possible if len is unspecified
01003     // char right trunaction
01004     pg << "CALL 'strSubStringA3(L7, C1, C2);" << endl;
01005     // make output available
01006     refLocalOutput(pg, 8);
01007 
01008     Calculator calc(0);
01009 
01010     try {
01011         calc.assemble(pg.str().c_str());
01012     } catch (FennelExcn& ex) {
01013         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01014         BOOST_MESSAGE(pg.str());
01015         BOOST_REQUIRE(0);
01016     }
01017 
01018     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01019     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01020 
01021     calc.bind(&inTuple, &outTuple);
01022     calc.exec();
01023     printOutput(outTuple, calc);
01024     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01025 
01026     // varchar common case
01027     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "BCD"));
01028     // varchar null cases
01029     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[1]));
01030     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
01031     // varchar right truncation
01032     BOOST_CHECK_EQUAL(iter->pc, 3);
01033     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01034     iter++;
01035     // char common case
01036     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[3], "HIJ "));
01037     // char null cases
01038     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[4]));
01039     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
01040     // varchar right truncation
01041     BOOST_CHECK_EQUAL(iter->pc, 7);
01042     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01043     iter++;
01044     BOOST_CHECK(iter == calc.mWarnings.end());
01045 }

void CalcExtStringTest::testCalcExtStringSubStringA4 (  )  [private]

Definition at line 1048 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), substrErr, and truncErr.

Referenced by CalcExtStringTest().

01049 {
01050     ostringstream pg(""), outloc("");
01051     int i;
01052 
01053     for (i = 0; i <= 11; i++) {
01054         outloc << "vc,5, ";
01055     }
01056     outloc << "vc,1, vc,1;" << endl;    // right truncate
01057 
01058     pg << "O " << outloc.str();
01059     pg << "L " << outloc.str();
01060     pg << "C vc,5, c,5, s4, s4, ";  // data[0-3]
01061     pg << "s4, ";                   // negative[4]
01062     pg << "vc,5, c,5, s4;" << endl; // nulls[5-7]
01063     pg << "V 0x" << stringToHex("ABCD");
01064     pg << ", 0x" << stringToHex("GHIJ ");
01065     pg << ", 1, 2, -2,,,;" << endl;
01066     pg << "T;" << endl;
01067     // varchar common case
01068     pg << "CALL 'strSubStringA4(L0, C0, C3, C2);" << endl;
01069     pg << "CALL 'strSubStringA4(L1, C0, C2, C3);" << endl;
01070     // varchar null cases
01071     pg << "CALL 'strSubStringA4(L2, C5, C3, C2);" << endl;
01072     pg << "CALL 'strSubStringA4(L3, C0, C7, C2);" << endl;
01073     pg << "CALL 'strSubStringA4(L4, C0, C3, C7);" << endl;
01074     // varchar substring error
01075     pg << "CALL 'strSubStringA4(L5, C0, C3, C4);" << endl;
01076     // varchar right trunaction
01077     pg << "CALL 'strSubStringA4(L12, C0, C2, C3);" << endl;
01078     // char common case
01079     pg << "CALL 'strSubStringA4(L6, C1, C3, C2);" << endl;
01080     pg << "CALL 'strSubStringA4(L7, C1, C2, C3);" << endl;
01081     // char null cases
01082     pg << "CALL 'strSubStringA4(L8, C6, C3, C2);" << endl;
01083     pg << "CALL 'strSubStringA4(L9, C1, C7, C2);" << endl;
01084     pg << "CALL 'strSubStringA4(L10, C1, C3, C7);" << endl;
01085     // varchar substring error
01086     pg << "CALL 'strSubStringA4(L11, C1, C3, C4);" << endl;
01087     // char right trunaction
01088     pg << "CALL 'strSubStringA4(L13, C1, C2, C3);" << endl;
01089     // make output available
01090     refLocalOutput(pg, 14);
01091 
01092     Calculator calc(0);
01093 
01094     try {
01095         calc.assemble(pg.str().c_str());
01096     } catch (FennelExcn& ex) {
01097         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01098         BOOST_MESSAGE(pg.str());
01099         BOOST_REQUIRE(0);
01100     }
01101 
01102     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01103     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01104 
01105     calc.bind(&inTuple, &outTuple);
01106     calc.exec();
01107     printOutput(outTuple, calc);
01108     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01109 
01110     // varchar common case
01111     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "B"));
01112     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[1], "AB"));
01113     // varchar null cases
01114     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[2]));
01115     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
01116     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[4]));
01117     // varchar substring error
01118     BOOST_CHECK_EQUAL(iter->pc, 5);
01119     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
01120     iter++;
01121     // varchar right truncation
01122     BOOST_CHECK_EQUAL(iter->pc, 6);
01123     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01124     iter++;
01125     // char common case
01126     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[6], "H"));
01127     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[7], "GH"));
01128     // char null cases
01129     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[8]));
01130     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[9]));
01131     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[10]));
01132     // char substring error
01133     BOOST_CHECK_EQUAL(iter->pc, 12);
01134     BOOST_CHECK_EQUAL(0, strcmp(iter->str, substrErr));
01135     iter++;
01136     // char right truncation
01137     BOOST_CHECK_EQUAL(iter->pc, 13);
01138     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01139     iter++;
01140     BOOST_CHECK(iter == calc.mWarnings.end());
01141 }

void CalcExtStringTest::testCalcExtStringToANull (  )  [private]

Definition at line 1147 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), and stringToHex().

Referenced by CalcExtStringTest().

01148 {
01149     ostringstream pg(""), outloc(""), outlocchar("");
01150     int i;
01151 
01152     for (i = 0; i <= 4; i++) {  // [0-4] char
01153         outlocchar << "c,5, ";
01154     }
01155 
01156     for (i = 5; i <= 13; i++) { // [5-14] varchar
01157         outloc << "vc,5, ";
01158     }
01159     outloc << "vc,5;" << endl;
01160 
01161     pg << "O " << outlocchar.str() << outloc.str();
01162     pg << "L " << outlocchar.str() << outloc.str();
01163     pg << "C vc,5, c,5, s4, vc,5, c,5;" << endl;    // data[0-2], null [3-4]
01164     pg << "V 0x" << stringToHex(" abc ");   // vc const
01165     pg << ", 0x" << stringToHex(" hij ");   // char const
01166     pg << ", 1,,;" << endl;
01167     pg << "T;" << endl;
01168 
01169     for (i = 0; i <= 14; i++) {
01170         pg << "TONULL L" << i << ";" << endl;
01171     }
01172 
01173     // char cases
01174     pg << "CALL 'strCatA2(L0, C1);" << endl;
01175     pg << "CALL 'strCatA3(L1, C1, C1);" << endl;
01176     pg << "CALL 'strCpyA(L2, C1);" << endl;
01177     pg << "CALL 'strToLowerA(L3, C1);" << endl;
01178     pg << "CALL 'strToUpperA(L4, C1);" << endl;
01179 
01180     // varchar cases
01181     pg << "CALL 'strCatA2(L5, C0);" << endl;
01182     pg << "CALL 'strCatA3(L6, C0, C0);" << endl;
01183     pg << "CALL 'strCpyA(L7, C0);" << endl;
01184     pg << "CALL 'strOverlayA4(L8, C0, C0, C2);" << endl;
01185     pg << "CALL 'strOverlayA5(L9, C0, C0, C2, C2);" << endl;
01186     pg << "CALL 'strSubStringA3(L10, C0, C2);" << endl;
01187     pg << "CALL 'strSubStringA4(L11, C0, C2, C2);" << endl;
01188     pg << "CALL 'strToLowerA(L12, C0);" << endl;
01189     pg << "CALL 'strToUpperA(L13, C0);" << endl;
01190     pg << "CALL 'strTrimA(L14, C0, C0, C2, C2);" << endl; // trim both
01191 
01192     // make output available
01193     refLocalOutput(pg, 15);
01194     Calculator calc(0);
01195 
01196     try {
01197         calc.assemble(pg.str().c_str());
01198     } catch (FennelExcn& ex) {
01199         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01200         BOOST_MESSAGE(pg.str());
01201         BOOST_REQUIRE(0);
01202     }
01203 
01204     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01205     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01206 
01207     calc.bind(&inTuple, &outTuple);
01208     calc.exec();
01209     printOutput(outTuple, calc);
01210 
01211     for (i = 0; i <= 14 ;i++) {
01212         BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i]));
01213     }
01214 
01215     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01216     deque<CalcMessage>::iterator end = calc.mWarnings.end();
01217 
01218     BOOST_CHECK(iter == end);
01219 }

void CalcExtStringTest::testCalcExtStringToLower (  )  [private]

Definition at line 1223 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and truncErr.

Referenced by CalcExtStringTest().

01224 {
01225     ostringstream pg(""), outloc("");
01226     int i;
01227 
01228     for (i = 0; i <= 1; i++) {
01229         outloc << "vc,5, ";
01230     }
01231     for (i = 1; i <= 2; i++) {
01232         outloc << "c,5, ";
01233     }
01234     outloc << "vc,1;" << endl;      // right truncate
01235 
01236     pg << "O " << outloc.str();
01237     pg << "L " << outloc.str();
01238     pg << "C vc,5, c,5, ";      // data[0-1]
01239     pg << "vc,5, c,5;" << endl; // nulls[2-3]
01240     pg << "V 0x" << stringToHex("ABC");
01241     pg << ", 0x" << stringToHex("GHIJ ");
01242     pg << ",,;" << endl;
01243     pg << "T;" << endl;
01244     // varchar common case
01245     pg << "CALL 'strToLowerA(L0, C0);" << endl;
01246     // varchar null case
01247     pg << "CALL 'strToLowerA(L1, C2);" << endl;
01248     // varchar right truncation
01249     pg << "CALL 'strToLowerA(L4, C0);" << endl;
01250     // char common case
01251     pg << "CALL 'strToLowerA(L2, C1);" << endl;
01252     // char null case
01253     pg << "CALL 'strToLowerA(L3, C3);" << endl;
01254     // right truncation not possible in fixed width, as both
01255     // strings must be same length by definition.
01256     // make output available
01257     refLocalOutput(pg, 5);
01258 
01259     Calculator calc(0);
01260 
01261     try {
01262         calc.assemble(pg.str().c_str());
01263     } catch (FennelExcn& ex) {
01264         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01265         BOOST_MESSAGE(pg.str());
01266         BOOST_REQUIRE(0);
01267     }
01268 
01269     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01270     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01271 
01272     calc.bind(&inTuple, &outTuple);
01273     calc.exec();
01274     printOutput(outTuple, calc);
01275     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01276 
01277     // varchar common case
01278     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "abc"));
01279     // varchar null case
01280     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[1]));
01281     // varchar right truncation
01282     BOOST_CHECK_EQUAL(iter->pc, 2);
01283     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01284     iter++;
01285     BOOST_CHECK(iter == calc.mWarnings.end());
01286     // char common case
01287     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[2], "ghij "));
01288     // varchar null case
01289     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
01290 }

void CalcExtStringTest::testCalcExtStringToUpper (  )  [private]

Definition at line 1293 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and truncErr.

Referenced by CalcExtStringTest().

01294 {
01295     ostringstream pg(""), outloc("");
01296     int i;
01297 
01298     for (i = 0; i <= 1; i++) {
01299         outloc << "vc,5, ";
01300     }
01301     for (i = 1; i <= 2; i++) {
01302         outloc << "c,5, ";
01303     }
01304     outloc << "vc,1;" << endl;      // right truncate
01305 
01306     pg << "O " << outloc.str();
01307     pg << "L " << outloc.str();
01308     pg << "C vc,5, c,5, ";      // data[0-1]
01309     pg << "vc,5, c,5;" << endl; // nulls[2-3]
01310     pg << "V 0x" << stringToHex("abc");
01311     pg << ", 0x" << stringToHex("ghij ");
01312     pg << ",,;" << endl;
01313     pg << "T;" << endl;
01314     // varchar common case
01315     pg << "CALL 'strToUpperA(L0, C0);" << endl;
01316     // varchar null case
01317     pg << "CALL 'strToUpperA(L1, C2);" << endl;
01318     // varchar right truncation
01319     pg << "CALL 'strToUpperA(L4, C0);" << endl;
01320     // char common case
01321     pg << "CALL 'strToUpperA(L2, C1);" << endl;
01322     // char null case
01323     pg << "CALL 'strToUpperA(L3, C3);" << endl;
01324     // right truncation not possible in fixed width, as both
01325     // strings must be same length by definition.
01326     // make output available
01327     refLocalOutput(pg, 5);
01328 
01329     Calculator calc(0);
01330 
01331     try {
01332         calc.assemble(pg.str().c_str());
01333     } catch (FennelExcn& ex) {
01334         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01335         BOOST_MESSAGE(pg.str());
01336         BOOST_REQUIRE(0);
01337     }
01338 
01339     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01340     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01341 
01342     calc.bind(&inTuple, &outTuple);
01343     calc.exec();
01344     printOutput(outTuple, calc);
01345     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01346 
01347     // varchar common case
01348     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "ABC"));
01349     // varchar null case
01350     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[1]));
01351     // varchar right truncation
01352     BOOST_CHECK_EQUAL(iter->pc, 2);
01353     BOOST_CHECK_EQUAL(0, strcmp(iter->str, truncErr));
01354     iter++;
01355     BOOST_CHECK(iter == calc.mWarnings.end());
01356     // char common case
01357     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[2], "GHIJ "));
01358     // varchar null case
01359     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[3]));
01360 }

void CalcExtStringTest::testCalcExtStringTrim (  )  [private]

Definition at line 1363 of file CalcExtStringTest.cpp.

References Calculator::assemble(), Calculator::bind(), cmpTupNull(), cmpTupStr(), Calculator::exec(), Calculator::getInputRegisterDescriptor(), FennelExcn::getMessage(), Calculator::getOutputRegisterDescriptor(), Calculator::mWarnings, printOutput(), refLocalOutput(), stringToHex(), and Calculator::warnings().

Referenced by CalcExtStringTest().

01364 {
01365     ostringstream pg(""), outloc("");
01366     int i;
01367 
01368     for (i = 0; i <= 28; i++) {
01369         outloc << "vc,10, ";
01370     }
01371     outloc << "vc,10;" << endl;
01372 
01373     pg << "O " << outloc.str();
01374     pg << "L " << outloc.str();
01375     pg << "C vc,5, c,5, s4, s4, ";         // data[0-3]
01376     pg << "vc,5, c,5, s4, ";               // nulls[4-6]
01377     pg << "c,1, vc,1, vc,1, vc,2, vc,1, "; // trimchar[7-11]
01378     pg << "vc,10;" << endl;                // data[12]
01379     pg << "V 0x" << stringToHex(" abc ");   // vc const
01380     pg << ", 0x" << stringToHex(" hij ");   // char const
01381     pg << ", 1, 0,,,";
01382     pg << ", 0x" << stringToHex(" ");  // space trimchar char
01383     pg << ", 0x" << stringToHex(" ");  // space trimchar varchar
01384     pg << ", 0x" << stringToHex("");   // invalid zero length trimchar
01385     pg << ", 0x" << stringToHex(" a"); // invalid two char length trimchar
01386     pg << ", 0x" << stringToHex("x");  // x as trimchar
01387     pg << ", 0x" << stringToHex("xx pqr xx"); // data[12]
01388     pg << ";" << endl;
01389     pg << "T;" << endl;
01390 
01391     // all varchar common cases
01392     pg << "CALL 'strTrimA(L0, C0, C8, C2, C2);" << endl; // trim both
01393     pg << "CALL 'strTrimA(L1, C0, C8, C2, C3);" << endl; // trim left
01394     pg << "CALL 'strTrimA(L2, C0, C8, C3, C2);" << endl; // trim right
01395     pg << "CALL 'strTrimA(L3, C0, C8, C3, C3);" << endl; // trim none
01396     // all varchar null cases
01397     pg << "CALL 'strTrimA(L4, C0, C4, C2, C2);" << endl;
01398     pg << "CALL 'strTrimA(L5, C4, C8, C2, C2);" << endl;
01399     pg << "CALL 'strTrimA(L6, C0, C8, C6, C2);" << endl;
01400     pg << "CALL 'strTrimA(L7, C0, C8, C2, C6);" << endl;
01401     // all char common cases
01402     pg << "CALL 'strTrimA(L8, C1, C7, C2, C2);" << endl; // trim both
01403     pg << "CALL 'strTrimA(L9, C1, C7, C2, C3);" << endl; // trim left
01404     pg << "CALL 'strTrimA(L10, C1, C7, C3, C2);" << endl; // trim right
01405     pg << "CALL 'strTrimA(L11, C1, C7, C3, C3);" << endl; // trim none
01406     // all char null cases
01407     pg << "CALL 'strTrimA(L12, C5, C7, C2, C2);" << endl;
01408     pg << "CALL 'strTrimA(L13, C1, C5, C2, C2);" << endl;
01409     pg << "CALL 'strTrimA(L14, C1, C7, C6, C2);" << endl;
01410     pg << "CALL 'strTrimA(L15, C1, C7, C2, C6);" << endl;
01411     // mixed varchar/char common cases
01412     pg << "CALL 'strTrimA(L16, C0, C7, C2, C2);" << endl; // trim both
01413     pg << "CALL 'strTrimA(L17, C1, C7, C2, C2);" << endl;
01414     pg << "CALL 'strTrimA(L18, C0, C8, C2, C2);" << endl;
01415     pg << "CALL 'strTrimA(L19, C1, C8, C2, C2);" << endl;
01416     // mixed varchar/char null cases
01417     pg << "CALL 'strTrimA(L20, C4, C7, C2, C2);" << endl; // vc,vcN,c
01418     pg << "CALL 'strTrimA(L21, C0, C5, C2, C2);" << endl; // vc,vc,cN
01419     pg << "CALL 'strTrimA(L22, C1, C4, C6, C2);" << endl; // vc,c,vcN
01420     pg << "CALL 'strTrimA(L23, C5, C8, C2, C6);" << endl; // vc,cN,vc
01421 
01422     // An error is thrown in the extended instruction (as opposed to
01423     // in the string library), so it needs to be tested
01424     // here. (Exceptions thrown in the string library are tested in
01425     // the string library unit test>)
01426 
01427     // invalid trim characters
01428     pg << "CALL 'strTrimA(L24, C0, C9, C2, C2);"
01429        << endl; // zero char length trimchar
01430     pg << "CALL 'strTrimA(L25, C0, C10, C2, C2);"
01431        << endl; // two char length trimchar
01432 
01433     // all varchar common cases with other trim char
01434     pg << "CALL 'strTrimA(L26, C12, C11, C2, C2);" << endl; // trim both
01435     pg << "CALL 'strTrimA(L27, C12, C11, C2, C3);" << endl; // trim left
01436     pg << "CALL 'strTrimA(L28, C12, C11, C3, C2);" << endl; // trim right
01437     pg << "CALL 'strTrimA(L29, C12, C11, C3, C3);" << endl; // trim none
01438 
01439     // make output available
01440     refLocalOutput(pg, 30);
01441 
01442     Calculator calc(0);
01443 
01444     try {
01445         calc.assemble(pg.str().c_str());
01446     } catch (FennelExcn& ex) {
01447         BOOST_MESSAGE("Assemble exception " << ex.getMessage());
01448         BOOST_MESSAGE(pg.str());
01449         BOOST_REQUIRE(0);
01450     }
01451 
01452     TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor());
01453     TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor());
01454 
01455     calc.bind(&inTuple, &outTuple);
01456     calc.exec();
01457     printOutput(outTuple, calc);
01458     BOOST_MESSAGE("Calculator Warnings: |" << calc.warnings() << "|");
01459 
01460     // varchar common cases
01461     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[0], "abc"));
01462     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[1], "abc "));
01463     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[2], " abc"));
01464     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[3], " abc "));
01465     // varchar null cases
01466     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[4]));
01467     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[5]));
01468     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[6]));
01469     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[7]));
01470 
01471     // char common cases
01472     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[8], "hij"));
01473     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[9], "hij "));
01474     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[10], " hij"));
01475     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[11], " hij "));
01476     // char null cases
01477     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[12]));
01478     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[13]));
01479     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[14]));
01480     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[15]));
01481 
01482     // mixed varchar/char common cases
01483     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[16], "abc"));
01484     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[17], "hij"));
01485     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[18], "abc"));
01486     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[19], "hij"));
01487     // mixed varchar/char null cases
01488     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[20]));
01489     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[21]));
01490     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[22]));
01491     BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[23]));
01492 
01493     // check warning from invalid trim character
01494     deque<CalcMessage>::iterator iter = calc.mWarnings.begin();
01495     deque<CalcMessage>::iterator end = calc.mWarnings.end();
01496 
01497     BOOST_CHECK(iter != end);
01498     BOOST_CHECK_EQUAL(iter->pc, 24);
01499     BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22027"));
01500     iter++;
01501     BOOST_CHECK_EQUAL(iter->pc, 25);
01502     BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22027"));
01503     iter++;
01504     BOOST_CHECK(iter == end);
01505 
01506     // varchar common cases with other trim char
01507     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[26], " pqr "));
01508     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[27], " pqr xx"));
01509     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[28], "xx pqr "));
01510     BOOST_CHECK_EQUAL(0, cmpTupStr(outTuple[29], "xx pqr xx"));
01511 
01512 }

int CalcExtStringTest::cmpTupStr ( TupleDatum const &  tup,
char const *const  str 
) [private]

Definition at line 114 of file CalcExtStringTest.cpp.

References TupleDatum::cbData, and TupleDatum::pData.

Referenced by testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToLower(), testCalcExtStringToUpper(), and testCalcExtStringTrim().

00117 {
00118     int len = strlen(str);
00119     BOOST_CHECK_EQUAL(len, tup.cbData);
00120     return strncmp(
00121         reinterpret_cast<char *>(const_cast<PBuffer>(tup.pData)),
00122         str,
00123         len);
00124 }

int CalcExtStringTest::cmpTupInt ( TupleDatum const &  tup,
int  val 
) [private]

Definition at line 127 of file CalcExtStringTest.cpp.

References TupleDatum::pData.

Referenced by testCalcExtStringCmpA(), testCalcExtStringCmpOct(), testCalcExtStringLenBitA(), testCalcExtStringLenCharA(), testCalcExtStringLenOctA(), and testCalcExtStringPosA().

00130 {
00131     return *(reinterpret_cast<int*>(
00132         const_cast<PBuffer>(tup.pData)))
00133         - val;
00134 }

int CalcExtStringTest::cmpTupNull ( TupleDatum const &  tup  )  [private]

Definition at line 137 of file CalcExtStringTest.cpp.

References TupleDatum::pData.

Referenced by testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringCmpA(), testCalcExtStringCmpOct(), testCalcExtStringLenBitA(), testCalcExtStringLenCharA(), testCalcExtStringLenOctA(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringPosA(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToANull(), testCalcExtStringToLower(), testCalcExtStringToUpper(), and testCalcExtStringTrim().

00138 {
00139     if ((const_cast<PBuffer>(tup.pData)) == NULL) {
00140         return 1;
00141     }
00142     return 0;
00143 }

void CalcExtStringTest::printOutput ( TupleData const &  tup,
Calculator const &  calc 
) [private]

Definition at line 147 of file CalcExtStringTest.cpp.

References Calculator::getOutputRegisterDescriptor(), and TuplePrinter::print().

Referenced by testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringCmpA(), testCalcExtStringCmpOct(), testCalcExtStringLenBitA(), testCalcExtStringLenCharA(), testCalcExtStringLenOctA(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringPosA(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToANull(), testCalcExtStringToLower(), testCalcExtStringToUpper(), and testCalcExtStringTrim().

00150 {
00151 #if 0
00152     TuplePrinter tuplePrinter;
00153     tuplePrinter.print(cout, calc.getOutputRegisterDescriptor(), tup);
00154     cout << endl;
00155 #endif
00156 }

void CalcExtStringTest::refLocalOutput ( ostringstream &  pg,
int  count 
) [private]

Definition at line 160 of file CalcExtStringTest.cpp.

Referenced by testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringCmpA(), testCalcExtStringCmpOct(), testCalcExtStringLenBitA(), testCalcExtStringLenCharA(), testCalcExtStringLenOctA(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringPosA(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToANull(), testCalcExtStringToLower(), testCalcExtStringToUpper(), and testCalcExtStringTrim().

00163 {
00164     int i;
00165 
00166     for (i = 0; i < count; i++) {
00167         pg << "REF O" << i << ", L" << i << ";" << endl;
00168     }
00169 }

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

const char * CalcExtStringTest::truncErr [static, private]

Definition at line 75 of file CalcExtStringTest.cpp.

Referenced by testCalcExtStringCatA2(), testCalcExtStringCatA3(), testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), testCalcExtStringSubStringA3(), testCalcExtStringSubStringA4(), testCalcExtStringToLower(), and testCalcExtStringToUpper().

const char * CalcExtStringTest::substrErr [static, private]

Definition at line 76 of file CalcExtStringTest.cpp.

Referenced by testCalcExtStringOverlayA4(), testCalcExtStringOverlayA5(), and testCalcExtStringSubStringA4().

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:28 2009 for Fennel by  doxygen 1.5.1