Files
projectm/src/libprojectM/TestRunner.cpp
mbellew 42fee50d64 Perf cleanup (#151)
* 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
2019-01-14 05:33:38 +00:00

43 lines
1.2 KiB
C++

//
// Created by matthew on 1/7/19.
//
#include <iostream>
#include <MilkdropPresetFactory/Parser.hpp>
#include <TestRunner.hpp>
#include <MilkdropPresetFactory/Param.hpp>
std::vector<Test *> TestRunner::tests;
bool TestRunner::run()
{
if (tests.empty())
{
// We still call register/run tests in NDEBUG (useful for performance testing)
// but tests may choose to comment out body to save space
tests.push_back(Param::test());
tests.push_back(Parser::test());
tests.push_back(Expr::test());
}
int count = 0;
bool successful = true;
for (auto it=tests.begin() ; it < tests.end() ; it++ )
{
if (nullptr == (*it))
continue;
count++;
std::cout << "TestRunner: " << (*it)->getName() << " started" << std::endl;
std::cout.flush();
bool result = (*it)->test();
successful &= result;
if (result)
std::cout << "TestRunner: " << (*it)->getName() << " passed" << std::endl;
else
std::cout << "TestRunner: " << (*it)->getName() << " FAILED" << std::endl;
}
if (0 == count)
std::cout << "TestRunner: no tests found to run" << std::endl;
return successful;
}