[Glacier] Add a basic unit testing framework.

This commit is contained in:
Drew Galbraith 2024-01-11 16:09:37 -08:00
parent 83b0d9ab61
commit 09d902dfb5
7 changed files with 43 additions and 0 deletions

View file

@ -29,3 +29,7 @@ target_include_directories(glacier_kernel
set_target_properties(glacier_kernel PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS} -mcmodel=kernel -mgeneral-regs-only")
if (enable_testing)
add_subdirectory(test)
endif()

View file

@ -0,0 +1,8 @@
find_package(Catch2 3 REQUIRED)
add_subdirectory(container)
add_custom_target(build_test)
add_dependencies(build_test
glc_vec_test)

View file

@ -0,0 +1,4 @@
add_executable(glc_vec_test vector.cpp)
target_link_libraries(glc_vec_test glacier Catch2::Catch2WithMain)
target_include_directories(glc_vec_test PRIVATE "../..")
add_test(NAME glc_vec_test COMMAND $<TARGET_FILE:glc_vec_test>)

View file

@ -0,0 +1,10 @@
#include "container/vector.h"
#include <catch2/catch_test_macros.hpp>
using namespace glcr;
TEST_CASE("Build Vector", "[vector]") {
Vector<uint64_t> v;
REQUIRE(v.size() == 0);
}