* Coding style cleanup, added license. No functional change.
* Note that our tests currently don't work because overloading BTestShell doesn't seem to work (the overridden LoadDynamicSuites() is never called). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+63
-40
@@ -1,17 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "UnitTester.h"
|
|
||||||
#include <SemaphoreSyncObject.h>
|
#include <SemaphoreSyncObject.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
|
|
||||||
// ##### Include headers for statically linked tests here #####
|
#include "UnitTester.h"
|
||||||
//#include <ExampleTest.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
UnitTesterShell::UnitTesterShell(const string &description,
|
||||||
UnitTesterShell shell("Haiku Unit Testing Framework", new SemaphoreSyncObject);
|
SyncObject *syncObject)
|
||||||
|
:
|
||||||
|
BTestShell(description, syncObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
UnitTesterShell::PrintDescription(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
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 Haiku." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
UnitTesterShell::PrintValidArguments()
|
||||||
|
{
|
||||||
|
BTestShell::PrintValidArguments();
|
||||||
|
cout << indent << "-haiku Runs tests linked against our Haiku "
|
||||||
|
"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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
UnitTesterShell shell("Haiku Unit Testing Framework",
|
||||||
|
new SemaphoreSyncObject);
|
||||||
|
|
||||||
// ##### Add test suites for statically linked tests here #####
|
// ##### Add test suites for statically linked tests here #####
|
||||||
// shell.AddTest( "Example", ExampleTest::Suite() );
|
//shell.AddTest("Example", ExampleTest::Suite());
|
||||||
|
|
||||||
BTestShell::SetGlobalShell(&shell);
|
BTestShell::SetGlobalShell(&shell);
|
||||||
|
|
||||||
@@ -24,37 +81,3 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//const string UnitTesterShell::defaultLibDir = "./lib";
|
|
||||||
|
|
||||||
UnitTesterShell::UnitTesterShell(const string &description, SyncObject *syncObject)
|
|
||||||
: BTestShell(description, syncObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
UnitTesterShell::PrintDescription(int argc, char *argv[]) {
|
|
||||||
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 Haiku." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
UnitTesterShell::PrintValidArguments() {
|
|
||||||
BTestShell::PrintValidArguments();
|
|
||||||
cout << indent << "-haiku Runs tests linked against our Haiku 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();
|
|
||||||
}
|
|
||||||
|
|||||||
+16
-8
@@ -1,18 +1,26 @@
|
|||||||
#ifndef __unit_tester_helper_h__
|
/*
|
||||||
#define __unit_tester_helper_h__
|
* Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef UNIT_TESTER_SHELL_H
|
||||||
|
#define UNIT_TESTER_SHELL_H
|
||||||
|
|
||||||
|
|
||||||
#include <TestShell.h>
|
#include <TestShell.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
class UnitTesterShell : public BTestShell {
|
class UnitTesterShell : public BTestShell {
|
||||||
public:
|
public:
|
||||||
UnitTesterShell(const string &description = "", SyncObject *syncObject = 0);
|
UnitTesterShell(const string &description = "",
|
||||||
|
SyncObject *syncObject = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void PrintDescription(int argc, char *argv[]);
|
virtual void PrintDescription(int argc, char *argv[]);
|
||||||
virtual void PrintValidArguments();
|
virtual void PrintValidArguments();
|
||||||
virtual void LoadDynamicSuites();
|
virtual void LoadDynamicSuites();
|
||||||
};
|
};
|
||||||
|
|
||||||
//extern UnitTesterShell shell;
|
|
||||||
|
|
||||||
#endif // __unit_tester_helper_h__
|
#endif // UNIT_TESTER_SHELL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user