Files
jtest/include/jtest/UnitLogger.hpp

35 lines
1.1 KiB
C++

/// Josh's Test Library
/// A no-frills, straightforward unit testing module in and for Modern C++.
/// Created by Joshua O'Leary @ Redacted Software, June 2024
/// Maintained by Maxine Hayes @ Redacted Software.
/// This work is dedicated to the public domain.
/// Contact: josh@redacted.cc, maxi@redacted.cc
/// @file UnitLogger.hpp
/// @desc
/// @edit 2024-08-21
#pragma once
#include <jlog/Logger.hpp>
#include <jtest/Test.hpp>
namespace jtest
{
class UnitLogger : protected jlog::ConsoleLogger {
protected:
UnitLogger(const std::string& name);
protected:
void Log(const std::string message);
void LogTimestamp(jlog::Timestamp ts =jlog::Timestamp());
void LogLocation(std::source_location l);
void LogTestResult(Test& t, bool passed, int index, int total);
// TODO: I suggest float percentage_passed.
void LogUnitResult(int tests_total, int tests_ran, int tests_passed, int tests_failed);
protected:
Color4 failColor;
Color4 passColor;
Color4 healthGoodColor;
Color4 healthWarningColor;
Color4 healthCriticalColor;
};
}