Rework unit test framework (such as it is) to refer to tests by name & not numeric id. Mark tests as skipped if they don't make any TEST assertions or are skipped explicitly
This commit is contained in:
		
							parent
							
								
									0d21e71407
								
							
						
					
					
						commit
						8c73f1cf3b
					
				| 
						 | 
				
			
			@ -186,3 +186,7 @@ void TestArchive()
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Archive()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Archive", "Basic", TestArchive);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,3 +109,9 @@ void TestBlockFile()
 | 
			
		|||
 | 
			
		||||
    bf.Close(); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_BlockFile()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("BlockFile", "Basic", TestBlockFile);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,3 +125,7 @@ void TestBlockRecordArray()
 | 
			
		|||
    #endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_BlockRecordArray()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("BlockRecordArray", "Basic", TestBlockRecordArray);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,11 +75,7 @@ void TestCharUtilBasic()
 | 
			
		|||
    PrintChars( _T("fo\x23 54") );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
TSS_BeginTestSuiteFrom( cCharEncoderTest )
 | 
			
		||||
 | 
			
		||||
    TSS_AddTestCase( Basic );
 | 
			
		||||
        
 | 
			
		||||
TSS_EndTestSuite( cCharEncoderTest )
 | 
			
		||||
*/
 | 
			
		||||
void RegisterSuite_CharUtil()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("CharUtil", "Basic", TestCharUtilBasic);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,3 +161,10 @@ void TestCmdLineParser()
 | 
			
		|||
    // TODO -- test a bunch more!!!
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_CmdLineParser()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("CmdLineParser", "Basic", TestCmdLineParser);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,7 +185,8 @@ char NonZeroChar( char ch )
 | 
			
		|||
//TestMbToDb in codeconvert_t.cpp seems to hit an infinite loop or runs verrrry long; ifdef'd"
 | 
			
		||||
void TestMbToDb()
 | 
			
		||||
{
 | 
			
		||||
  TCERR << "\nTODO: TestMbToDb in codeconvert_t.cpp is flaky & needs to be fixed/replaced; currently disabled." << std::endl;
 | 
			
		||||
    skip("This test is flaky & needs to be fixed/replaced; currently disabled.");
 | 
			
		||||
    
 | 
			
		||||
#if 0
 | 
			
		||||
    std::string s;
 | 
			
		||||
    s.resize( 0x10000 * 2 ); // two bytes for each combination
 | 
			
		||||
| 
						 | 
				
			
			@ -240,7 +241,8 @@ void TestMbToDb()
 | 
			
		|||
// dbchar_t to mbchar_t
 | 
			
		||||
void TestDbToMb()
 | 
			
		||||
{
 | 
			
		||||
  TCERR << "\nTODO: TestDbToMb in codeconvert_t.cpp fails, most likely due to not speaking UTF-16. Should fix this." << std::endl;
 | 
			
		||||
  skip("This test fails, most likely due to not speaking UTF-16. Should fix this.");
 | 
			
		||||
    
 | 
			
		||||
#if 0
 | 
			
		||||
    wc16_string ws;
 | 
			
		||||
    wc16_string::size_type n;
 | 
			
		||||
| 
						 | 
				
			
			@ -344,4 +346,8 @@ bool LowASCIILooksLikeUCS2InWchart()
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_CodeConvert()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("CodeConvert", "MbToDb", TestMbToDb);
 | 
			
		||||
    RegisterTest("CodeConvert", "DbToMb", TestDbToMb);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,3 +177,9 @@ void TestConfigFile2(void)
 | 
			
		|||
    d.TraceDetail("Tests Passed!\n");
 | 
			
		||||
//#endif // NOT_BRIANS_TEST
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_ConfigFile()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("ConfigFile", "Basic 1", TestConfigFile);
 | 
			
		||||
    RegisterTest("ConfigFile", "Basic 2", TestConfigFile2);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -299,4 +299,7 @@ void TestCryptoArchive()
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_CryptoArchive()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("CryptoArchive", "Basic", TestCryptoArchive);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -416,3 +416,8 @@ void TestCrypto()
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Crypto()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Crypto", "Basic", TestCrypto);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,3 +212,8 @@ void TestDbDataSourceBasic()
 | 
			
		|||
    db.AssertAllBlocksValid();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_DbDataSource()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("DbDataSource", "Basic", TestDbDataSourceBasic);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,4 +90,7 @@ void TestDebug()
 | 
			
		|||
    d.TraceDebug("Exiting...\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Debug()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Debug", "Basic", TestDebug);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -321,17 +321,16 @@ void TestDisplayEncoderBasic()
 | 
			
		|||
    // make sure there are '\' and '"' in it )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*TSS_BeginTestSuiteFrom( cDisplayEncoderTest )
 | 
			
		||||
 | 
			
		||||
    TSS_AddTestCase( Basic );
 | 
			
		||||
    TSS_AddTestCase( TestHexToChar );
 | 
			
		||||
    TSS_AddTestCase( TestCharToHex );
 | 
			
		||||
    TSS_AddTestCase( TestStringToHex );
 | 
			
		||||
    TSS_AddTestCase( TestHexToString );
 | 
			
		||||
    TSS_AddTestCase( TestUnconvertable ); 
 | 
			
		||||
    TSS_AddTestCase( TestUnprintable ); 
 | 
			
		||||
    TSS_AddTestCase( TestQuoteAndBackSlash ); 
 | 
			
		||||
        
 | 
			
		||||
TSS_EndTestSuite( cDisplayEncoderTest )*/
 | 
			
		||||
void RegisterSuite_DisplayEncoder()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("DisplayEncoder", "Basic", TestDisplayEncoderBasic);
 | 
			
		||||
    RegisterTest("DisplayEncoder", "CharToHex", TestCharToHex);
 | 
			
		||||
    RegisterTest("DisplayEncoder", "HexToChar", TestHexToChar);
 | 
			
		||||
    RegisterTest("DisplayEncoder", "StringToHex", TestStringToHex);
 | 
			
		||||
    RegisterTest("DisplayEncoder", "HexToString", TestHexToString);
 | 
			
		||||
    //RegisterTest("DisplayEncoder", "Unconvertable", TestUnconvertable);
 | 
			
		||||
    //RegisterTest("DisplayEncoder", "Unprintable", TestUnprintable);
 | 
			
		||||
    RegisterTest("DisplayEncoder", "QuoteAndBackSlash", TestQuoteAndBackSlash);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,3 +81,8 @@ void TestError()
 | 
			
		|||
 | 
			
		||||
    TEST(threw);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Error()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Error", "Basic", TestError);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,3 +143,7 @@ void TestErrorBucketImpl()
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_ErrorBucketImpl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("ErrorBucketImpl", "Basic", TestErrorBucketImpl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,3 +158,8 @@ void TestFCOCompare()
 | 
			
		|||
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOCompare()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOCompare", "Basic", TestFCOCompare);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,9 +32,16 @@
 | 
			
		|||
// fcodatabasefile.cpp
 | 
			
		||||
#include "tw/stdtw.h"
 | 
			
		||||
#include "tw/fcodatabasefile.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
void TestFCODatabaseFile()
 | 
			
		||||
{
 | 
			
		||||
    cDebug d("TestFCODatabaseFile");
 | 
			
		||||
    d.TraceError("Implement this!\n");
 | 
			
		||||
    skip("TestFCODatabaseFile not implemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCODatabaseFile()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCODatabaseFile", "Basic", TestFCODatabaseFile);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -139,4 +139,7 @@ void TestFCOName()
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOName()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOName", "Basic", TestFCOName);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,3 +61,8 @@ void TestFCONameTbl()
 | 
			
		|||
    pNode4->Release();
 | 
			
		||||
    pNode5->Release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCONameTbl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCONameTbl", "Basic", TestFCONameTbl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -115,3 +115,7 @@ void TestUnprintable( const TCHAR* pchName, const TCHAR* pchGenre )
 | 
			
		|||
    TEST( fcoNameNew == fcoName );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCONameTranslator()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCONameTranslator", "Basic", TestFCONameTranslator);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,3 +94,7 @@ void TestFCOPropImpl()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOPropImpl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOPropImpl", "Basic", TestFCOPropImpl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,3 +192,8 @@ static void objManip (cFCOPropVector &testV, cDebug& d)
 | 
			
		|||
    v3.AddItem(3);
 | 
			
		||||
    TEST((v1 ^ v2)   == v3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOPropVector()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOPropVector", "Basic", TestFCOPropVector);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -171,3 +171,7 @@ void TestFCOReport()
 | 
			
		|||
    d.TraceDebug("Leaving...\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOReport()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOReport", "Basic", TestFCOReport);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -155,3 +155,7 @@ void TestFCOSetImpl()
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSetImpl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSetImpl", "Basic", TestFCOSetImpl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,3 +51,8 @@ void TestFCOSpec()
 | 
			
		|||
    cout << "End\tTestFCOSpec" << endl;
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSpec()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSpec", "Basic", TestFCOSpec);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,3 +88,8 @@ void TestFCOSpecAttr()
 | 
			
		|||
    pNew->Release();
 | 
			
		||||
    pAttr->Release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSpecAttr()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSpecAttr", "Basic", TestFCOSpecAttr);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,3 +129,8 @@ void TestFCOSpecHelper()
 | 
			
		|||
    delete pHelp1;
 | 
			
		||||
    delete pHelp2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSpecHelper()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSpecHelper", "Basic", TestFCOSpecHelper);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -164,3 +164,7 @@ void TestFCOSpecList()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSpecList()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSpecList", "Basic", TestFCOSpecList);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,3 +80,8 @@ void TestFcoSpecUtil()
 | 
			
		|||
 | 
			
		||||
    d.TraceDebug("Leaving..\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FcoSpecUtil()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FcoSpecUtil", "Basic", TestFcoSpecUtil);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,3 +58,7 @@ void TestFile()
 | 
			
		|||
    TEST(testStream);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_File()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("File", "Basic", TestFile);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,3 +126,8 @@ void TestFileHeader()
 | 
			
		|||
    TEST(memcmp(buf, "abc123", 6) == 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FileHeader()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FileHeader", "Basic", TestFileHeader);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,3 +71,7 @@ void TestFileUtil()
 | 
			
		|||
    unlink(source.c_str());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FileUtil()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FileUtil", "Basic", TestFileUtil);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,4 +108,9 @@ void TestFSDataSourceIter()
 | 
			
		|||
    PrintIter( iter, d );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FSDataSourceIter()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FSDataSourceIter", "Basic", TestFSDataSourceIter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,9 +32,16 @@
 | 
			
		|||
// fsobject_t -- the file system object test driver
 | 
			
		||||
#include "fs/stdfs.h"
 | 
			
		||||
#include "fs/fsobject.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
void TestFSObject()
 | 
			
		||||
{
 | 
			
		||||
    cDebug d("TestFSObject");
 | 
			
		||||
    d.TraceError("Implement this!\n");
 | 
			
		||||
    skip("TestFSObject not implemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FSObject()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FSObject", "Basic", TestFSObject);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -155,4 +155,8 @@ void TestGetSymLinkStr()
 | 
			
		|||
    TEST(arch.Length() == (int64)file.size());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FSPropCalc()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FSPropCalc", "Basic", TestFSPropCalc);
 | 
			
		||||
    RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,3 +133,7 @@ void cTestFSPropDisplayer::Test()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FSPropDisplayer()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FSPropDisplayer", "Basic", TestFSPropDisplayer);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,3 +92,8 @@ void TestFSPropSet()
 | 
			
		|||
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FSPropSet()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FSPropSet", "Basic", TestFSPropSet);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,3 +102,7 @@ void TestFCOSpecImpl()
 | 
			
		|||
    pSpec->Release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_FCOSpecImpl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("FCOSpecImpl", "Basic", TestFCOSpecImpl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,31 +33,30 @@
 | 
			
		|||
// genre_t.cpp
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include <typeinfo>
 | 
			
		||||
 | 
			
		||||
#include "fco/stdfco.h"
 | 
			
		||||
#include "fco/genreswitcher.h"
 | 
			
		||||
#include "twtest/test.h"
 | 
			
		||||
#include "fs/fs.h"
 | 
			
		||||
 | 
			
		||||
#include "fs/fsfactory.h"
 | 
			
		||||
 | 
			
		||||
void TestGenreSwitcher()
 | 
			
		||||
void TestGenre()
 | 
			
		||||
{
 | 
			
		||||
    cDebug d("TestGenreSwitcher");
 | 
			
		||||
    cDebug d("TestGenre");
 | 
			
		||||
    d.TraceDebug("Entering...\n");
 | 
			
		||||
 | 
			
		||||
    cGenreSwitcher* genreSwitcher = cGenreSwitcher::GetInstance();
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cFS::GenreID())) == cFS::GenreID());
 | 
			
		||||
 | 
			
		||||
    TEST(genreSwitcher->CurrentGenre() == cFS::GenreID());
 | 
			
		||||
    
 | 
			
		||||
    // can't switch to invalid genre
 | 
			
		||||
    //genreSwitcher->SelectGenre(cGenre::GENRE_INVALID);
 | 
			
		||||
    //TEST(genreSwitcher->CurrentGenre() == cGenre::GENRE_INVALID);
 | 
			
		||||
    //TODO: GenreToString() dies w/ GENRE_INVALID. Figure out if this should be changed.
 | 
			
		||||
    //
 | 
			
		||||
    //TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cGenre::GENRE_INVALID)) == cGenre::GENRE_INVALID);
 | 
			
		||||
 | 
			
		||||
    genreSwitcher->SelectGenre(cFS::GenreID());
 | 
			
		||||
    TEST(genreSwitcher->CurrentGenre() == cFS::GenreID());
 | 
			
		||||
    TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory));
 | 
			
		||||
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("fs")) == cFS::GenreID());
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("none of the above")) == cGenre::GENRE_INVALID);
 | 
			
		||||
 | 
			
		||||
    d.TraceDebug("All tests passed.\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Genre()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Genre", "Basic", TestGenre);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,3 +91,12 @@ void TestGenreSpecList()
 | 
			
		|||
    d.TraceDebug("All tests passed.\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_GenreSpecList()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("GenreSpecList", "Basic", TestGenreSpecList);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,25 +33,36 @@
 | 
			
		|||
// genreswitcher_t.h
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include <typeinfo>
 | 
			
		||||
 | 
			
		||||
#include "fco/stdfco.h"
 | 
			
		||||
#include "fco/genreswitcher.h"
 | 
			
		||||
#include "twtest/test.h"
 | 
			
		||||
#include "fs/fs.h"
 | 
			
		||||
 | 
			
		||||
void TestGenre()
 | 
			
		||||
#include "fs/fsfactory.h"
 | 
			
		||||
 | 
			
		||||
void TestGenreSwitcher()
 | 
			
		||||
{
 | 
			
		||||
    cDebug d("TestGenre");
 | 
			
		||||
    cDebug d("TestGenreSwitcher");
 | 
			
		||||
    d.TraceDebug("Entering...\n");
 | 
			
		||||
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cFS::GenreID())) == cFS::GenreID());
 | 
			
		||||
    
 | 
			
		||||
    //TODO: GenreToString() dies w/ GENRE_INVALID. Figure out if this should be changed.
 | 
			
		||||
    //
 | 
			
		||||
    //TEST(cGenreSwitcher::GetInstance()->StringToGenre(cGenreSwitcher::GetInstance()->GenreToString(cGenre::GENRE_INVALID)) == cGenre::GENRE_INVALID);
 | 
			
		||||
    
 | 
			
		||||
    cGenreSwitcher* genreSwitcher = cGenreSwitcher::GetInstance();
 | 
			
		||||
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("fs")) == cFS::GenreID());
 | 
			
		||||
    TEST(cGenreSwitcher::GetInstance()->StringToGenre(_T("none of the above")) == cGenre::GENRE_INVALID);
 | 
			
		||||
    TEST(genreSwitcher->CurrentGenre() == cFS::GenreID());
 | 
			
		||||
 | 
			
		||||
    // can't switch to invalid genre
 | 
			
		||||
    //genreSwitcher->SelectGenre(cGenre::GENRE_INVALID);
 | 
			
		||||
    //TEST(genreSwitcher->CurrentGenre() == cGenre::GENRE_INVALID);
 | 
			
		||||
 | 
			
		||||
    genreSwitcher->SelectGenre(cFS::GenreID());
 | 
			
		||||
    TEST(genreSwitcher->CurrentGenre() == cFS::GenreID());
 | 
			
		||||
    TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory));
 | 
			
		||||
 | 
			
		||||
    d.TraceDebug("All tests passed.\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_GenreSwitcher()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("GenreSwitcher", "Basic", TestGenreSwitcher);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,3 +97,7 @@ void TestGrowHeap()
 | 
			
		|||
    TEST( gh.TotalMemUsage() == 0 );
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
void RegisterSuite_GrowHeap()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("GrowHeap", "Basic", TestGrowHeap);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,15 +43,6 @@
 | 
			
		|||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
void HashTest1();
 | 
			
		||||
void HashTest2();
 | 
			
		||||
 | 
			
		||||
void TestHashTable(void)
 | 
			
		||||
{
 | 
			
		||||
    HashTest1();
 | 
			
		||||
    HashTest2();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HashTest1()
 | 
			
		||||
{
 | 
			
		||||
    //Test the Hash table with Key = TSTRING 
 | 
			
		||||
| 
						 | 
				
			
			@ -218,3 +209,9 @@ void HashTest2()
 | 
			
		|||
 | 
			
		||||
    d.TraceDebug("PASSED!\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_HashTable()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("HashTable", "Basic 1", HashTest1);
 | 
			
		||||
    RegisterTest("HashTable", "Basic 2", HashTest2);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -206,3 +206,8 @@ void TestHierDatabaseBasic()
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_HierDatabase()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("HierDatabase", "Basic", TestHierDatabaseBasic);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,3 +134,7 @@ void TestKeyFile()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_KeyFile()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("KeyFile", "Basic", TestKeyFile);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -204,6 +204,7 @@ void TestSizes()
 | 
			
		|||
{
 | 
			
		||||
    cDebug d("TestSizes");
 | 
			
		||||
    d.TraceError("Fix this!\n");
 | 
			
		||||
    skip("TODO: TestSizes needs work");
 | 
			
		||||
/*
 | 
			
		||||
    TEST( CanBeRepresentedAs( char(), char() ) );
 | 
			
		||||
    TEST( CanBeRepresentedAs( char(), unsigned char() ) );
 | 
			
		||||
| 
						 | 
				
			
			@ -234,3 +235,9 @@ bool CanBeRepresentedAs( E e, T t )
 | 
			
		|||
 | 
			
		||||
    return fReturn;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Platform()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Platform", "Alignment", TestAlignment);
 | 
			
		||||
    RegisterTest("Platform", "Sizes", TestSizes);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,6 +101,9 @@ void TestPolicyParser()
 | 
			
		|||
    cDebug d("TestPolicyParser()");
 | 
			
		||||
 | 
			
		||||
    test_policy_file("pol.txt");
 | 
			
		||||
 | 
			
		||||
    TCERR << "TestPolicyParser: Parser needs work to be able to test more than one policy" << std::endl;
 | 
			
		||||
    
 | 
			
		||||
//    test_policy_file("directives.txt");  //fails unless you substitute your hostname for 'your_host' in this file
 | 
			
		||||
    
 | 
			
		||||
// TODO: test currently segfaults if you create more than one policy parser in a process. (Not a real world scenario).
 | 
			
		||||
| 
						 | 
				
			
			@ -110,4 +113,7 @@ void TestPolicyParser()
 | 
			
		|||
    test_policy_file("polruleattr.txt"); */
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_PolicyParser()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("PolicyParser", "Basic", TestPolicyParser);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
#include "core/stdcore.h"
 | 
			
		||||
#include "core/refcountobj.h"
 | 
			
		||||
#include "core/debug.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
class cRefCountTestObj : public cRefCountObj
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -166,3 +167,7 @@ void TestRefCountObj()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_RefCountObj()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("RefCountObj", "Basic", TestRefCountObj);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,6 +95,9 @@ void TestResources()
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Resources()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Resources", "Basic", TestResources);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,7 @@
 | 
			
		|||
#include "core/stdcore.h"
 | 
			
		||||
#include "core/serializer.h"
 | 
			
		||||
#include "core/serializable.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
// The reading and writing functionality of the serializer is tested in 
 | 
			
		||||
// serializerimpl_t.cpp, so there's very little to be done here.
 | 
			
		||||
| 
						 | 
				
			
			@ -71,3 +72,8 @@ void TestSerializer()
 | 
			
		|||
{
 | 
			
		||||
    cSerTestObject test_obj;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Serializer()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Serializer", "Basic", TestSerializer);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,3 +178,7 @@ void TestSerializerImpl()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_SerializerImpl()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("SerializerImpl", "Basic", TestSerializerImpl);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -361,3 +361,7 @@ void TestSignature()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Signature()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Signature", "Basic", TestSignature);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,3 +144,7 @@ void TestSerRefCountObj()
 | 
			
		|||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_SerRefCountObj()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("SerRefCountObj", "Basic", TestSerRefCountObj);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,3 +93,7 @@ void OutputString( TSTRING& str )
 | 
			
		|||
    TEST( str == qe.Unencode(qe.Encode(str)) );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_StringEncoder()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("StringEncoder", "Basic", TestStringEncoder);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,3 +172,8 @@ void TestStringUtil()
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
#endif//__STRINGUTIL_T_H
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_StringUtil()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("StringUtil", "Basic", TestStringUtil);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,11 +31,17 @@
 | 
			
		|||
//
 | 
			
		||||
// tasktimer_t -- test driver for cTaskTimer
 | 
			
		||||
#include "core/stdcore.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
void TestTaskTimer()
 | 
			
		||||
{
 | 
			
		||||
    cDebug d("TestTaskTimer");
 | 
			
		||||
    d.TraceError("Implement this!\n");
 | 
			
		||||
    skip("TestTaskTimer unimplemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_TaskTimer()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("TaskTimer", "Basic", TestTaskTimer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,3 +133,8 @@ void test_wist(const TSTRING& input, cDebug& d)
 | 
			
		|||
        d.TraceDetail("%s \n", parse.c_str() );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_TCHAR()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("TCHAR", "Basic", TestTCHAR);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,197 +64,142 @@
 | 
			
		|||
#include <unistd.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
 | 
			
		||||
// the test routines
 | 
			
		||||
void TestFCOName();
 | 
			
		||||
void TestFCOTest();
 | 
			
		||||
void TestFCOSetImpl();
 | 
			
		||||
void TestFCOSpec();
 | 
			
		||||
void TestFCOPropVector();
 | 
			
		||||
void TestFileHeader();
 | 
			
		||||
void TestFile();
 | 
			
		||||
void TestFSPropSet();
 | 
			
		||||
void TestFCOSpecImpl();
 | 
			
		||||
void TestFSObject();
 | 
			
		||||
void TestFSPropCalc();
 | 
			
		||||
void TestFCOPropImpl();
 | 
			
		||||
void TestFCOCompare();
 | 
			
		||||
//void TestTripwire();
 | 
			
		||||
void TestWin32FSServices();
 | 
			
		||||
void TestFCOSpecList();
 | 
			
		||||
void TestFCOReport();
 | 
			
		||||
void TestArchive();
 | 
			
		||||
void TestSerializer();
 | 
			
		||||
void TestSerializerImpl();
 | 
			
		||||
void TestRefCountObj();
 | 
			
		||||
void TestSignature();
 | 
			
		||||
void TestSerRefCountObj();
 | 
			
		||||
void TestUnixFSServices();
 | 
			
		||||
void TestError();
 | 
			
		||||
void TestDebug();
 | 
			
		||||
void TestFcoSpecUtil();
 | 
			
		||||
void TestTypes();
 | 
			
		||||
void TestTCHAR();
 | 
			
		||||
void TestErrorBucketImpl();
 | 
			
		||||
void TestHashTable();
 | 
			
		||||
void TestTextReportViewer();
 | 
			
		||||
void TestFCONameTbl();
 | 
			
		||||
void TestConfigFile();
 | 
			
		||||
void TestResources();
 | 
			
		||||
void TestGetSymLinkStr();
 | 
			
		||||
void TestPolicyParser();
 | 
			
		||||
 | 
			
		||||
void TestFCOSpecHelper();
 | 
			
		||||
void TestCrypto();
 | 
			
		||||
void TestCryptoArchive();
 | 
			
		||||
void TestFCOSpecAttr();
 | 
			
		||||
void TestCmdLineParser();
 | 
			
		||||
void TestTaskTimer();
 | 
			
		||||
void TestKeyFile();
 | 
			
		||||
void TestTWUtil();
 | 
			
		||||
void TestFSPropDisplayer();
 | 
			
		||||
void TestFSPropDisplayer();
 | 
			
		||||
void TestGenre();
 | 
			
		||||
void TestFSDataSourceIter();
 | 
			
		||||
void TestGenerateDb();
 | 
			
		||||
void TestHierDatabaseBasic();
 | 
			
		||||
void TestGenreSwitcher();
 | 
			
		||||
void TestDbDataSourceBasic();
 | 
			
		||||
void TestGenreSpecList();
 | 
			
		||||
void TestIntegrityCheck();
 | 
			
		||||
void TestFCODatabaseFile();
 | 
			
		||||
void TestWchar16();
 | 
			
		||||
void TestStringEncoder();
 | 
			
		||||
 | 
			
		||||
void TestGrowHeap();
 | 
			
		||||
void TestPlatform();
 | 
			
		||||
void TestBlockFile();
 | 
			
		||||
void TestBlockRecordArray();
 | 
			
		||||
void TestTWLocale();
 | 
			
		||||
void TestFileUtil();
 | 
			
		||||
void TestFCONameTranslator();
 | 
			
		||||
void TestCodeConverter();
 | 
			
		||||
 | 
			
		||||
void TestCharToHex();
 | 
			
		||||
void TestHexToChar();
 | 
			
		||||
void TestStringToHex();
 | 
			
		||||
void TestHexToString();
 | 
			
		||||
//void TestUnconvertable();
 | 
			
		||||
//void TestUnprintable();
 | 
			
		||||
void TestQuoteAndBackSlash();
 | 
			
		||||
void TestDisplayEncoderBasic();
 | 
			
		||||
void TestCharUtilBasic();
 | 
			
		||||
void TestConfigFile2();
 | 
			
		||||
void TestUserNotifyStdout();
 | 
			
		||||
// Known test suites
 | 
			
		||||
void RegisterSuite_Archive();
 | 
			
		||||
void RegisterSuite_BlockFile();
 | 
			
		||||
void RegisterSuite_BlockRecordArray();
 | 
			
		||||
void RegisterSuite_CharUtil();
 | 
			
		||||
void RegisterSuite_CmdLineParser();
 | 
			
		||||
void RegisterSuite_CodeConvert();
 | 
			
		||||
void RegisterSuite_ConfigFile();
 | 
			
		||||
void RegisterSuite_CryptoArchive();
 | 
			
		||||
void RegisterSuite_Crypto();
 | 
			
		||||
void RegisterSuite_DbDataSource();
 | 
			
		||||
void RegisterSuite_Debug();
 | 
			
		||||
void RegisterSuite_DisplayEncoder();
 | 
			
		||||
void RegisterSuite_Error();
 | 
			
		||||
void RegisterSuite_ErrorBucketImpl();
 | 
			
		||||
void RegisterSuite_FCOCompare();
 | 
			
		||||
void RegisterSuite_FCODatabaseFile();
 | 
			
		||||
void RegisterSuite_FCOName();
 | 
			
		||||
void RegisterSuite_FCONameTbl();
 | 
			
		||||
void RegisterSuite_FCONameTranslator();
 | 
			
		||||
void RegisterSuite_FCOPropImpl();
 | 
			
		||||
void RegisterSuite_FCOPropVector();
 | 
			
		||||
void RegisterSuite_FCOReport();
 | 
			
		||||
void RegisterSuite_FCOSetImpl();
 | 
			
		||||
void RegisterSuite_FCOSpec();
 | 
			
		||||
void RegisterSuite_FCOSpecAttr();
 | 
			
		||||
void RegisterSuite_FCOSpecHelper();
 | 
			
		||||
void RegisterSuite_FCOSpecList();
 | 
			
		||||
void RegisterSuite_FcoSpecUtil();
 | 
			
		||||
void RegisterSuite_File();
 | 
			
		||||
void RegisterSuite_FileHeader();
 | 
			
		||||
void RegisterSuite_FileUtil();
 | 
			
		||||
void RegisterSuite_FSDataSourceIter();
 | 
			
		||||
void RegisterSuite_FSObject();
 | 
			
		||||
void RegisterSuite_FSPropCalc();
 | 
			
		||||
void RegisterSuite_FSPropDisplayer();
 | 
			
		||||
void RegisterSuite_FSPropSet();
 | 
			
		||||
void RegisterSuite_FCOSpecImpl();
 | 
			
		||||
void RegisterSuite_GenreSwitcher();
 | 
			
		||||
void RegisterSuite_GenreSpecList();
 | 
			
		||||
void RegisterSuite_Error();
 | 
			
		||||
void RegisterSuite_GrowHeap();
 | 
			
		||||
void RegisterSuite_HashTable();
 | 
			
		||||
void RegisterSuite_HierDatabase();
 | 
			
		||||
void RegisterSuite_KeyFile();
 | 
			
		||||
void RegisterSuite_Platform();
 | 
			
		||||
void RegisterSuite_PolicyParser();
 | 
			
		||||
void RegisterSuite_RefCountObj();
 | 
			
		||||
void RegisterSuite_Resources();
 | 
			
		||||
void RegisterSuite_Serializer();
 | 
			
		||||
void RegisterSuite_SerializerImpl();
 | 
			
		||||
void RegisterSuite_Signature();
 | 
			
		||||
void RegisterSuite_SerRefCountObj();
 | 
			
		||||
void RegisterSuite_StringEncoder();
 | 
			
		||||
void RegisterSuite_StringUtil();
 | 
			
		||||
void RegisterSuite_TaskTimer();
 | 
			
		||||
void RegisterSuite_TCHAR();
 | 
			
		||||
void RegisterSuite_TextReportViewer();
 | 
			
		||||
void RegisterSuite_TWLocale();
 | 
			
		||||
void RegisterSuite_TWUtil();
 | 
			
		||||
void RegisterSuite_Types();
 | 
			
		||||
void RegisterSuite_UnixFSServices();
 | 
			
		||||
void RegisterSuite_UserNotifyStdout();
 | 
			
		||||
void RegisterSuite_Wchar16();
 | 
			
		||||
 | 
			
		||||
/// This is easier than all the (cpp) files and declarations
 | 
			
		||||
#include "stringutil_t.h"
 | 
			
		||||
 | 
			
		||||
void Usage()
 | 
			
		||||
{
 | 
			
		||||
    TCERR << _T("Usage: test {all | testid [testid ...]}\n")
 | 
			
		||||
    TCERR << _T("Usage: test {all | list | testid [testid ...]}\n")
 | 
			
		||||
             _T("\n")
 | 
			
		||||
             _T("Ex: test 1 2 3 12\n")
 | 
			
		||||
             _T("(runs test id's 1, 2, 3, and 12)\n\n");
 | 
			
		||||
             _T("Ex: test foo bar/baz\n")
 | 
			
		||||
             _T("(runs suite foo and test bar/baz)\n\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const int MAX_TEST_ID = 88;
 | 
			
		||||
 | 
			
		||||
static int ran_count    = 0;
 | 
			
		||||
static int failed_count = 0;
 | 
			
		||||
static int skipped_count = 0;
 | 
			
		||||
static int macro_count = 0;
 | 
			
		||||
 | 
			
		||||
static std::vector<std::string> error_strings;
 | 
			
		||||
static std::vector<std::string> skipped_strings;
 | 
			
		||||
 | 
			
		||||
static void Test(int testID)
 | 
			
		||||
class skip_exception : public std::runtime_error
 | 
			
		||||
{
 | 
			
		||||
    TCERR << std::endl << "=== Running test ID #" << testID << " ===" << std::endl;
 | 
			
		||||
    
 | 
			
		||||
    bool ran = true;
 | 
			
		||||
public:
 | 
			
		||||
    skip_exception(const std::string& reason) : std::runtime_error(reason) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
    
 | 
			
		||||
        switch (testID)
 | 
			
		||||
void skip(const std::string& reason)
 | 
			
		||||
{
 | 
			
		||||
    throw skip_exception(reason);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CountMacro()
 | 
			
		||||
{
 | 
			
		||||
    macro_count++;
 | 
			
		||||
    TCERR << "*** Incrementing macro count, value is now" << macro_count << std::endl;;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/////////////////////////
 | 
			
		||||
 | 
			
		||||
static TestMap tests;
 | 
			
		||||
 | 
			
		||||
void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr )
 | 
			
		||||
{
 | 
			
		||||
    tests[suite][testName] = testPtr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void RunTest(const std::string& suiteName, const std::string& testName, TestPtr testPtr)
 | 
			
		||||
{
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        if (testPtr)
 | 
			
		||||
        {
 | 
			
		||||
        case 1: TestArchive(); break;
 | 
			
		||||
        case 2: TestCmdLineParser(); break;
 | 
			
		||||
        case 3: TestCrypto(); break;
 | 
			
		||||
        case 4: TestCryptoArchive(); break;
 | 
			
		||||
        case 5: TestDebug(); break;
 | 
			
		||||
        case 6: TestError(); break;
 | 
			
		||||
        case 7: TestErrorBucketImpl(); break;
 | 
			
		||||
        case 8: TestFCOCompare(); break;
 | 
			
		||||
        case 9: TestUserNotifyStdout(); break;
 | 
			
		||||
                
 | 
			
		||||
        case 12: TestFCOName(); break;
 | 
			
		||||
        case 13: TestFCONameTbl(); break;
 | 
			
		||||
        case 14: TestFCOPropVector(); break;
 | 
			
		||||
        case 15: TestFCOPropImpl(); break;
 | 
			
		||||
        case 16: TestFCOReport(); break;
 | 
			
		||||
        case 17: TestGetSymLinkStr(); break;
 | 
			
		||||
        case 18: TestFCOSetImpl(); break;
 | 
			
		||||
        case 19: TestFCOSpec(); break;
 | 
			
		||||
        case 20: TestFCOSpecAttr(); break;
 | 
			
		||||
        case 21: TestFCOSpecHelper(); break;
 | 
			
		||||
        case 22: TestFCOSpecList(); break;
 | 
			
		||||
        case 23: TestFcoSpecUtil(); break;
 | 
			
		||||
        case 24: TestFileHeader(); break;
 | 
			
		||||
        case 25: TestFile(); break;
 | 
			
		||||
        case 26: TestFSPropSet(); break;
 | 
			
		||||
        case 27: TestFSPropCalc(); break;
 | 
			
		||||
        case 28: TestFCOSpecImpl(); break;
 | 
			
		||||
        case 29: TestFSObject(); break;
 | 
			
		||||
        case 30: TestSerializer(); break;
 | 
			
		||||
        case 31: TestRefCountObj(); break;
 | 
			
		||||
        case 32: TestSerializerImpl(); break;
 | 
			
		||||
        case 33: TestResources(); break;
 | 
			
		||||
        case 34: TestSignature(); break;
 | 
			
		||||
        case 35: TestTaskTimer(); break;
 | 
			
		||||
        //case 36: TestTripwire(); break;
 | 
			
		||||
        case 37: TestTextReportViewer(); break;
 | 
			
		||||
        case 39: TestSerRefCountObj(); break;
 | 
			
		||||
        case 40: TestError(); break;
 | 
			
		||||
        case 41: TestFCODatabaseFile(); break;
 | 
			
		||||
        case 42: TestHashTable(); break;
 | 
			
		||||
        case 43: TestTCHAR(); break;
 | 
			
		||||
        case 44: TestTypes(); break;
 | 
			
		||||
        case 45: TestUnixFSServices(); break;
 | 
			
		||||
        case 46: TestConfigFile(); break;
 | 
			
		||||
        case 47: TestPolicyParser(); break;
 | 
			
		||||
        case 48: TestKeyFile(); break;
 | 
			
		||||
        case 49: TestTWUtil(); break;
 | 
			
		||||
        case 50: TestFSPropDisplayer(); break;
 | 
			
		||||
        case 52: TestGenre(); break;        
 | 
			
		||||
        case 53: TestFSDataSourceIter(); break;
 | 
			
		||||
        //case 54: TestGenerateDb(); break;
 | 
			
		||||
        case 55: TestHierDatabaseBasic(); break;
 | 
			
		||||
        case 56: TestGenreSwitcher(); break;
 | 
			
		||||
        case 57: TestDbDataSourceBasic(); break;
 | 
			
		||||
        case 58: TestGenreSpecList(); break;
 | 
			
		||||
        //case 59: TestIntegrityCheck(); break;
 | 
			
		||||
                
 | 
			
		||||
        case 65: TestWchar16(); break;        
 | 
			
		||||
        case 66: TestStringEncoder(); break;
 | 
			
		||||
 | 
			
		||||
        case 69: TestGrowHeap(); break;
 | 
			
		||||
        case 70: TestPlatform(); break;
 | 
			
		||||
        case 71: TestBlockFile(); break;
 | 
			
		||||
        case 72: TestBlockRecordArray(); break;
 | 
			
		||||
        case 74: TestFileUtil(); break;
 | 
			
		||||
        case 75: TestTWLocale(); break; 
 | 
			
		||||
        case 76: TestFCONameTranslator(); break; 
 | 
			
		||||
        case 77: TestStringUtil(); break; 
 | 
			
		||||
        case 78: TestCodeConverter(); break;
 | 
			
		||||
                
 | 
			
		||||
        case 79: TestCharToHex(); break;
 | 
			
		||||
        case 80: TestHexToChar(); break;
 | 
			
		||||
        case 81: TestStringToHex(); break;
 | 
			
		||||
        case 82: TestHexToString(); break;
 | 
			
		||||
            //    case 83: TestUnconvertable(); break;
 | 
			
		||||
            //    case 84: TestUnprintable(); break;
 | 
			
		||||
        case 85: TestQuoteAndBackSlash(); break;
 | 
			
		||||
        case 86: TestDisplayEncoderBasic(); break;
 | 
			
		||||
        case 87: TestCharUtilBasic(); break;
 | 
			
		||||
        case 88: TestConfigFile2(); break;
 | 
			
		||||
        default: ran = false; break;
 | 
			
		||||
            ran_count++;
 | 
			
		||||
            int pre_count = macro_count;
 | 
			
		||||
            testPtr();
 | 
			
		||||
            if (macro_count > pre_count)
 | 
			
		||||
                TCERR << "PASSED" << std::endl;
 | 
			
		||||
            else
 | 
			
		||||
                skip("Test did not make any TEST assertions");
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    catch (skip_exception& e)
 | 
			
		||||
    {
 | 
			
		||||
        TCERR << "SKIPPED: " << e.what() << std::endl;
 | 
			
		||||
 | 
			
		||||
        std::stringstream sstr;
 | 
			
		||||
        sstr << "Test " << suiteName << "/" << testName << ": " << e.what();
 | 
			
		||||
        skipped_strings.push_back(sstr.str());
 | 
			
		||||
 | 
			
		||||
        skipped_count++;
 | 
			
		||||
    }
 | 
			
		||||
    catch (eError& error)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -262,7 +207,7 @@ static void Test(int testID)
 | 
			
		|||
        cTWUtil::PrintErrorMsg(error);
 | 
			
		||||
 | 
			
		||||
        std::stringstream sstr;
 | 
			
		||||
        sstr << "Test " << testID << ": " << error.GetMsg();
 | 
			
		||||
        sstr << "Test " << suiteName << "/" << testName << ": " << error.GetMsg();
 | 
			
		||||
        error_strings.push_back(sstr.str());
 | 
			
		||||
 | 
			
		||||
        failed_count++;
 | 
			
		||||
| 
						 | 
				
			
			@ -271,7 +216,7 @@ static void Test(int testID)
 | 
			
		|||
        TCERR << "FAILED: " << e.what() << std::endl;
 | 
			
		||||
 | 
			
		||||
        std::stringstream sstr;
 | 
			
		||||
        sstr << "Test " << testID << ": " << e.what();
 | 
			
		||||
        sstr << "Test " << suiteName << "/" << testName << ": " << e.what();
 | 
			
		||||
        error_strings.push_back(sstr.str());
 | 
			
		||||
 | 
			
		||||
        failed_count++;
 | 
			
		||||
| 
						 | 
				
			
			@ -280,21 +225,134 @@ static void Test(int testID)
 | 
			
		|||
        TCERR << "FAILED: <unknown>" << std::endl;
 | 
			
		||||
 | 
			
		||||
        std::stringstream sstr;
 | 
			
		||||
        sstr << "Test " << testID << ": <unknown>";
 | 
			
		||||
        sstr << "Test " << suiteName << "/" << testName << ": <unknown>";
 | 
			
		||||
        error_strings.push_back(sstr.str());
 | 
			
		||||
 | 
			
		||||
        failed_count++;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if(ran)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void RunTestSuite(const std::string& suiteName, SuiteMap suite)
 | 
			
		||||
{
 | 
			
		||||
    SuiteMap::const_iterator itr;
 | 
			
		||||
    for( itr = suite.begin(); itr != suite.end(); ++itr)
 | 
			
		||||
    {
 | 
			
		||||
        ran_count++;
 | 
			
		||||
        TCERR << std::endl << "=== test ID #" << testID << " completed ===" << std::endl;
 | 
			
		||||
        TCERR << "----- Running test: " << suiteName << "/" << itr->first << " -----" << std::endl << std::endl;
 | 
			
		||||
        RunTest(suiteName, itr->first, itr->second);
 | 
			
		||||
        TCERR << std::endl << "----- Finished test: " << suiteName << "/" << itr->first << " -----" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void RunAllTests()
 | 
			
		||||
{
 | 
			
		||||
    TestMap::const_iterator itr;
 | 
			
		||||
    for( itr = tests.begin(); itr != tests.end(); ++itr)
 | 
			
		||||
    {
 | 
			
		||||
        TCERR << std::endl << "===== Starting test suite: " << itr->first << " =====" << std::endl;
 | 
			
		||||
        RunTestSuite(itr->first, itr->second);
 | 
			
		||||
        TCERR << "===== Finished test suite: " << itr->first << " =====" << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ListTests()
 | 
			
		||||
{
 | 
			
		||||
    TestMap::const_iterator itr;
 | 
			
		||||
    for( itr = tests.begin(); itr != tests.end(); ++itr)
 | 
			
		||||
    {
 | 
			
		||||
        std::string suiteName = itr->first;
 | 
			
		||||
        SuiteMap suite = itr->second;
 | 
			
		||||
 | 
			
		||||
        TCERR << suiteName << std::endl;
 | 
			
		||||
        SuiteMap::const_iterator itr;
 | 
			
		||||
        for( itr = suite.begin(); itr != suite.end(); ++itr)
 | 
			
		||||
        {
 | 
			
		||||
            TCERR << "  " << suiteName << "/" << itr->first << std::endl;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void RunTest(const std::string& to_run)
 | 
			
		||||
{
 | 
			
		||||
    std::string::size_type pos = to_run.find_first_of("/");
 | 
			
		||||
    if(pos == std::string::npos)
 | 
			
		||||
    {
 | 
			
		||||
        RunTestSuite(to_run, tests[to_run]);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
        TCERR << std::endl << "=== test ID #" << testID << " currently unused ===" << std::endl;
 | 
			
		||||
    {
 | 
			
		||||
        std::string suite = to_run.substr(0, pos);
 | 
			
		||||
        std::string testName = to_run.substr(pos+1);
 | 
			
		||||
        RunTest(suite, testName, tests[suite][testName]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void RegisterSuites()
 | 
			
		||||
{
 | 
			
		||||
    RegisterSuite_Archive();
 | 
			
		||||
    RegisterSuite_BlockFile();
 | 
			
		||||
    RegisterSuite_BlockRecordArray();
 | 
			
		||||
    RegisterSuite_CharUtil();
 | 
			
		||||
    RegisterSuite_CmdLineParser();
 | 
			
		||||
    RegisterSuite_CodeConvert();
 | 
			
		||||
    RegisterSuite_ConfigFile();
 | 
			
		||||
    RegisterSuite_CryptoArchive();
 | 
			
		||||
    RegisterSuite_Crypto();
 | 
			
		||||
    RegisterSuite_DbDataSource();
 | 
			
		||||
    RegisterSuite_Debug();
 | 
			
		||||
    RegisterSuite_DisplayEncoder();
 | 
			
		||||
    RegisterSuite_Error();
 | 
			
		||||
    RegisterSuite_ErrorBucketImpl();
 | 
			
		||||
    RegisterSuite_FCOCompare();
 | 
			
		||||
    RegisterSuite_FCODatabaseFile();
 | 
			
		||||
    RegisterSuite_FCOName();
 | 
			
		||||
    RegisterSuite_FCONameTbl();
 | 
			
		||||
    RegisterSuite_FCONameTranslator();
 | 
			
		||||
    RegisterSuite_FCOPropImpl();
 | 
			
		||||
    RegisterSuite_FCOPropVector();
 | 
			
		||||
    RegisterSuite_FCOReport();
 | 
			
		||||
    RegisterSuite_FCOSetImpl();
 | 
			
		||||
    RegisterSuite_FCOSpec();
 | 
			
		||||
    RegisterSuite_FCOSpecAttr();
 | 
			
		||||
    RegisterSuite_FCOSpecHelper();
 | 
			
		||||
    RegisterSuite_FCOSpecList();
 | 
			
		||||
    RegisterSuite_FcoSpecUtil();
 | 
			
		||||
    RegisterSuite_File();
 | 
			
		||||
    RegisterSuite_FileHeader();
 | 
			
		||||
    RegisterSuite_FileUtil();
 | 
			
		||||
    RegisterSuite_FSDataSourceIter();
 | 
			
		||||
    RegisterSuite_FSObject();
 | 
			
		||||
    RegisterSuite_FSPropCalc();
 | 
			
		||||
    RegisterSuite_FSPropDisplayer();
 | 
			
		||||
    RegisterSuite_FSPropSet();
 | 
			
		||||
    RegisterSuite_FCOSpecImpl();
 | 
			
		||||
    RegisterSuite_GenreSwitcher();
 | 
			
		||||
    RegisterSuite_GenreSpecList();
 | 
			
		||||
    RegisterSuite_Error();
 | 
			
		||||
    RegisterSuite_GrowHeap();
 | 
			
		||||
    RegisterSuite_HashTable();
 | 
			
		||||
    RegisterSuite_HierDatabase();
 | 
			
		||||
    RegisterSuite_KeyFile();
 | 
			
		||||
    RegisterSuite_Platform();
 | 
			
		||||
    RegisterSuite_PolicyParser();
 | 
			
		||||
    RegisterSuite_RefCountObj();
 | 
			
		||||
    RegisterSuite_Resources();
 | 
			
		||||
    RegisterSuite_Serializer();
 | 
			
		||||
    RegisterSuite_SerializerImpl();
 | 
			
		||||
    RegisterSuite_Signature();
 | 
			
		||||
    RegisterSuite_SerRefCountObj();
 | 
			
		||||
    RegisterSuite_StringEncoder();
 | 
			
		||||
    RegisterSuite_StringUtil();
 | 
			
		||||
    RegisterSuite_TaskTimer();
 | 
			
		||||
    RegisterSuite_TCHAR();
 | 
			
		||||
    RegisterSuite_TextReportViewer();
 | 
			
		||||
    RegisterSuite_TWLocale();
 | 
			
		||||
    RegisterSuite_TWUtil();
 | 
			
		||||
    RegisterSuite_Types();
 | 
			
		||||
    RegisterSuite_UnixFSServices();
 | 
			
		||||
    RegisterSuite_UserNotifyStdout();
 | 
			
		||||
    RegisterSuite_Wchar16();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
std::string TwTestDir()
 | 
			
		||||
{
 | 
			
		||||
    static std::string dir;
 | 
			
		||||
| 
						 | 
				
			
			@ -358,17 +416,21 @@ void tw_unexpected_handler()
 | 
			
		|||
 | 
			
		||||
int _tmain(int argc, TCHAR** argv)
 | 
			
		||||
{
 | 
			
		||||
#ifdef _DEBUG
 | 
			
		||||
    std::cout << "Test: Init" << std::endl;
 | 
			
		||||
    std::cout << "Test: Setup" << std::endl;
 | 
			
		||||
    std::cout << "Test: argc  - " << argc << std::endl;
 | 
			
		||||
    std::cout << "Test: *argv - " << argv[0] << std::endl;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    try 
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << "Test: Setup" << std::endl;
 | 
			
		||||
        std::cout << "Test: argc  - " << argc << std::endl;
 | 
			
		||||
        std::cout << "Test: *argv - " << argv[0] << std::endl;
 | 
			
		||||
 | 
			
		||||
        EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler);
 | 
			
		||||
        EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler);
 | 
			
		||||
 | 
			
		||||
        if (argc < 2)
 | 
			
		||||
            Usage();
 | 
			
		||||
 | 
			
		||||
        cTWInit twInit;
 | 
			
		||||
        twInit.Init( argv[0] );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -377,20 +439,24 @@ int _tmain(int argc, TCHAR** argv)
 | 
			
		|||
        //cDebug::SetDebugLevel(cDebug::D_NEVER);
 | 
			
		||||
        cDebug::SetDebugLevel(cDebug::D_DETAIL);
 | 
			
		||||
        //cDebug::SetDebugLevel(cDebug::D_DEBUG);
 | 
			
		||||
        
 | 
			
		||||
        int i;
 | 
			
		||||
 | 
			
		||||
        if (argc < 2)
 | 
			
		||||
            Usage();
 | 
			
		||||
        else if (_tcsicmp(argv[1], _T("all")) == 0) 
 | 
			
		||||
            // run all the tests
 | 
			
		||||
            for (i = 1; i <= MAX_TEST_ID; ++i)
 | 
			
		||||
                Test(i);
 | 
			
		||||
        RegisterSuites();
 | 
			
		||||
 | 
			
		||||
        if (_tcsicmp(argv[1], _T("all")) == 0)
 | 
			
		||||
        {
 | 
			
		||||
            RunAllTests();
 | 
			
		||||
        }
 | 
			
		||||
        else if(_tcsicmp(argv[1], _T("list")) == 0)
 | 
			
		||||
        {
 | 
			
		||||
            ListTests();
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
            for (i = 1; i < argc; ++i)
 | 
			
		||||
                Test(_ttoi(argv[i]));    // Note: if atoi returns 0, Test() will handle it fine.
 | 
			
		||||
            
 | 
			
		||||
    } 
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 1; i < argc; ++i)
 | 
			
		||||
                RunTest(argv[i]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    catch (eError& error)
 | 
			
		||||
    {        
 | 
			
		||||
        cTWUtil::PrintErrorMsg(error);
 | 
			
		||||
| 
						 | 
				
			
			@ -404,16 +470,30 @@ int _tmain(int argc, TCHAR** argv)
 | 
			
		|||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // make sure all the refrence counted objects have been destroyed
 | 
			
		||||
    // make sure all the reference counted objects have been destroyed
 | 
			
		||||
    // this test always fails because of the static cFCONameTbl
 | 
			
		||||
    //TEST(cRefCountObj::AllRefCountObjDestoryed() == true);
 | 
			
		||||
 | 
			
		||||
    std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures." << std::endl;
 | 
			
		||||
    std::cout << std::endl << "Ran " << ran_count << " unit tests with " << failed_count << " failures, " << skipped_count << " skipped." << std::endl;
 | 
			
		||||
 | 
			
		||||
    std::vector<std::string>::iterator itr;
 | 
			
		||||
    for (itr = error_strings.begin(); itr != error_strings.end(); ++itr)
 | 
			
		||||
    if (failed_count)
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << "\t" << *itr << std::endl;
 | 
			
		||||
        std::cout << std::endl << "Failures: " << std::endl;
 | 
			
		||||
        std::vector<std::string>::iterator itr;
 | 
			
		||||
        for (itr = error_strings.begin(); itr != error_strings.end(); ++itr)
 | 
			
		||||
        {
 | 
			
		||||
            std::cout << "\t" << *itr << std::endl;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (skipped_count)
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << std::endl << "Skipped: " << std::endl;
 | 
			
		||||
        std::vector<std::string>::iterator itr;
 | 
			
		||||
        for (itr = skipped_strings.begin(); itr != skipped_strings.end(); ++itr)
 | 
			
		||||
        {
 | 
			
		||||
            std::cout << "\t" << *itr << std::endl;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    std::cout << std::endl;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,9 +66,13 @@ public:
 | 
			
		|||
 | 
			
		||||
TSS_EndPackage( cTest )
 | 
			
		||||
 | 
			
		||||
void CountMacro();
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// TEST() -- Works like ASSERT() but it also breaks during release mode
 | 
			
		||||
#define TEST(exp)   if (!(exp)) \
 | 
			
		||||
// TEST() -- throw a std::runtime error if test condition is false.
 | 
			
		||||
//
 | 
			
		||||
#define TEST(exp)   CountMacro(); \
 | 
			
		||||
                    if (!(exp)) \
 | 
			
		||||
                    { \
 | 
			
		||||
                        std::cerr<<"TEST(" << #exp << ") failure, file " << __FILE__ << " line " << __LINE__ << std::endl; \
 | 
			
		||||
                        throw std::runtime_error(#exp); \
 | 
			
		||||
| 
						 | 
				
			
			@ -79,5 +83,14 @@ TSS_EndPackage( cTest )
 | 
			
		|||
std::string TwTestDir();
 | 
			
		||||
std::string TwTestPath(const std::string& child);
 | 
			
		||||
 | 
			
		||||
typedef void (*TestPtr)();
 | 
			
		||||
typedef std::map< std::string, TestPtr >  SuiteMap;
 | 
			
		||||
typedef std::map< std::string, SuiteMap > TestMap;
 | 
			
		||||
 | 
			
		||||
void RegisterTest(const std::string& suite, const std::string testName, TestPtr testPtr );
 | 
			
		||||
 | 
			
		||||
void skip(const std::string& reason);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif // __TEST_H
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ static void TraceReport(const cFCOReport& r, cDebug& d)
 | 
			
		|||
 | 
			
		||||
void TestTextReportViewer()
 | 
			
		||||
{
 | 
			
		||||
    TCERR << std::endl << "TestTextReportViewer needs to be cleaned up & fixed, currently disabled" << std::endl;
 | 
			
		||||
    skip("TestTextReportViewer needs to be cleaned up & fixed, currently disabled");
 | 
			
		||||
    
 | 
			
		||||
#if 0
 | 
			
		||||
    cFCOReport  report;
 | 
			
		||||
| 
						 | 
				
			
			@ -476,3 +476,7 @@ void MakeDir( const TCHAR* const lpszDirName )
 | 
			
		|||
 | 
			
		||||
//#endif //FIXED_TRV_TEST_SUITE
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_TextReportViewer()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("TextReportViewer", "Basic", TestTextReportViewer);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@
 | 
			
		|||
#include "core/stdcore.h"
 | 
			
		||||
#include "core/debug.h"
 | 
			
		||||
#include "core/twlocale.h"
 | 
			
		||||
#include "test.h"
 | 
			
		||||
 | 
			
		||||
void TestAtoi();
 | 
			
		||||
void TestItoa();
 | 
			
		||||
| 
						 | 
				
			
			@ -56,6 +57,8 @@ void TestHex();
 | 
			
		|||
 | 
			
		||||
void TestTWLocale()
 | 
			
		||||
{
 | 
			
		||||
    skip("TWLocale tests are ifdef'd out, need to revisit them");
 | 
			
		||||
    
 | 
			
		||||
#ifdef DOESNTWORK
 | 
			
		||||
    TestHex();
 | 
			
		||||
    TestAtoi();
 | 
			
		||||
| 
						 | 
				
			
			@ -225,3 +228,8 @@ void TestHex()
 | 
			
		|||
}
 | 
			
		||||
#endif//DOESNTWORK
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_TWLocale()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("TWLocale", "Basic", TestTWLocale);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,3 +108,8 @@ std::string WideToNarrow( const TSTRING& strWide )
 | 
			
		|||
    return strWide; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_TWUtil()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("TWUtil", "Basic", TestTWUtil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,3 +50,8 @@ void TestTypes()
 | 
			
		|||
    TEST(sizeof(float32)    == 4);
 | 
			
		||||
    TEST(sizeof(float64)    == 8);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Types()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Types", "Basic", TestTypes);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,7 +158,10 @@ void TestUnixFSServices()
 | 
			
		|||
    TEST( pFSServices->FileDelete( newtestfile ) );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_UnixFSServices()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("UnixFSServices", "Basic", TestUnixFSServices);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,4 +41,10 @@ void TestUserNotifyStdout()
 | 
			
		|||
{
 | 
			
		||||
    cDebug d("TestUserNotifyStdout");
 | 
			
		||||
    d.TraceError("Implement this!\n");
 | 
			
		||||
    skip("TestUserNotifyStdout unimplemented");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_UserNotifyStdout()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("UserNotifyStdout", "Basic", TestUserNotifyStdout);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,3 +124,8 @@ void TestWchar16()
 | 
			
		|||
 | 
			
		||||
    db.TraceAlways("Done...\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegisterSuite_Wchar16()
 | 
			
		||||
{
 | 
			
		||||
    RegisterTest("Wchar16", "Basic", TestWchar16);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue