Uhhh changes idek anymore mayn
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.26.0)
|
||||
project(gtest_Graphics VERSION 0.1.0 LANGUAGES C CXX)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtest
|
||||
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
|
||||
)
|
||||
if (WIN32)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(gtest)
|
||||
endif()
|
||||
include(GoogleTest)
|
||||
set(GTEST_COLOR ON)
|
||||
|
||||
add_subdirectory(./ErrorTest)
|
||||
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.26.0)
|
||||
project(gtest_Graphics VERSION 0.1.0 LANGUAGES C CXX)
|
||||
|
||||
add_executable(ErrorTest main.cpp)
|
||||
target_link_libraries(ErrorTest NBCore)
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "Errors.hpp"
|
||||
#include <iostream>
|
||||
|
||||
using namespace nb;
|
||||
|
||||
class TestError : public nb::Error {
|
||||
public:
|
||||
TestError(unsigned int code, nb::Error* const trace=nullptr) : _type("nb::TestError"), Error(code, ErrorCodeLookup<TestError>(code), trace) {}
|
||||
|
||||
friend const char* ErrorCodeLookup<TestError>(unsigned int);
|
||||
|
||||
protected:
|
||||
static const nb::ErrorCodeMap ErrorCodes;
|
||||
const char* _type;
|
||||
};
|
||||
|
||||
const ErrorCodeMap TestError::ErrorCodes{
|
||||
{0, "Hey!"},
|
||||
{1, "How"},
|
||||
{2, "You"},
|
||||
{3, "Doin"}
|
||||
};
|
||||
|
||||
int main() {
|
||||
TestError a(0);
|
||||
TestError b(1, &a);
|
||||
TestError c(2, &b);
|
||||
throw TestError(3, &c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user