Fennel: CalcExtRegExpTest Class Reference (original) (raw)

Inheritance diagram for CalcExtRegExpTest:

List of all members.

Public Member Functions
CalcExtRegExpTest ()
virtual ~CalcExtRegExpTest ()
TestSuite * releaseTestSuite ()
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.
TraceTarget & getTraceTarget () 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
TestSuite * pTestSuite
Boost test suite.
boost::shared_ptr< TestBase > pTestObj
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 testCalcExtRegExpLikeAVarChar ()
void testCalcExtRegExpLikeAChar ()
void testCalcExtRegExpSimilarAVarChar ()
void testCalcExtRegExpSimilarAChar ()
void likeHelper (TupleDataWithBuffer const &outTuple, bool const *exp, int validoutputs, int nulloutputs, deque< CalcMessage > dq)
void similarHelper (TupleDataWithBuffer const &outTuple, bool const *exp, int validoutputs, int nulloutputs, deque< CalcMessage > dq)
int cmpTupStr (TupleDatum const &tup, char const *const str)
int cmpTupInt (TupleDatum const &tup, int val)
int cmpTupBool (TupleDatum const &tup, bool 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 CalcExtRegExpTest.cpp.


Constructor & Destructor Documentation

| CalcExtRegExpTest::CalcExtRegExpTest | ( | | ) | [inline, explicit] | | ------------------------------------ | - | | - | -------------------- |

| virtual CalcExtRegExpTest::~CalcExtRegExpTest | ( | | ) | [inline, virtual] | | ---------------------------------------------- | - | | - | ------------------- |


Member Function Documentation

| void CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar | ( | | ) | [private] | | ----------------------------------------------------- | - | | - | ----------- |

Definition at line 226 of file CalcExtRegExpTest.cpp.

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

Referenced by CalcExtRegExpTest().

00227 { 00228 ostringstream pg(""), outloc(""), constants(""); 00229 int i; 00230 int outputs = 23; 00231 00232 bool exp[40]; 00233 BOOST_REQUIRE((sizeof(exp) / sizeof(bool)) >= outputs); 00234 00235 for (i = 0; i < outputs - 1; i++) { 00236 outloc << "bo, "; 00237 } 00238 outloc << "bo;" << endl; 00239
00240 00241 for (i = 0; i <= 9; i++) { 00242 constants << "vc,5, "; 00243 } 00244 constants << "vc,5;" << endl; 00245 00246 pg << "O " << outloc.str(); 00247 pg << "L " << outloc.str(); 00248 pg << "C " << constants.str(); 00249 pg << "V 0x" << stringToHex("");
00250 pg << ", 0x" << stringToHex("%");
00251 pg << ", 0x" << stringToHex("=");
00252 pg << ", 0x" << stringToHex("=
"); 00253 pg << ", 0x" << stringToHex("=%"); 00254 pg << ", 0x" << stringToHex("ab"); 00255 pg << ", 0x" << stringToHex("ba"); 00256 pg << ", 0x" << stringToHex("a%"); 00257 pg << ", 0x" << stringToHex("a_"); 00258 pg << ", 0x" << stringToHex("");
00259 pg << ",;" << endl;
00260 pg << "T;" << endl; 00261 00262
00263
00264 00265
00266
00267 pg << "CALL 'strLikeA3(L0, C5, C1);" << endl; exp[0] = true; 00268 pg << "CALL 'strLikeA3(L1, C5, C0);" << endl; exp[1] = false; 00269 pg << "CALL 'strLikeA3(L2, C5, C7);" << endl; exp[2] = true; 00270 pg << "CALL 'strLikeA3(L3, C6, C7);" << endl; exp[3] = false; 00271 pg << "CALL 'strLikeA3(L4, C5, C8);" << endl; exp[4] = true; 00272 pg << "CALL 'strLikeA3(L5, C6, C8);" << endl; exp[5] = false; 00273 pg << "CALL 'strLikeA3(L6, C0, C0);" << endl; exp[6] = true; 00274 pg << "CALL 'strLikeA3(L7, C0, C1);" << endl; exp[7] = true; 00275 00276
00277 pg << "CALL 'strLikeA4(L8, C5, C0, C2);" << endl; exp[8] = false; 00278 pg << "CALL 'strLikeA4(L9, C5, C1, C2);" << endl; exp[9] = true; 00279 pg << "CALL 'strLikeA4(L10, C5, C3, C2);" << endl; exp[10] = false; 00280 pg << "CALL 'strLikeA4(L11, C0, C3, C2);" << endl; exp[11] = true; 00281 pg << "CALL 'strLikeA4(L12, C5, C4, C2);" << endl; exp[12] = false; 00282 pg << "CALL 'strLikeA4(L13, C0, C4, C2);" << endl; exp[13] = false; 00283 pg << "CALL 'strLikeA4(L14, C1, C4, C2);" << endl; exp[14] = true; 00284 int validoutputs = 15; 00285 00286
00287 pg << "CALL 'strLikeA3(L15, C10, C1);" << endl; 00288 pg << "CALL 'strLikeA3(L16, C5, C10);" << endl; 00289 00290
00291 pg << "CALL 'strLikeA4(L17, C10, C1, C2);" << endl; 00292 pg << "CALL 'strLikeA4(L18, C5, C10, C2);" << endl; 00293 pg << "CALL 'strLikeA4(L19, C5, C1, C10);" << endl; 00294 int nulloutputs = 20; 00295 00296
00297
00298 pg << "CALL 'strLikeA4(L20, C5, C1, C4);" << endl; 00299
00300 pg << "CALL 'strLikeA4(L21, C5, C1, C9);" << endl; 00301
00302 pg << "CALL 'strLikeA4(L22, C5, C2, C2);" << endl; 00303 00304 00305 refLocalOutput(pg, outputs); 00306 00307 Calculator calc(0); 00308 00309 try { 00310 calc.assemble(pg.str().c_str()); 00311 } catch (FennelExcn& ex) { 00312 BOOST_MESSAGE("Assemble exception " << ex.getMessage()); 00313 BOOST_MESSAGE(pg.str()); 00314 BOOST_FAIL("assembler error"); 00315 } 00316 00317 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00318 TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor()); 00319 00320 calc.bind(&inTuple, &outTuple); 00321 calc.exec(); 00322 printOutput(outTuple, calc); 00323 00324 likeHelper( 00325 outTuple, exp, validoutputs, nulloutputs, 00326 calc.mWarnings); 00327 00328 00329
00330
00331 calc.exec(); 00332 likeHelper( 00333 outTuple, exp, validoutputs, nulloutputs, 00334 calc.mWarnings); 00335 }

| void CalcExtRegExpTest::testCalcExtRegExpLikeAChar | ( | | ) | [private] | | -------------------------------------------------- | - | | - | ----------- |

Definition at line 338 of file CalcExtRegExpTest.cpp.

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

Referenced by CalcExtRegExpTest().

00339 { 00340 ostringstream pg(""); 00341 00342 pg << "O bo, bo, bo, bo, bo, bo, bo, bo;" << endl; 00343 pg << "L bo, bo, bo, bo, bo, bo, bo, bo;" << endl; 00344 pg << "C c,1, c,2, c,1, vc,1, vc,2, vc,1;" << endl; 00345 pg << "V 0x" << stringToHex("%");
00346 pg << ", 0x" << stringToHex("ab"); 00347 pg << ", 0x" << stringToHex("=");
00348 pg << ", 0x" << stringToHex("%");
00349 pg << ", 0x" << stringToHex("ab"); 00350 pg << ", 0x" << stringToHex("=");
00351 pg << ";" << endl; 00352 pg << "T;" << endl; 00353 00354
00355 pg << "CALL 'strLikeA4(L0, C1, C0, C2);" << endl;
00356 pg << "CALL 'strLikeA4(L1, C0, C1, C2);" << endl;
00357 00358
00359 pg << "CALL 'strLikeA3(L2, C1, C0);" << endl;
00360 pg << "CALL 'strLikeA3(L3, C0, C1);" << endl;
00361 00362
00363 pg << "CALL 'strLikeA4(L4, C1, C3, C2);" << endl;
00364 pg << "CALL 'strLikeA4(L5, C4, C0, C2);" << endl;
00365 00366
00367 pg << "CALL 'strLikeA3(L6, C1, C3);" << endl;
00368 pg << "CALL 'strLikeA3(L7, C4, C0);" << endl;
00369 00370 refLocalOutput(pg, 8); 00371 00372 Calculator calc(0); 00373 00374 try { 00375 calc.assemble(pg.str().c_str()); 00376 } catch (FennelExcn& ex) { 00377 BOOST_MESSAGE("Assemble exception " << ex.getMessage()); 00378 BOOST_MESSAGE(pg.str()); 00379 BOOST_FAIL("assembler error"); 00380 } 00381 00382 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00383 TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor()); 00384 00385 calc.bind(&inTuple, &outTuple); 00386 calc.exec(); 00387 printOutput(outTuple, calc); 00388 00389 int i; 00390 BOOST_CHECK(calc.mWarnings.begin() == calc.mWarnings.end()); 00391 for (i = 0; i < 8; i++) { 00392 if (i == 1 || i == 3) { 00393 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], false)); 00394 } else { 00395 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], true)); 00396 } 00397 } 00398 00399
00400
00401 calc.exec(); 00402 BOOST_CHECK(calc.mWarnings.begin() == calc.mWarnings.end()); 00403 for (i = 0; i < 8; i++) { 00404 if (i == 1 || i == 3) { 00405 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], false)); 00406 } else { 00407 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], true)); 00408 } 00409 } 00410 }

| void CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar | ( | | ) | [private] | | -------------------------------------------------------- | - | | - | ----------- |

Definition at line 472 of file CalcExtRegExpTest.cpp.

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

Referenced by CalcExtRegExpTest().

00473 { 00474 ostringstream pg(""), outloc(""), constants(""); 00475 int i; 00476 int outputs = 26; 00477 00478 bool exp[40]; 00479 BOOST_REQUIRE((sizeof(exp) / sizeof(bool)) >= outputs); 00480 00481 for (i = 0; i < outputs - 1; i++) { 00482 outloc << "bo, "; 00483 } 00484 outloc << "bo;" << endl; 00485
00486 00487 for (i = 0; i <= 14; i++) { 00488 constants << "vc,20, "; 00489 } 00490 constants << "vc,20;" << endl; 00491 00492 pg << "O " << outloc.str(); 00493 pg << "L " << outloc.str(); 00494 pg << "C " << constants.str(); 00495 pg << "V 0x" << stringToHex("");
00496 pg << ", 0x" << stringToHex("%");
00497 pg << ", 0x" << stringToHex("=");
00498 pg << ", 0x" << stringToHex("=
"); 00499 pg << ", 0x" << stringToHex("=%"); 00500 pg << ", 0x" << stringToHex("ab"); 00501 pg << ", 0x" << stringToHex("ba"); 00502 pg << ", 0x" << stringToHex("a%"); 00503 pg << ", 0x" << stringToHex("a_"); 00504 pg << ", 0x" << stringToHex("");
00505 pg << ", 0x" << stringToHex(":");
00506 pg << ", 0x" << stringToHex("[[:ALPHA:]]");
00507 pg << ", 0x" << stringToHex("=a"); 00508 pg << ", 0x" << stringToHex("%a"); 00509 pg << ", 0x" << stringToHex("{}"); 00510 pg << ",;" << endl;
00511 pg << "T;" << endl; 00512 00513
00514
00515 00516
00517
00518 pg << "CALL 'strSimilarA3(L0, C5, C1);" << endl; exp[0] = true; 00519 pg << "CALL 'strSimilarA3(L1, C5, C0);" << endl; exp[1] = false; 00520 pg << "CALL 'strSimilarA3(L2, C5, C7);" << endl; exp[2] = true; 00521 pg << "CALL 'strSimilarA3(L3, C6, C7);" << endl; exp[3] = false; 00522 pg << "CALL 'strSimilarA3(L4, C5, C8);" << endl; exp[4] = true; 00523 pg << "CALL 'strSimilarA3(L5, C6, C8);" << endl; exp[5] = false; 00524 pg << "CALL 'strSimilarA3(L6, C0, C0);" << endl; exp[6] = true; 00525 pg << "CALL 'strSimilarA3(L7, C0, C1);" << endl; exp[7] = true; 00526 00527
00528 pg << "CALL 'strSimilarA4(L8, C5, C0, C2);" << endl; exp[8] = false; 00529 pg << "CALL 'strSimilarA4(L9, C5, C1, C2);" << endl; exp[9] = true; 00530 pg << "CALL 'strSimilarA4(L10, C5, C3, C2);" << endl; exp[10] = false; 00531 pg << "CALL 'strSimilarA4(L11, C0, C3, C2);" << endl; exp[11] = true; 00532 pg << "CALL 'strSimilarA4(L12, C5, C4, C2);" << endl; exp[12] = false; 00533 pg << "CALL 'strSimilarA4(L13, C0, C4, C2);" << endl; exp[13] = false; 00534 pg << "CALL 'strSimilarA4(L14, C1, C4, C2);" << endl; exp[14] = true; 00535 int validoutputs = 15; 00536 00537
00538 pg << "CALL 'strSimilarA3(L15, C15, C1);" << endl; 00539 pg << "CALL 'strSimilarA3(L16, C5, C15);" << endl; 00540 00541 pg << "CALL 'strSimilarA4(L17, C15, C1, C9);" << endl; 00542 pg << "CALL 'strSimilarA4(L18, C5, C15, C9);" << endl; 00543 pg << "CALL 'strSimilarA4(L19, C5, C1, C15);" << endl; 00544 int nulloutputs = 20; 00545 00546
00547
00548 pg << "CALL 'strSimilarA4(L20, C5, C11, C10);" << endl; 00549
00550 pg << "CALL 'strSimilarA4(L21, C5, C1, C4);" << endl; 00551
00552 pg << "CALL 'strSimilarA4(L22, C5, C1, C9);" << endl; 00553
00554 pg << "CALL 'strSimilarA4(L23, C5, C2, C2);" << endl; 00555
00556 pg << "CALL 'strSimilarA4(L24, C5, C13, C1);" << endl; 00557
00558 pg << "CALL 'strSimilarA4(L25, C5, C14, C1);" << endl; 00559 00560 00561 refLocalOutput(pg, outputs); 00562 00563 Calculator calc(0); 00564 00565 try { 00566 calc.assemble(pg.str().c_str()); 00567 } catch (FennelExcn& ex) { 00568 BOOST_MESSAGE("Assemble exception " << ex.getMessage()); 00569 BOOST_MESSAGE(pg.str()); 00570 BOOST_FAIL("assembler error"); 00571 } 00572 00573 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00574 TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor()); 00575 00576 calc.bind(&inTuple, &outTuple); 00577 calc.exec(); 00578 printOutput(outTuple, calc); 00579 00580 similarHelper( 00581 outTuple, exp, validoutputs, nulloutputs, 00582 calc.mWarnings); 00583 00584 00585
00586
00587 calc.exec(); 00588 similarHelper( 00589 outTuple, exp, validoutputs, nulloutputs, 00590 calc.mWarnings); 00591 }

| void CalcExtRegExpTest::testCalcExtRegExpSimilarAChar | ( | | ) | [private] | | ----------------------------------------------------- | - | | - | ----------- |

Definition at line 594 of file CalcExtRegExpTest.cpp.

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

Referenced by CalcExtRegExpTest().

00595 { 00596 ostringstream pg(""); 00597 00598 pg << "O bo, bo, bo, bo, bo, bo, bo, bo;" << endl; 00599 pg << "L bo, bo, bo, bo, bo, bo, bo, bo;" << endl; 00600 pg << "C c,1, c,2, c,1, vc,1, vc,2, vc,1 ;" << endl; 00601 pg << "V 0x" << stringToHex("%");
00602 pg << ", 0x" << stringToHex("ab"); 00603 pg << ", 0x" << stringToHex("=");
00604 pg << ", 0x" << stringToHex("%");
00605 pg << ", 0x" << stringToHex("ab"); 00606 pg << ", 0x" << stringToHex("=");
00607 pg << ";" << endl; 00608 pg << "T;" << endl; 00609 00610
00611 pg << "CALL 'strSimilarA4(L0, C1, C0, C2);" << endl; 00612 pg << "CALL 'strSimilarA4(L1, C0, C1, C2);" << endl; 00613 00614
00615 pg << "CALL 'strSimilarA3(L2, C1, C0);" << endl; 00616 pg << "CALL 'strSimilarA3(L3, C0, C1);" << endl; 00617 00618
00619 pg << "CALL 'strSimilarA4(L4, C1, C3, C2);" << endl;
00620 pg << "CALL 'strSimilarA4(L5, C4, C0, C2);" << endl;
00621 00622
00623 pg << "CALL 'strSimilarA3(L6, C1, C3);" << endl;
00624 pg << "CALL 'strSimilarA3(L7, C4, C0);" << endl;
00625 00626 refLocalOutput(pg, 8); 00627 00628 Calculator calc(0); 00629 00630 try { 00631 calc.assemble(pg.str().c_str()); 00632 } catch (FennelExcn& ex) { 00633 BOOST_MESSAGE("Assemble exception " << ex.getMessage()); 00634 BOOST_MESSAGE(pg.str()); 00635 BOOST_FAIL("assembler error"); 00636 } 00637 00638 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00639 TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor()); 00640 00641 calc.bind(&inTuple, &outTuple); 00642 calc.exec(); 00643 printOutput(outTuple, calc); 00644 00645 int i; 00646 BOOST_CHECK(calc.mWarnings.begin() == calc.mWarnings.end()); 00647 for (i = 0; i < 8; i++) { 00648 if (i == 1 || i == 3) { 00649 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], false)); 00650 } else { 00651 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], true)); 00652 } 00653 } 00654 00655
00656
00657 calc.exec(); 00658 BOOST_CHECK(calc.mWarnings.begin() == calc.mWarnings.end()); 00659 for (i = 0; i < 8; i++) { 00660 if (i == 1 || i == 3) { 00661 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], false)); 00662 } else { 00663 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], true)); 00664 } 00665 } 00666 }

void CalcExtRegExpTest::likeHelper ( TupleDataWithBuffer const & outTuple,
bool const * exp,
int validoutputs,
int nulloutputs,
deque< CalcMessage > dq
) [private]

Definition at line 180 of file CalcExtRegExpTest.cpp.

References cmpTupBool(), and cmpTupNull().

Referenced by testCalcExtRegExpLikeAVarChar().

00186 { 00187 int i; 00188 deque::iterator iter = dq.begin(); 00189 deque::iterator end = dq.end(); 00190 00191 for (i = 0; i < validoutputs; i++) { 00192 if (cmpTupBool(outTuple[i], exp[i])) { 00193 BOOST_MESSAGE("error on valid output [" << i << "]"); 00194 } 00195 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], exp[i])); 00196 } 00197 00198 for (i = validoutputs; i < nulloutputs; i++) { 00199 if (cmpTupNull(outTuple[i])) { 00200 BOOST_MESSAGE("error on null output [" << i << "]"); 00201 } 00202 BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i])); 00203 } 00204 BOOST_CHECK(iter != end); 00205 BOOST_CHECK_EQUAL(iter->pc, nulloutputs); 00206 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22019")); 00207 iter++; 00208 BOOST_CHECK(iter != end); 00209 00210 BOOST_CHECK(iter != end); 00211 BOOST_CHECK_EQUAL(iter->pc, nulloutputs + 1); 00212 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22019")); 00213 iter++; 00214 BOOST_CHECK(iter != end); 00215 00216 BOOST_CHECK_EQUAL(iter->pc, nulloutputs + 2); 00217 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22025")); 00218 iter++; 00219 BOOST_CHECK(iter == end); 00220 00221 }

void CalcExtRegExpTest::similarHelper ( TupleDataWithBuffer const & outTuple,
bool const * exp,
int validoutputs,
int nulloutputs,
deque< CalcMessage > dq
) [private]

Definition at line 413 of file CalcExtRegExpTest.cpp.

References cmpTupBool(), and cmpTupNull().

Referenced by testCalcExtRegExpSimilarAVarChar().

00419 { 00420 int i; 00421 deque::iterator iter = dq.begin(); 00422 deque::iterator end = dq.end(); 00423 00424 for (i = 0; i < validoutputs; i++) { 00425 if (cmpTupBool(outTuple[i], exp[i])) { 00426 BOOST_MESSAGE("error on valid output [" << i << "]"); 00427 } 00428 BOOST_CHECK_EQUAL(0, cmpTupBool(outTuple[i], exp[i])); 00429 } 00430 00431 for (i = validoutputs; i < nulloutputs; i++) { 00432 if (cmpTupNull(outTuple[i])) { 00433 BOOST_MESSAGE("error on null output [" << i << "]"); 00434 } 00435 BOOST_CHECK_EQUAL(1, cmpTupNull(outTuple[i])); 00436 } 00437 int exceptionPc = nulloutputs; 00438 00439 BOOST_CHECK(iter != end); 00440 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00441 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "2200B")); 00442 iter++; 00443 BOOST_CHECK(iter != end); 00444 00445 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00446 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22019")); 00447 iter++; 00448 BOOST_CHECK(iter != end); 00449 00450 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00451 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "22019")); 00452 iter++; 00453 BOOST_CHECK(iter != end); 00454 00455 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00456 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "2201B")); 00457 iter++; 00458 BOOST_CHECK(iter != end); 00459 00460 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00461 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "2200C")); 00462 iter++; 00463 00464 BOOST_CHECK_EQUAL(iter->pc, exceptionPc++); 00465 BOOST_CHECK_EQUAL(0, strcmp(iter->str, "2201B")); 00466 iter++; 00467 BOOST_CHECK(iter == end); 00468 }

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

Definition at line 114 of file CalcExtRegExpTest.cpp.

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

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

int CalcExtRegExpTest::cmpTupInt ( TupleDatum const & tup,
int val
) [private]
int CalcExtRegExpTest::cmpTupBool ( TupleDatum const & tup,
bool val
) [private]
int CalcExtRegExpTest::cmpTupNull ( TupleDatum const & tup ) [private]
void CalcExtRegExpTest::printOutput ( TupleData const & tup,
Calculator const & calc
) [private]
void CalcExtRegExpTest::refLocalOutput ( ostringstream & pg,
int count
) [private]
void TestBase::snooze ( uint nSeconds ) [protected, inherited]
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") {
00123 permAssert(i + 1 < argc); 00124 runSingle = argv[++i]; 00125 } else if (arg[1] == 't') { 00126 runSingle = arg.substr(2); 00127 } 00128 } else { 00129 int i = arg.find("="); 00130 if ((0 < i) && (i < arg.size())) { 00131
00132 std::string key = arg.substr(0,i); 00133 std::string val = arg.substr(i + 1); 00134 adhocMap.setStringParam(key,val); 00135 } else { 00136
00137 std::ifstream configFile(arg.c_str()); 00138 assert(configFile.good()); 00139 configMap.readParams(configFile); 00140 } 00141 } 00142 } 00143 configMap.mergeFrom(adhocMap); 00144 00145
00146
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] | | ---------------------------------------------------------------------------------------------- | - | | - | ------------- |

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

| 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().

| 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().

void TestBase::notifyTrace ( std::string source,
TraceLevel level,
std::string message
) [virtual, inherited]
TraceLevel TestBase::getSourceTraceLevel ( std::string source ) [virtual, inherited]
void TraceSource::initTraceSource ( SharedTraceTarget pTraceTarget,
std::string name
) [virtual, inherited]
void TraceSource::trace ( TraceLevel level,
std::string message
) const [inherited]

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

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

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

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

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] | | ------------------------------------------------------------------------------------------------------ | - | | - | --------------------------- |

| void TraceSource::disableTracing | ( | | ) | [inherited] | | -------------------------------- | - | | - | ------------- |


Member Data Documentation

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