Also tweak unit tests that dropped files in working directory to use our test data dir instead

This commit is contained in:
Brian Cox 2017-08-23 23:54:18 -07:00
parent f5e76827be
commit d0b9b03561
5 changed files with 9 additions and 10 deletions

View File

@ -41,11 +41,11 @@ void TestBlockFile()
{
cDebug d( "TestBlockFile" );
static const TCHAR fileName[] = _T("test.bf");
std::string fileName = TwTestPath("test.bf");
// truncate the file I am going to use...
//
cFileArchive a;
a.OpenReadWrite( fileName );
a.OpenReadWrite( fileName.c_str() );
a.Close();
//
// open up the block file...

View File

@ -41,7 +41,7 @@ void TestBlockRecordArray()
{
cDebug d( "TestBlockRecordArray" );
static const TCHAR fileName[] = _T("test.bf");
std::string fileName = TwTestPath("test2.bf");
cBlockFile bf;
bf.Open( fileName, 2, true ); // opened up with two pages

View File

@ -128,9 +128,6 @@ void TestConfigFile2(void)
//Define some test values for <name, value> pairs to be
//stored in a test config. module. I'm going to use the
//values specified in the install doc. -DA
TSTRING currpath;
pFSServices->GetCurrentDir(currpath);
const TSTRING testTWROOT = currpath;
//TODO maybe also test read failure when mandatory config values aren't set
@ -145,7 +142,7 @@ void TestConfigFile2(void)
write_cfgmod.Insert( _T("LOCALKEYFILE"), "local.key");
//Filename for writing/reading some value pairs:
const TSTRING testfile = testTWROOT + _T("/tripwire.cfg");
const TSTRING testfile = TwTestPath("tripwire.cfg");
//Store these values on disk.
TSTRING configText;

View File

@ -173,7 +173,8 @@ static void AssertChildren(cDbDataSourceIter& iter, const TSTRING& filename, boo
void TestDbDataSourceBasic()
{
cHierDatabase db;
db.Open( _T("test.db"), 5, true);
std::string dbpath = TwTestPath("test.db");
db.Open( dbpath, 5, true);
cDbDataSourceIter iter(&db);
AddFile(iter, "file1", true);

View File

@ -130,8 +130,9 @@ void TestFCOReport()
d.TraceDebug("Before serializing report:\n");
TraceReport(report, d);
{
std::string filepath = TwTestPath("tmp.twr");
cFileArchive outFile;
outFile.OpenReadWrite(_T("tmp.twr"));
outFile.OpenReadWrite(filepath.c_str());
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
outSer.Init();
@ -141,7 +142,7 @@ void TestFCOReport()
outFile.Close();
cFileArchive inFile;
inFile.OpenRead(_T("tmp.twr"));
inFile.OpenRead(filepath.c_str());
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
cFCOReport inReport;