2002-07-09 12:24:59 +00:00
|
|
|
#include <TestCase.h>
|
|
|
|
|
#include <unistd.h>
|
2002-07-11 03:31:07 +00:00
|
|
|
#include <stdio.h>
|
2002-07-09 12:24:59 +00:00
|
|
|
|
2002-07-11 03:31:07 +00:00
|
|
|
BTestCase::BTestCase(std::string name)
|
|
|
|
|
: CppUnit::TestCase(name)
|
2002-07-09 12:24:59 +00:00
|
|
|
, fValidCWD(false)
|
2002-07-11 03:31:07 +00:00
|
|
|
, fSubTestNum(0)
|
2002-07-09 12:24:59 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 03:31:07 +00:00
|
|
|
void
|
|
|
|
|
BTestCase::tearDown() {
|
|
|
|
|
NextSubTestBlock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
BTestCase::NextSubTest() {
|
|
|
|
|
printf("[%ld]", fSubTestNum++);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
BTestCase::NextSubTestBlock() {
|
|
|
|
|
// printf("\n");
|
2002-07-09 12:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
2002-07-11 03:31:07 +00:00
|
|
|
/*! To return to the last saved working directory, call RestoreCWD(). */
|
2002-07-09 12:24:59 +00:00
|
|
|
void
|
2002-07-11 03:31:07 +00:00
|
|
|
BTestCase::SaveCWD() {
|
2002-07-09 12:24:59 +00:00
|
|
|
fValidCWD = getcwd(fCurrentWorkingDir, B_PATH_NAME_LENGTH);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 03:31:07 +00:00
|
|
|
/* If SaveCWD() has not been called and an alternate
|
2002-07-09 12:24:59 +00:00
|
|
|
directory is specified by alternate, the current working directory is
|
|
|
|
|
changed to alternate. If alternate is null, the current working directory
|
|
|
|
|
is not modified.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2002-07-11 03:31:07 +00:00
|
|
|
BTestCase::RestoreCWD(const char *alternate) {
|
2002-07-09 12:24:59 +00:00
|
|
|
if (fValidCWD)
|
|
|
|
|
chdir(fCurrentWorkingDir);
|
|
|
|
|
else if (alternate != NULL)
|
|
|
|
|
chdir(alternate);
|
|
|
|
|
}
|