NBEngine/engine/NBCore/tests/testErrors.cpp
2026-03-15 23:18:45 -05:00

39 lines
866 B
C++

#define CODE_ERROR_LOCATIONS
#include "Errors.hpp"
#include <gtest/gtest.h>
#include <iostream>
#include <sstream>
#include "Logger.hpp"
using namespace nb;
class TestError : public ErrorBase<TestError> {
public:
using ErrorBase<TestError>::ErrorBase;
enum ErrorCodes : unsigned int {
A, B, C, D
};
static const std::string type;
static const ErrorCodeMap ErrorMessages;
};
const std::string TestError::type="TestError";
const ErrorCodeMap TestError::ErrorMessages{
{TestError::ErrorCodes::A, "Hey!"},
{TestError::ErrorCodes::B, "How"},
{TestError::ErrorCodes::C, "You"},
{TestError::ErrorCodes::D, "Doin"}
};
TEST(ErrorTest, Test) {
EXPECT_EQ(1, 1);
std::stringstream sstream;
ASSERT_TRUE(nb::logger.isRunning());
nb::logger.log("Hey!");
std::cout << "STRINGSTREAM:\n" << sstream.str();
}