2004-02-19 00:38:04 +03:00
|
|
|
#include <iostream>
|
|
|
|
|
2005-11-09 19:23:11 +03:00
|
|
|
#include "UnitTester.h"
|
2002-08-11 07:42:49 +04:00
|
|
|
#include <SemaphoreSyncObject.h>
|
|
|
|
#include <Directory.h>
|
|
|
|
|
|
|
|
// ##### Include headers for statically linked tests here #####
|
|
|
|
//#include <ExampleTest.h>
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2006-12-12 00:11:27 +03:00
|
|
|
UnitTesterShell shell("Haiku Unit Testing Framework", new SemaphoreSyncObject);
|
2002-08-11 07:42:49 +04:00
|
|
|
// ##### Add test suites for statically linked tests here #####
|
|
|
|
// shell.AddTest( "Example", ExampleTest::Suite() );
|
|
|
|
|
|
|
|
BTestShell::SetGlobalShell(&shell);
|
|
|
|
|
|
|
|
// Load our dynamically linked tests
|
|
|
|
|
2004-01-03 19:29:55 +03:00
|
|
|
int result = shell.Run(argc, argv);
|
|
|
|
|
|
|
|
// Unset global shell, just to be sure
|
|
|
|
BTestShell::SetGlobalShell(NULL);
|
|
|
|
|
|
|
|
return result;
|
2002-08-11 07:42:49 +04:00
|
|
|
}
|
|
|
|
|
2004-02-19 00:38:04 +03:00
|
|
|
//const string UnitTesterShell::defaultLibDir = "./lib";
|
2002-08-11 07:42:49 +04:00
|
|
|
|
2004-02-19 00:38:04 +03:00
|
|
|
UnitTesterShell::UnitTesterShell(const string &description, SyncObject *syncObject)
|
2002-08-11 07:42:49 +04:00
|
|
|
: BTestShell(description, syncObject)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnitTesterShell::PrintDescription(int argc, char *argv[]) {
|
2004-02-19 00:38:04 +03:00
|
|
|
string AppName = argv[0];
|
2002-08-11 07:42:49 +04:00
|
|
|
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;
|
2006-12-12 00:11:27 +03:00
|
|
|
cout << "and the like that comprise Haiku." << endl;
|
2002-08-11 07:42:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnitTesterShell::PrintValidArguments() {
|
|
|
|
BTestShell::PrintValidArguments();
|
2006-12-12 00:11:27 +03:00
|
|
|
cout << indent << "-haiku Runs tests linked against our Haiku libraries (*default*)" << endl;
|
2002-08-11 07:42:49 +04:00
|
|
|
cout << indent << "-r5 Runs tests linked against Be Inc.'s R5 libraries (instead" << endl;
|
|
|
|
cout << indent << " of our libraries) for the sake of comparison." << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnitTesterShell::LoadDynamicSuites() {
|
|
|
|
// Add the appropriate test lib path
|
|
|
|
string defaultLibDir = string(GlobalTestDir()) + "/lib";
|
|
|
|
fLibDirs.insert(defaultLibDir);
|
|
|
|
|
|
|
|
// Load away
|
|
|
|
BTestShell::LoadDynamicSuites();
|
|
|
|
}
|