2002-07-11 07:34:41 +04:00
|
|
|
#include "UnitTester.h"
|
2002-07-15 10:58:52 +04:00
|
|
|
#include <SemaphoreSyncObject.h>
|
2002-07-11 07:34:41 +04:00
|
|
|
#include <string>
|
2002-07-15 10:58:52 +04:00
|
|
|
#include <Directory.h>
|
2002-07-11 07:34:41 +04:00
|
|
|
|
|
|
|
// ##### Include headers for statically linked tests here #####
|
2002-07-15 10:58:52 +04:00
|
|
|
//#include <ExampleTest.h>
|
2002-07-11 07:34:41 +04:00
|
|
|
|
2002-07-15 10:58:52 +04:00
|
|
|
UnitTesterShell shell("OpenBeOS Unit Testing Framework", new SemaphoreSyncObject);
|
2002-07-11 07:34:41 +04:00
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
// ##### Add test suites for statically linked tests here #####
|
2002-07-15 10:58:52 +04:00
|
|
|
// shell.AddTest( "Example", ExampleTest::Suite() );
|
|
|
|
|
|
|
|
BTestShell::SetShell(&shell);
|
|
|
|
|
|
|
|
// Load our dynamically linked tests
|
|
|
|
BDirectory libDir("./lib");
|
|
|
|
int count = shell.LoadSuitesFrom(&libDir);
|
|
|
|
cout << "Loaded " << count << " suites" << endl;
|
2002-07-11 07:34:41 +04:00
|
|
|
|
|
|
|
return shell.Run(argc, argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
UnitTesterShell::UnitTesterShell(const std::string &description, SyncObject *syncObject)
|
|
|
|
: BTestShell(description, syncObject)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnitTesterShell::PrintDescription(int argc, char *argv[]) {
|
|
|
|
std::string AppName = argv[0];
|
|
|
|
cout << endl;
|
|
|
|
cout << "This program is the central testing framework for the purpose" << endl;
|
|
|
|
cout << "of testing and verifying the various kits, classes, functions," << endl;
|
|
|
|
cout << "and the like that comprise OpenBeOS." << endl;
|
|
|
|
|
2002-07-15 10:58:52 +04:00
|
|
|
if (AppName.rfind("UnitTester_r5") != std::string::npos) {
|
2002-07-11 07:34:41 +04:00
|
|
|
cout << endl;
|
2002-07-15 10:58:52 +04:00
|
|
|
cout << "Judging by its name (UnitTester_r5), this copy was" << endl;
|
2002-07-11 07:34:41 +04:00
|
|
|
cout << "probably linked against Be Inc.'s R5 implementations" << endl;
|
|
|
|
cout << "for the sake of comparison." << endl;
|
2002-07-15 10:58:52 +04:00
|
|
|
} else if (AppName.rfind("UnitTester") != std::string::npos) {
|
2002-07-11 07:34:41 +04:00
|
|
|
cout << endl;
|
2002-07-15 10:58:52 +04:00
|
|
|
cout << "Judging by its name (UnitTester), this copy was probably" << endl;
|
|
|
|
cout << "linked against our own OpenBeOS implementations." << endl;
|
2002-07-11 07:34:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|