123456789101112131415161718192021222324252627 |
- #include "Test.hpp"
- namespace Internal = Core::Test::Internal;
- Core::HashMap<Internal::FileName, Internal::Result> Internal::results;
- void Internal::warn(const char* file, int line, Error e) {
- Logger::log("#:# | #", Logger::getFileName(file), line, e);
- }
- bool Internal::checkFloat(const char* file, int line, float wanted,
- float actual, float error) {
- float diff = wanted - actual;
- diff = diff < 0.0f ? -diff : diff;
- return check(file, line, wanted, actual, diff <= error);
- }
- void Core::Test::finalize() {
- for(const auto& e : Internal::results) {
- const char* color = e.value.successTests == e.value.tests
- ? Logger::COLOR_GREEN
- : Logger::COLOR_RED;
- Logger::log(color, "# - # / # tests succeeded", e.getKey(),
- e.value.successTests, e.value.tests);
- }
- Internal::results.clear();
- }
|