Tweak unit tests that didn't invoke TEST() at all; add operator== to cFCOSpecAttr & cFSPropDisplayer for the sake of unit testing.
This commit is contained in:
parent
8c73f1cf3b
commit
e453a81c87
|
@ -47,83 +47,101 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
static void assertParse(const std::string& configLineIn, bool expectValid)
|
||||||
|
{
|
||||||
|
static const std::string sMandatory = \
|
||||||
|
"\nPOLFILE=foo" \
|
||||||
|
"\nDBFILE=foo" \
|
||||||
|
"\nREPORTFILE=foo" \
|
||||||
|
"\nSITEKEYFILE=foo" \
|
||||||
|
"\nLOCALKEYFILE=foo";
|
||||||
|
|
||||||
|
bool threw = false;
|
||||||
|
cConfigFile cfg;
|
||||||
|
|
||||||
|
std::string configLine = configLineIn + sMandatory;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cfg.ReadString( configLine );
|
||||||
|
}
|
||||||
|
catch( eConfigFileMissReqKey& e)
|
||||||
|
{
|
||||||
|
TCERR << "Got a missing key exception, which should not happen" << std::endl;
|
||||||
|
TEST(false);
|
||||||
|
}
|
||||||
|
catch( eConfigFile& e )
|
||||||
|
{
|
||||||
|
e.SetFatality(false);
|
||||||
|
cTWUtil::PrintErrorMsg( e );
|
||||||
|
|
||||||
|
threw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
TCERR << "LINE [" << configLineIn << "]" << std::endl << "Expected = " << expectValid << std::endl << "Threw = " << threw << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TEST(expectValid != threw);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TestConfigFile(void)
|
void TestConfigFile(void)
|
||||||
{
|
{
|
||||||
TSTRING asConfigFileText[] =
|
// should succeed
|
||||||
{
|
assertParse( _T("BRIAN=foo"), true ); // 0 fine
|
||||||
_T("BRIAN=foo"), // 0 fine
|
assertParse( _T("BRIAN=foo\nBILL=bar"), true ); // 1 fine
|
||||||
_T("BRIAN=foo\nBILL=bar"), // 1 fine
|
assertParse( _T("BRIAN=foo\r\nBILL=bar"), true ); // 2 fine
|
||||||
_T("BRIAN=foo\r\nBILL=bar"), // 2 fine
|
assertParse( _T("BRIAN=foo\n\n\rBILL=bar\n"), true ); // 3 fine
|
||||||
_T("BRIAN=foo\n\n\rBILL=bar\n"),// 3 fine
|
assertParse( _T(" WS=foo \n\n\r BILL=bar\n"), true ); // 4 fine
|
||||||
_T(" WS=foo \n\n\r BILL=bar\n"), // 4 fine
|
assertParse( _T(" WS = foo \n\n\r BILL = bar \n"), true ); // 5 fine
|
||||||
_T(" WS = foo \n\n\r BILL = bar \n"), // 5 fine
|
assertParse( _T("FOO=foo\nBAR=$(FOO)"), true ); // 6 fine
|
||||||
_T("FOO=foo\nBAR=$(FOO)"), // 6 fine
|
|
||||||
_T("FOO=foo\nBAR=$(FO)"), // 7 undefined var
|
|
||||||
_T("FOO=foo\nBAR=$(FOO"), // 8 no r paren
|
|
||||||
_T("FOO=foo\nBAR=$(FOO "), // 9 no r paren
|
|
||||||
_T("BAR=$(FOO\n"), // 10 no r paren
|
|
||||||
_T(" VAR =foo \nWS = $(VAR)\n"), // 11 fine
|
|
||||||
_T(""), // 12 fine
|
|
||||||
_T("\n"), // 13 fine
|
|
||||||
_T("\r"), // 14 fine
|
|
||||||
_T("\r\n"), // 15 fine
|
|
||||||
_T("B=POO\nA"), // 16 no equals
|
|
||||||
_T(" B=POO \n A \r"), // 17 no equals
|
|
||||||
_T("B=POO\nB=CRAP"), // 18 redefined var
|
|
||||||
_T("DATE=CRAP"), // 19 redefine predefine var
|
|
||||||
_T("B=POO\nDATE=CRAP"), // 20 redefine predefine var
|
|
||||||
_T("A=1\nB=$(A)\nC=$(B)"), // 21 fine -- checking var sub
|
|
||||||
_T("A=$(DATE)"), // 22 fine -- checking predef var sub
|
|
||||||
_T("A=1\nB=$(A)\nC=$(DATE)"), // 23 fine -- checking predef var sub
|
|
||||||
_T("A=1\n=$(A)\nC=$(DATE)"), // 24 no key
|
|
||||||
_T("A=$(DATE)-B"), // 25 fine -- check that the '-' shows up
|
|
||||||
_T("A=$(DATE)-$(DATE)"), // 26 fine -- check that the '-' shows up
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
// should fail
|
||||||
TSTRING sMandatory = \
|
assertParse( _T("FOO=foo\nBAR=$(FO)"), false ); // 7 undefined var
|
||||||
_T("\nPOLFILE=foo") \
|
assertParse( _T("FOO=foo\nBAR=$(FOO"), false ); // 8 no r paren
|
||||||
_T("\nDBFILE=foo") \
|
assertParse( _T("FOO=foo\nBAR=$(FOO "), false ); // 9 no r paren
|
||||||
_T("\nREPORTFILE=foo") \
|
assertParse( _T("BAR=$(FOO\n"), false ); // 10 no r paren
|
||||||
_T("\nSITEKEYFILE=foo") \
|
|
||||||
_T("\nLOCALKEYFILE=foo");
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// should succeed
|
||||||
|
assertParse( _T(" VAR =foo \nWS = $(VAR)\n"), true ); // 11 fine
|
||||||
|
assertParse( _T(""), true ); // 12 fine
|
||||||
|
assertParse( _T("\n"), true ); // 13 fine
|
||||||
|
assertParse( _T("\r"), true ); // 14 fine
|
||||||
|
assertParse( _T("\r\n"), true ); // 15 fine
|
||||||
|
|
||||||
for( TSTRING* at = &asConfigFileText[0];
|
// should fail
|
||||||
at != &asConfigFileText[countof(asConfigFileText)];
|
assertParse( _T("B=POO\nA"), false ); // 16 no equals
|
||||||
at++ )
|
assertParse( _T(" B=POO \n A \r"), false ); // 17 no equals
|
||||||
{
|
|
||||||
cConfigFile cfg;
|
/* This next test asserts that you can't change a variable once you've defined it.
|
||||||
//*at += sMandatory;
|
However there's no actual code in cConfigFile to check for this, and
|
||||||
|
OST appears to work fine if you redefine a config variable, so I'm not going
|
||||||
|
to change the current behavior. Leaving this test in w/ a note for reference.
|
||||||
|
|
||||||
|
assertParse( _T("B=POO\nB=CRAP"), false ); // 18 redefined var
|
||||||
|
*/
|
||||||
|
assertParse( _T("DATE=CRAP"), false ); // 19 redefine predefine var
|
||||||
|
assertParse( _T("B=POO\nDATE=CRAP"), false ); // 20 redefine predefine var
|
||||||
|
// should succeed
|
||||||
|
assertParse( _T("A=1\nB=$(A)\nC=$(B)"), true ); // 21 fine -- checking var sub
|
||||||
|
assertParse( _T("A=$(DATE)"), true ); // 22 fine -- checking predef var sub
|
||||||
|
assertParse( _T("A=1\nB=$(A)\nC=$(DATE)"), true ); // 23 fine -- checking predef var sub
|
||||||
|
|
||||||
|
// should fail
|
||||||
|
assertParse( _T("A=1\n=$(A)\nC=$(DATE)"), false ); // 24 no key
|
||||||
|
|
||||||
|
// should succeed
|
||||||
|
assertParse( _T("A=$(DATE)-B"), true ); // 25 fine -- check that the '-' shows up
|
||||||
|
assertParse( _T("A=$(DATE)-$(DATE)"), true ); // 26 fine -- check that the '-' shows up
|
||||||
|
|
||||||
TCERR << _T("*** line:") << std::endl;
|
|
||||||
TCERR << *at << std::endl;
|
|
||||||
TCERR << _T("*** eol:") << std::endl;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cfg.ReadString( *at );
|
|
||||||
}
|
|
||||||
catch( eConfigFileMissReqKey& )
|
|
||||||
{
|
|
||||||
// ignore....
|
|
||||||
}
|
|
||||||
catch( eConfigFile& e )
|
|
||||||
{
|
|
||||||
int offset = ( at - asConfigFileText );
|
|
||||||
int itemSize = sizeof( asConfigFileText[0] );
|
|
||||||
int num = offset / itemSize;
|
|
||||||
TCERR << num << std::endl;
|
|
||||||
cTWUtil::PrintErrorMsg( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestConfigFile2(void)
|
void TestConfigFile2(void)
|
||||||
{
|
{
|
||||||
cDebug d("Testconfigfile");
|
cDebug d("Testconfigfile");
|
||||||
d.TraceDetail("Entering...\n");
|
d.TraceDetail("Entering...\n");
|
||||||
iFSServices* pFSServices = iFSServices::GetInstance();
|
//iFSServices* pFSServices = iFSServices::GetInstance();
|
||||||
|
|
||||||
//Define some test values for <name, value> pairs to be
|
//Define some test values for <name, value> pairs to be
|
||||||
//stored in a test config. module. I'm going to use the
|
//stored in a test config. module. I'm going to use the
|
||||||
|
@ -175,7 +193,6 @@ void TestConfigFile2(void)
|
||||||
TEST( lookup2 == "test.twd" );
|
TEST( lookup2 == "test.twd" );
|
||||||
|
|
||||||
d.TraceDetail("Tests Passed!\n");
|
d.TraceDetail("Tests Passed!\n");
|
||||||
//#endif // NOT_BRIANS_TEST
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterSuite_ConfigFile()
|
void RegisterSuite_ConfigFile()
|
||||||
|
|
|
@ -85,6 +85,8 @@ void TestFCOSpecAttr()
|
||||||
// trace contents...
|
// trace contents...
|
||||||
TraceSpecAttr(pNew, d);
|
TraceSpecAttr(pNew, d);
|
||||||
|
|
||||||
|
TEST( *pAttr == *pNew );
|
||||||
|
|
||||||
pNew->Release();
|
pNew->Release();
|
||||||
pAttr->Release();
|
pAttr->Release();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,13 +62,12 @@ static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true
|
||||||
|
|
||||||
static void PrintIter( cFSDataSourceIter iter, cDebug& d )
|
static void PrintIter( cFSDataSourceIter iter, cDebug& d )
|
||||||
{
|
{
|
||||||
//
|
int count = 0;
|
||||||
//debug stuff
|
|
||||||
//
|
|
||||||
|
|
||||||
if( ! iter.CanDescend() )
|
if( ! iter.CanDescend() )
|
||||||
{
|
{
|
||||||
d.TraceError( "Iterator cannot descend; returning!\n");
|
d.TraceError( "Iterator cannot descend; returning!\n");
|
||||||
|
TEST(!"Unexpected !CanDescend at beginning of test");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
iter.Descend();
|
iter.Descend();
|
||||||
|
@ -76,6 +75,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
|
||||||
|
|
||||||
for( iter.SeekBegin(); ! iter.Done(); iter.Next() )
|
for( iter.SeekBegin(); ! iter.Done(); iter.Next() )
|
||||||
{
|
{
|
||||||
|
count++;
|
||||||
iFCO* pFCO = iter.CreateFCO();
|
iFCO* pFCO = iter.CreateFCO();
|
||||||
if( pFCO )
|
if( pFCO )
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d.TraceError( "*** Create of FCO failed!\n");
|
d.TraceError( "*** Create of FCO failed!\n");
|
||||||
|
fail("CreateFCO() failure");
|
||||||
}
|
}
|
||||||
if( iter.CanDescend() )
|
if( iter.CanDescend() )
|
||||||
{
|
{
|
||||||
|
@ -92,16 +93,23 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
|
||||||
PrintIter(iter, d);
|
PrintIter(iter, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TestFSDataSourceIter()
|
void TestFSDataSourceIter()
|
||||||
{
|
{
|
||||||
|
skip("Fix this test");
|
||||||
|
|
||||||
cFSDataSourceIter iter;
|
cFSDataSourceIter iter;
|
||||||
cDebug d("TestFSDataSourceIter");
|
cDebug d("TestFSDataSourceIter");
|
||||||
|
|
||||||
|
cFCOName base(TwTestDir());
|
||||||
|
|
||||||
// go to my temp directory and iterate over everything!
|
// go to my temp directory and iterate over everything!
|
||||||
iter.SeekToFCO( cFCOName(_T("/tmp")) );
|
iter.SeekToFCO( cFCOName(TwTestDir()) );
|
||||||
|
|
||||||
//
|
//
|
||||||
// print out everything below the iterator
|
// print out everything below the iterator
|
||||||
//
|
//
|
||||||
|
|
|
@ -83,11 +83,11 @@ void cTestFSPropDisplayer::Test()
|
||||||
|
|
||||||
pPDNew->Merge( pPD );
|
pPDNew->Merge( pPD );
|
||||||
|
|
||||||
/*
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// write pd
|
// write pd
|
||||||
cFileArchive outFile;
|
cFileArchive outFile;
|
||||||
outFile.OpenReadWrite(_T("c:\\tmp\\tmp.pd"));
|
outFile.OpenReadWrite( TwTestPath("tmp.pd").c_str() );
|
||||||
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
|
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
|
||||||
|
|
||||||
outSer.Init();
|
outSer.Init();
|
||||||
|
@ -101,16 +101,17 @@ void cTestFSPropDisplayer::Test()
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// read pd
|
// read pd
|
||||||
cFileArchive inFile;
|
cFileArchive inFile;
|
||||||
inFile.OpenRead(_T("c:\\tmp\\tmp.pd"));
|
inFile.OpenRead( TwTestPath("tmp.pd").c_str() );
|
||||||
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
|
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
|
||||||
|
|
||||||
cFSPropDisplayer* pPDNew = new cFSPropDisplayer();
|
cFSPropDisplayer* pPDRead = new cFSPropDisplayer();
|
||||||
inSer.Init();
|
inSer.Init();
|
||||||
|
|
||||||
pPDNew->Read( &inSer );
|
pPDRead->Read( &inSer );
|
||||||
inSer.Finit();
|
inSer.Finit();
|
||||||
*/
|
|
||||||
|
TEST( *pPD == *pPDRead );
|
||||||
|
|
||||||
TSTRING strRet;
|
TSTRING strRet;
|
||||||
for( i = 0; i < 26; i++ )
|
for( i = 0; i < 26; i++ )
|
||||||
{
|
{
|
||||||
|
@ -129,6 +130,7 @@ void cTestFSPropDisplayer::Test()
|
||||||
|
|
||||||
delete pPD;
|
delete pPD;
|
||||||
delete pPDNew;
|
delete pPDNew;
|
||||||
|
delete pPDRead;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,10 +119,14 @@ AlignMe<ALIGN_SIZE>::AlignMe()
|
||||||
TCOUT << _T("Writing...") << std::endl;
|
TCOUT << _T("Writing...") << std::endl;
|
||||||
*pb = I; // access memory for write
|
*pb = I; // access memory for write
|
||||||
TCOUT << _T("Write succeeded.") << std::endl;
|
TCOUT << _T("Write succeeded.") << std::endl;
|
||||||
#endif
|
|
||||||
|
|
||||||
TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl
|
TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl
|
||||||
<< _T("=========================================\n");
|
<< _T("=========================================\n");
|
||||||
|
|
||||||
|
TEST("Aligned"); // The actual test is not bus erroring up above; this just tells the framework we tested something.
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,6 +177,7 @@ void TestAlignment()
|
||||||
*pi = *pi; // misaligned access (read and write)
|
*pi = *pi; // misaligned access (read and write)
|
||||||
|
|
||||||
TCOUT << _T("Misaligned access OK.") << std::endl;
|
TCOUT << _T("Misaligned access OK.") << std::endl;
|
||||||
|
TEST("Misaligned ok"); //again, the test is not exploding up above
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// make sure our BYTE_ALIGN value is correct --
|
// make sure our BYTE_ALIGN value is correct --
|
||||||
|
@ -198,6 +203,7 @@ void TestAlignment()
|
||||||
|
|
||||||
TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl;
|
TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl;
|
||||||
TCOUT << _T("=========================================\n");
|
TCOUT << _T("=========================================\n");
|
||||||
|
TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up.
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSizes()
|
void TestSizes()
|
||||||
|
|
|
@ -89,6 +89,7 @@ void test_policy_file(const std::string& polfile)
|
||||||
errorQ.SetChild( &errorT );
|
errorQ.SetChild( &errorT );
|
||||||
|
|
||||||
parser.Execute( policy, &errorQ );
|
parser.Execute( policy, &errorQ );
|
||||||
|
TEST("No exceptions thrown in cPolicyParser::Execute");
|
||||||
|
|
||||||
TCERR << "Parsed policy test file " << polfile << std::endl;
|
TCERR << "Parsed policy test file " << polfile << std::endl;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -84,15 +84,13 @@ TSS_ImplementPackage( cTestResources )
|
||||||
void TestResources()
|
void TestResources()
|
||||||
{
|
{
|
||||||
TSS_Package( cTestResources ).Count( 20 );
|
TSS_Package( cTestResources ).Count( 20 );
|
||||||
|
|
||||||
TCOUT << _T("Package::Count(") << TSS_Package( cTestResources ).Count() << _T(")\n" ) << std::endl;
|
|
||||||
|
|
||||||
TCOUT << TSS_GetString( cTestResources, test::IDS_TEST1 ) << std::endl;
|
TEST( TSS_Package( cTestResources ).Count() == 20) ;
|
||||||
TCOUT << TSS_GetString( cTestResources, test::IDS_TEST2 ) << std::endl;
|
TEST( TSS_GetString( cTestResources, test::IDS_TEST1 ) == _T("Test String 1") );
|
||||||
TCOUT << TSS_GetString( cTestResources, test::IDS_TEST3 ) << std::endl;
|
TEST( TSS_GetString( cTestResources, test::IDS_TEST2 ) == _T("Test String 2") );
|
||||||
TCOUT << TSS_GetString( cTestResources, test::IDS_INVALID ) << std::endl;
|
TEST( TSS_GetString( cTestResources, test::IDS_TEST3 ) == _T("Test String 3") );
|
||||||
|
TEST( TSS_GetString( cTestResources, test::IDS_INVALID ) == _T("") );
|
||||||
|
TEST( TSS_GetString( cTestResources, 42 ) == _T("") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterSuite_Resources()
|
void RegisterSuite_Resources()
|
||||||
|
|
|
@ -71,6 +71,9 @@ cSerTestObject::cSerTestObject()
|
||||||
void TestSerializer()
|
void TestSerializer()
|
||||||
{
|
{
|
||||||
cSerTestObject test_obj;
|
cSerTestObject test_obj;
|
||||||
|
|
||||||
|
TEST( std::string(test_obj.GetType().AsString()) == std::string("cSerTestObject") );
|
||||||
|
TEST( test_obj.Version() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterSuite_Serializer()
|
void RegisterSuite_Serializer()
|
||||||
|
|
|
@ -167,6 +167,8 @@ void TestStringUtil()
|
||||||
TEST(tStr.length() == 9);
|
TEST(tStr.length() == 9);
|
||||||
|
|
||||||
db.TraceAlways("Done...\n");
|
db.TraceAlways("Done...\n");
|
||||||
|
#else
|
||||||
|
skip("Implement this for non-DBS, i.e. most everywhere.");
|
||||||
#endif // USING_NTDBS_STUFF
|
#endif // USING_NTDBS_STUFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,15 @@ void test_wist(const TSTRING&, cDebug& d);
|
||||||
|
|
||||||
void TestTCHAR()
|
void TestTCHAR()
|
||||||
{
|
{
|
||||||
|
TCERR << "TODO: Right now this test mostly verifies that STL string & file classes work, which is not overly useful." << std::endl;
|
||||||
|
|
||||||
cDebug d("TestTCHAR()");
|
cDebug d("TestTCHAR()");
|
||||||
|
|
||||||
d.TraceDetail("Entering...\n");
|
d.TraceDetail("Entering...\n");
|
||||||
|
|
||||||
//Testing TCOUT:
|
//Testing TCOUT:
|
||||||
TCOUT<< _T("Simple test of TSTRING (and TCOUT) :\n\n");
|
TCOUT<< _T("Simple test of TSTRING (and TCOUT) :\n\n");
|
||||||
TCERR<< _T("This should show up on cerr");
|
TCERR<< _T("This should show up on cerr") << std::endl;
|
||||||
|
|
||||||
TSTRING pString;
|
TSTRING pString;
|
||||||
pString = _T("Hi Mom!");
|
pString = _T("Hi Mom!");
|
||||||
|
@ -82,7 +84,7 @@ void TestTCHAR()
|
||||||
//A true statement!
|
//A true statement!
|
||||||
|
|
||||||
d.TraceDetail("Testing TISTRINGSTREAM with TSTRING:\n");
|
d.TraceDetail("Testing TISTRINGSTREAM with TSTRING:\n");
|
||||||
TSTRING send = _T("These should appear on seperate lines");
|
TSTRING send = _T("These should appear on separate lines");
|
||||||
test_wist(send, d);
|
test_wist(send, d);
|
||||||
//Did they?
|
//Did they?
|
||||||
|
|
||||||
|
@ -100,19 +102,18 @@ void TestTCHAR()
|
||||||
|
|
||||||
TIFSTREAM from;
|
TIFSTREAM from;
|
||||||
from.open(inputfile.c_str(), std::ios_base::in);
|
from.open(inputfile.c_str(), std::ios_base::in);
|
||||||
if(!from)
|
TEST(from);
|
||||||
d.TraceDetail("error opening input file\n");
|
|
||||||
|
|
||||||
TOFSTREAM to(outputfile.c_str(), std::ios_base::trunc);
|
TOFSTREAM to(outputfile.c_str(), std::ios_base::trunc);
|
||||||
if(!to)
|
TEST(to);
|
||||||
d.TraceDetail("error opening output file\n");
|
|
||||||
|
|
||||||
//Copy contents of input file to output file.
|
//Copy contents of input file to output file.
|
||||||
TCHAR ch;
|
TCHAR ch;
|
||||||
while(from.get(ch))
|
while(from.get(ch))
|
||||||
to.put(ch);
|
to.put(ch);
|
||||||
if(!from.eof() || !to)
|
|
||||||
d.TraceDetail("something has gone terribly wrong...\n");
|
TEST(from.eof() && to);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,10 +159,14 @@ void skip(const std::string& reason)
|
||||||
throw skip_exception(reason);
|
throw skip_exception(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fail(const std::string& reason)
|
||||||
|
{
|
||||||
|
throw std::runtime_error(reason);
|
||||||
|
}
|
||||||
|
|
||||||
void CountMacro()
|
void CountMacro()
|
||||||
{
|
{
|
||||||
macro_count++;
|
macro_count++;
|
||||||
TCERR << "*** Incrementing macro count, value is now" << macro_count << std::endl;;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
|
@ -90,6 +90,7 @@ typedef std::map< std::string, SuiteMap > TestMap;
|
||||||
void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr );
|
void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr );
|
||||||
|
|
||||||
void skip(const std::string& reason);
|
void skip(const std::string& reason);
|
||||||
|
void fail(const std::string& reason);
|
||||||
|
|
||||||
|
|
||||||
#endif // __TEST_H
|
#endif // __TEST_H
|
||||||
|
|
Loading…
Reference in New Issue