+ Used to be UnitTester.*

+ Now gracefully handles situations where a suite and an
  individual test both have the same name.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@702 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2002-08-11 03:42:49 +00:00
parent 2ce9f3a6c6
commit d8575caf51
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,53 @@
#include "UnitTesterHelper.h"
#include <SemaphoreSyncObject.h>
#include <Directory.h>
// ##### Include headers for statically linked tests here #####
//#include <ExampleTest.h>
UnitTesterShell shell("OpenBeOS Unit Testing Framework", new SemaphoreSyncObject);
int main(int argc, char *argv[]) {
// ##### Add test suites for statically linked tests here #####
// shell.AddTest( "Example", ExampleTest::Suite() );
BTestShell::SetGlobalShell(&shell);
// Load our dynamically linked tests
return shell.Run(argc, argv);
}
//const std::string UnitTesterShell::defaultLibDir = "./lib";
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;
}
void
UnitTesterShell::PrintValidArguments() {
BTestShell::PrintValidArguments();
cout << indent << "-obos Runs tests linked against our OpenBeOS libraries (*default*)" << endl;
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();
}

View File

@ -0,0 +1,18 @@
#ifndef __unit_tester_helper_h__
#define __unit_tester_helper_h__
#include <TestShell.h>
#include <string>
class UnitTesterShell : public BTestShell {
public:
UnitTesterShell(const std::string &description = "", SyncObject *syncObject = 0);
protected:
virtual void PrintDescription(int argc, char *argv[]);
virtual void PrintValidArguments();
virtual void LoadDynamicSuites();
};
//extern UnitTesterShell shell;
#endif // __unit_tester_helper_h__