mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-23 08:35:38 +00:00
* Param refactor collected all the code that reached inside Param (InitCond, Per*Eqn, Expr, Parser) to read/write and stuffed it all back into Param.cpp made Param extend Expr to avoid any perf penalty (I actually think eval() is a tiny bit faster now) * presets/tests * ALWAYS_MATRIX is used with PER_POINT * use SSE2 to impove initialize_PerPixelMeshes() performance * TestRunner very, very simple test framework, but it's better than no framework (consider investigating adopting something) * ProgramExpr
49 lines
902 B
C++
49 lines
902 B
C++
//
|
|
// Created by matthew on 1/7/19.
|
|
//
|
|
// This is a place to collect/run non-graphical unit tests
|
|
// CONSIDER using some framework like googletest etc, but for now didn't want new dependencies
|
|
//
|
|
|
|
#ifndef PROJECTM_LUA_TESTRUNNER_H
|
|
#define PROJECTM_LUA_TESTRUNNER_H
|
|
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
class Test
|
|
{
|
|
public:
|
|
const std::string getName() { return name; };
|
|
#ifdef NDEBUG
|
|
virtual bool test() {return true;}
|
|
#else
|
|
virtual bool test() = 0;
|
|
#endif
|
|
virtual ~Test() = default;
|
|
protected:
|
|
explicit Test(std::string name_) : name(name_) {};
|
|
const std::string name;
|
|
|
|
bool verify(const char *test, bool success)
|
|
{
|
|
if (!success)
|
|
std::cout << "failed " << test << std::endl;
|
|
return success;
|
|
}
|
|
};
|
|
|
|
|
|
class TestRunner
|
|
{
|
|
public:
|
|
static bool run();
|
|
private:
|
|
static std::vector<Test *> tests;
|
|
};
|
|
|
|
|
|
#endif //PROJECTM_LUA_TESTRUNNER_H
|