mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
completed the basic testsuite class
svn-id: r49392
This commit is contained in:
parent
5df3809d37
commit
91a8d25cea
@ -27,14 +27,29 @@ bool testFullScreenMode() {
|
||||
g_system->endGFXTransaction();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GFXTestSuite::GFXTestSuite() {
|
||||
addTest("FullScreenMode", &testFullScreenMode);
|
||||
}
|
||||
|
||||
int execute() {
|
||||
//TODO: Implement the method
|
||||
GFXTestSuite::~GFXTestSuite() {
|
||||
printf("Cleanup\n");
|
||||
}
|
||||
|
||||
const char *GFXTestSuite::getName() {
|
||||
return "GFX";
|
||||
}
|
||||
|
||||
int GFXTestSuite::execute() {
|
||||
//TODO: Implement the method
|
||||
for (Common::Array<Test*>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
|
||||
printf("Executing Test:%s\n", ((*i)->featureName).c_str());
|
||||
printf("Result:%d",(*i)->driver());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GRAPHICS_H
|
||||
#ifndef GRAPHICS_H
|
||||
#define GRAPHICS_H
|
||||
|
||||
#include "testbed/testsuite.h"
|
||||
@ -16,8 +16,10 @@ public:
|
||||
* @see addTest()
|
||||
*/
|
||||
GFXTestSuite();
|
||||
~GFXTestSuite() {};
|
||||
}
|
||||
~GFXTestSuite();
|
||||
int execute();
|
||||
const char *getName();
|
||||
};
|
||||
|
||||
} // End of namespace Testbed
|
||||
|
||||
|
@ -2,6 +2,7 @@ MODULE := engines/testbed
|
||||
|
||||
MODULE_OBJS := \
|
||||
detection.o \
|
||||
graphics.o \
|
||||
testbed.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "engines/util.h"
|
||||
|
||||
#include "testbed/testbed.h"
|
||||
#include "testbed/graphics.h"
|
||||
|
||||
namespace Testbed {
|
||||
|
||||
@ -49,7 +50,9 @@ Common::Error TestbedEngine::run() {
|
||||
// Additional setup.
|
||||
printf("TestbedEngine::init\n");
|
||||
|
||||
|
||||
GFXTestSuite ts;
|
||||
ts.execute();
|
||||
|
||||
// Your main even loop should be (invoked from) here.
|
||||
printf("TestbedEngine::go: Hello, World!\n");
|
||||
|
||||
|
@ -9,21 +9,12 @@ namespace Testbed {
|
||||
|
||||
typedef bool (*invokingFunction)();
|
||||
|
||||
/**
|
||||
* Make g_system available to test invoker functions
|
||||
*/
|
||||
extern OSystem *g_system;
|
||||
|
||||
/**
|
||||
* This represents a feature to be tested
|
||||
*/
|
||||
|
||||
struct Test {
|
||||
Test(Common::String name, invokingFunction f) : featureName(name),
|
||||
driver(f),
|
||||
enabled(true),
|
||||
passed(false) {}
|
||||
|
||||
Test(Common::String name, invokingFunction f) : featureName(name), driver(f), enabled(true), passed(false) {}
|
||||
Common::String featureName; ///< Name of feature to be tested
|
||||
invokingFunction driver; ///< Pointer to the function that will invoke this feature test
|
||||
bool enabled; ///< Decides whether or not this test is to be executed
|
||||
@ -39,12 +30,11 @@ struct Test {
|
||||
class Testsuite {
|
||||
public:
|
||||
Testsuite() {
|
||||
extern OSystem *g_system;
|
||||
_backend = g_system;
|
||||
_numTestsPassed = 0;
|
||||
_numTestsExecuted = 0;
|
||||
}
|
||||
~Testsuite() {}
|
||||
virtual ~Testsuite() {}
|
||||
inline int getNumTests() { return _testsToExecute.size(); }
|
||||
inline int getNumTestsPassed() { return _numTestsPassed; }
|
||||
inline int getNumTestsFailed() { return _numTestsExecuted - _numTestsPassed; }
|
||||
@ -56,7 +46,7 @@ public:
|
||||
* @param f pointer to the function that invokes this test
|
||||
*/
|
||||
inline void addTest(Common::String name, invokingFunction f) {
|
||||
Test featureTest(name, f);
|
||||
Test* featureTest = new Test(name, f);
|
||||
_testsToExecute.push_back(featureTest);
|
||||
}
|
||||
|
||||
@ -68,11 +58,13 @@ public:
|
||||
virtual const char *getName() = 0;
|
||||
|
||||
private:
|
||||
OSystem *_backend; ///< Pointer to OSystem backend
|
||||
OSystem *_backend; ///< Pointer to OSystem backend
|
||||
int _numTestsPassed; ///< Number of tests passed
|
||||
int _numTestsExecuted; ///< Number of tests executed
|
||||
Common::Array<Test> _testsToExecute; ///< List of tests to be executed
|
||||
}
|
||||
|
||||
protected:
|
||||
Common::Array<Test*> _testsToExecute; ///< List of tests to be executed
|
||||
};
|
||||
|
||||
} // End of namespace testbed
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user