Inheritance diagram for StandardTypeTest:
Public Member Functions | |
StandardTypeTest () | |
virtual | ~StandardTypeTest () |
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 |
| |
bool | isTracingLevel (TraceLevel level) const |
Determines whether a particular level is being traced. | |
TraceTarget & | getTraceTarget () const |
| |
SharedTraceTarget | getSharedTraceTarget () const |
| |
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 | testStandardTypeToString () |
void | testStandardTypeIsNative () |
void | testStandardTypeIsNativeNotBool () |
void | testStandardTypeIsIntegralNative () |
void | testStandardTypeIsExact () |
void | testStandardTypeIsApprox () |
void | testStandardTypeIsArray () |
void | testStandardTypeIsVariableLenArray () |
void | testStandardTypeIsFixedLenArray () |
void | testStandardTypeIsTextArray () |
void | testStandardTypeIsBinaryArray () |
Definition at line 36 of file StandardTypeTest.cpp.
StandardTypeTest::StandardTypeTest | ( | ) | [inline, explicit] |
Definition at line 51 of file StandardTypeTest.cpp.
References testStandardTypeIsApprox(), testStandardTypeIsArray(), testStandardTypeIsBinaryArray(), testStandardTypeIsExact(), testStandardTypeIsFixedLenArray(), testStandardTypeIsIntegralNative(), testStandardTypeIsNative(), testStandardTypeIsNativeNotBool(), testStandardTypeIsTextArray(), testStandardTypeIsVariableLenArray(), and testStandardTypeToString().
00052 : TraceSource(shared_from_this(),"StandardTypeTest") 00053 { 00054 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeToString); 00055 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsNative); 00056 FENNEL_UNIT_TEST_CASE( 00057 StandardTypeTest, testStandardTypeIsNativeNotBool); 00058 FENNEL_UNIT_TEST_CASE( 00059 StandardTypeTest, testStandardTypeIsIntegralNative); 00060 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsExact); 00061 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsApprox); 00062 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsArray); 00063 FENNEL_UNIT_TEST_CASE( 00064 StandardTypeTest, testStandardTypeIsVariableLenArray); 00065 FENNEL_UNIT_TEST_CASE( 00066 StandardTypeTest, testStandardTypeIsFixedLenArray); 00067 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsTextArray); 00068 FENNEL_UNIT_TEST_CASE(StandardTypeTest, testStandardTypeIsBinaryArray); 00069 }
virtual StandardTypeTest::~StandardTypeTest | ( | ) | [inline, virtual] |
void StandardTypeTest::testStandardTypeToString | ( | ) | [private] |
Definition at line 76 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::fromString(), STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_VARBINARY, and StandardTypeDescriptor::toString().
Referenced by StandardTypeTest().
00077 { 00078 int i; 00079 StandardTypeDescriptorOrdinal v, x; 00080 std::string concat; 00081 const char* str; 00082 00083 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00084 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00085 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00086 00087 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00088 v = StandardTypeDescriptorOrdinal(i); 00089 str = StandardTypeDescriptor::toString(v); 00090 x = StandardTypeDescriptor::fromString(str); 00091 BOOST_CHECK_EQUAL (x, v); 00092 BOOST_MESSAGE(v << " -> " << str << " -> " << x); 00093 concat += str; 00094 } 00095 BOOST_MESSAGE("concat: |" << concat << "|"); 00096 BOOST_CHECK(!(concat.compare("s1u1s2u2s4u4s8u8bordcvcbvbUvU"))); 00097 00098 for (i = STANDARD_TYPE_VARBINARY; i >= STANDARD_TYPE_INT_8; i--) { 00099 v = StandardTypeDescriptorOrdinal(i); 00100 str = StandardTypeDescriptor::toString(v); 00101 x = StandardTypeDescriptor::fromString(str); 00102 BOOST_CHECK_EQUAL(x, v); 00103 } 00104 }
void StandardTypeTest::testStandardTypeIsNative | ( | ) | [private] |
Definition at line 106 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isNative(), STANDARD_TYPE_BINARY, STANDARD_TYPE_CHAR, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00107 { 00108 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00109 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00110 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00111 00112 int i; 00113 StandardTypeDescriptorOrdinal v; 00114 00115 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00116 BOOST_MESSAGE("isNative " << i); 00117 v = StandardTypeDescriptorOrdinal(i); 00118 if (v == STANDARD_TYPE_CHAR || 00119 v == STANDARD_TYPE_VARCHAR || 00120 v == STANDARD_TYPE_BINARY || 00121 v == STANDARD_TYPE_VARBINARY || 00122 v == STANDARD_TYPE_UNICODE_CHAR || 00123 v == STANDARD_TYPE_UNICODE_VARCHAR) { 00124 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isNative(v), false); 00125 } else { 00126 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isNative(v), true); 00127 } 00128 } 00129 }
void StandardTypeTest::testStandardTypeIsNativeNotBool | ( | ) | [private] |
Definition at line 131 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isNativeNotBool(), STANDARD_TYPE_BINARY, STANDARD_TYPE_BOOL, STANDARD_TYPE_CHAR, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00132 { 00133 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00134 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00135 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00136 00137 int i; 00138 StandardTypeDescriptorOrdinal v; 00139 00140 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00141 BOOST_MESSAGE("isNativeNotBool " << i); 00142 v = StandardTypeDescriptorOrdinal(i); 00143 if (v == STANDARD_TYPE_BOOL || 00144 v == STANDARD_TYPE_CHAR || 00145 v == STANDARD_TYPE_VARCHAR || 00146 v == STANDARD_TYPE_BINARY || 00147 v == STANDARD_TYPE_VARBINARY || 00148 v == STANDARD_TYPE_UNICODE_CHAR || 00149 v == STANDARD_TYPE_UNICODE_VARCHAR) 00150 { 00151 BOOST_CHECK_EQUAL( 00152 StandardTypeDescriptor::isNativeNotBool(v), 00153 false); 00154 } else { 00155 BOOST_CHECK_EQUAL( 00156 StandardTypeDescriptor::isNativeNotBool(v), 00157 true); 00158 } 00159 } 00160 }
void StandardTypeTest::testStandardTypeIsIntegralNative | ( | ) | [private] |
Definition at line 162 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isIntegralNative(), STANDARD_TYPE_BINARY, STANDARD_TYPE_CHAR, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_REAL, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00163 { 00164 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00165 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00166 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00167 00168 int i; 00169 StandardTypeDescriptorOrdinal v; 00170 00171 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00172 BOOST_MESSAGE("isIntegralNative " << i); 00173 v = StandardTypeDescriptorOrdinal(i); 00174 if (v == STANDARD_TYPE_REAL || 00175 v == STANDARD_TYPE_DOUBLE || 00176 v == STANDARD_TYPE_CHAR || 00177 v == STANDARD_TYPE_VARCHAR || 00178 v == STANDARD_TYPE_BINARY || 00179 v == STANDARD_TYPE_VARBINARY || 00180 v == STANDARD_TYPE_UNICODE_CHAR || 00181 v == STANDARD_TYPE_UNICODE_VARCHAR) 00182 { 00183 BOOST_CHECK_EQUAL( 00184 StandardTypeDescriptor::isIntegralNative(v), 00185 false); 00186 } else { 00187 BOOST_CHECK_EQUAL( 00188 StandardTypeDescriptor::isIntegralNative(v), 00189 true); 00190 } 00191 } 00192 }
void StandardTypeTest::testStandardTypeIsExact | ( | ) | [private] |
Definition at line 194 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isExact(), STANDARD_TYPE_BINARY, STANDARD_TYPE_BOOL, STANDARD_TYPE_CHAR, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_REAL, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00195 { 00196 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00197 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00198 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00199 00200 int i; 00201 StandardTypeDescriptorOrdinal v; 00202 00203 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00204 v = StandardTypeDescriptorOrdinal(i); 00205 BOOST_MESSAGE("isExact " << i << " " << StandardTypeDescriptor::isExact(v)); 00206 if (v == STANDARD_TYPE_BOOL || 00207 v == STANDARD_TYPE_REAL || 00208 v == STANDARD_TYPE_DOUBLE || 00209 v == STANDARD_TYPE_CHAR || 00210 v == STANDARD_TYPE_VARCHAR || 00211 v == STANDARD_TYPE_BINARY || 00212 v == STANDARD_TYPE_VARBINARY || 00213 v == STANDARD_TYPE_UNICODE_CHAR || 00214 v == STANDARD_TYPE_UNICODE_VARCHAR) { 00215 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isExact(v), false); 00216 } else { 00217 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isExact(v), true); 00218 } 00219 } 00220 }
void StandardTypeTest::testStandardTypeIsApprox | ( | ) | [private] |
Definition at line 222 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isApprox(), STANDARD_TYPE_DOUBLE, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_REAL, and STANDARD_TYPE_VARBINARY.
Referenced by StandardTypeTest().
00223 { 00224 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00225 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00226 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00227 00228 int i; 00229 StandardTypeDescriptorOrdinal v; 00230 00231 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00232 BOOST_MESSAGE("isApprox " << i); 00233 v = StandardTypeDescriptorOrdinal(i); 00234 if (v == STANDARD_TYPE_REAL || 00235 v == STANDARD_TYPE_DOUBLE) { 00236 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isApprox(v), true); 00237 } else { 00238 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isApprox(v), false); 00239 } 00240 } 00241 }
void StandardTypeTest::testStandardTypeIsArray | ( | ) | [private] |
Definition at line 244 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isArray(), STANDARD_TYPE_BINARY, STANDARD_TYPE_CHAR, STANDARD_TYPE_END, STANDARD_TYPE_INT_8, STANDARD_TYPE_MIN, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00245 { 00246 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00247 BOOST_REQUIRE(STANDARD_TYPE_MIN <= STANDARD_TYPE_INT_8); 00248 BOOST_REQUIRE(STANDARD_TYPE_END > STANDARD_TYPE_VARBINARY); 00249 00250 int i; 00251 StandardTypeDescriptorOrdinal v; 00252 00253 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00254 BOOST_MESSAGE("isArray " << i); 00255 v = StandardTypeDescriptorOrdinal(i); 00256 if (v == STANDARD_TYPE_CHAR || 00257 v == STANDARD_TYPE_VARCHAR || 00258 v == STANDARD_TYPE_BINARY || 00259 v == STANDARD_TYPE_VARBINARY || 00260 v == STANDARD_TYPE_UNICODE_CHAR || 00261 v == STANDARD_TYPE_UNICODE_VARCHAR) { 00262 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isArray(v), true); 00263 } else { 00264 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isArray(v), false); 00265 } 00266 } 00267 }
void StandardTypeTest::testStandardTypeIsVariableLenArray | ( | ) | [private] |
Definition at line 269 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isVariableLenArray(), STANDARD_TYPE_END, STANDARD_TYPE_MIN, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00270 { 00271 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00272 00273 int i; 00274 StandardTypeDescriptorOrdinal v; 00275 00276 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00277 BOOST_MESSAGE("isVariableLenArray " << i); 00278 v = StandardTypeDescriptorOrdinal(i); 00279 if (v == STANDARD_TYPE_VARCHAR || 00280 v == STANDARD_TYPE_VARBINARY || 00281 v == STANDARD_TYPE_UNICODE_VARCHAR) { 00282 BOOST_CHECK_EQUAL( 00283 StandardTypeDescriptor::isVariableLenArray(v), true); 00284 } else { 00285 BOOST_CHECK_EQUAL( 00286 StandardTypeDescriptor::isVariableLenArray(v), false); 00287 } 00288 } 00289 }
void StandardTypeTest::testStandardTypeIsFixedLenArray | ( | ) | [private] |
Definition at line 291 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isFixedLenArray(), STANDARD_TYPE_BINARY, STANDARD_TYPE_CHAR, STANDARD_TYPE_END, STANDARD_TYPE_MIN, and STANDARD_TYPE_UNICODE_CHAR.
Referenced by StandardTypeTest().
00292 { 00293 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00294 00295 int i; 00296 StandardTypeDescriptorOrdinal v; 00297 00298 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00299 BOOST_MESSAGE("isFixedLenArray " << i); 00300 v = StandardTypeDescriptorOrdinal(i); 00301 if (v == STANDARD_TYPE_CHAR || 00302 v == STANDARD_TYPE_BINARY || 00303 v == STANDARD_TYPE_UNICODE_CHAR) 00304 { 00305 BOOST_CHECK_EQUAL( 00306 StandardTypeDescriptor::isFixedLenArray(v), 00307 true); 00308 } else { 00309 BOOST_CHECK_EQUAL( 00310 StandardTypeDescriptor::isFixedLenArray(v), 00311 false); 00312 } 00313 } 00314 }
void StandardTypeTest::testStandardTypeIsTextArray | ( | ) | [private] |
Definition at line 316 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isTextArray(), STANDARD_TYPE_CHAR, STANDARD_TYPE_END, STANDARD_TYPE_MIN, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, and STANDARD_TYPE_VARCHAR.
Referenced by StandardTypeTest().
00317 { 00318 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00319 00320 int i; 00321 StandardTypeDescriptorOrdinal v; 00322 00323 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00324 BOOST_MESSAGE("isTextArray " << i); 00325 v = StandardTypeDescriptorOrdinal(i); 00326 if (v == STANDARD_TYPE_CHAR || 00327 v == STANDARD_TYPE_VARCHAR || 00328 v == STANDARD_TYPE_UNICODE_CHAR || 00329 v == STANDARD_TYPE_UNICODE_VARCHAR) { 00330 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isTextArray(v), true); 00331 } else { 00332 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isTextArray(v), false); 00333 } 00334 } 00335 }
void StandardTypeTest::testStandardTypeIsBinaryArray | ( | ) | [private] |
Definition at line 337 of file StandardTypeTest.cpp.
References StandardTypeDescriptor::isBinaryArray(), STANDARD_TYPE_BINARY, STANDARD_TYPE_END, STANDARD_TYPE_MIN, and STANDARD_TYPE_VARBINARY.
Referenced by StandardTypeTest().
00338 { 00339 BOOST_REQUIRE(STANDARD_TYPE_MIN < STANDARD_TYPE_END); 00340 00341 int i; 00342 StandardTypeDescriptorOrdinal v; 00343 00344 for (i = STANDARD_TYPE_MIN; i < STANDARD_TYPE_END; i++) { 00345 BOOST_MESSAGE("isBinaryArray " << i); 00346 v = StandardTypeDescriptorOrdinal(i); 00347 if (v == STANDARD_TYPE_VARBINARY || 00348 v == STANDARD_TYPE_BINARY) { 00349 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isBinaryArray(v), true); 00350 } else { 00351 BOOST_CHECK_EQUAL(StandardTypeDescriptor::isBinaryArray(v), false); 00352 } 00353 } 00354 }
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().
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] |
Receives notification when a trace event occurs.
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.
source | name of source to 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.
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.
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] |
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.
level | trace level to test |
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] |
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] |
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.
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] |
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 }
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] |
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] |
TestCaseGroup TestBase::extraTests [protected, inherited] |
ParamName TestBase::paramTestSuiteName [static, inherited] |
ParamName TestBase::paramTraceFileName [static, inherited] |
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] |
ParamName TestBase::paramStatsFileName [static, inherited] |
Definition at line 147 of file TestBase.h.
ParamName TestBase::paramTraceStdout [static, inherited] |
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().