mirror of
https://github.com/thunderbrewhq/bc.git
synced 2025-12-12 01:52:30 +00:00
chore: initial commit
This commit is contained in:
commit
d5300e4723
19 changed files with 18365 additions and 0 deletions
31
test/CMakeLists.txt
Normal file
31
test/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
file(GLOB_RECURSE TEST_SOURCES "*.cpp")
|
||||
|
||||
if(WHOA_SYSTEM_MAC)
|
||||
set_source_files_properties(${TEST_SOURCES}
|
||||
PROPERTIES COMPILE_FLAGS "-x objective-c++"
|
||||
)
|
||||
|
||||
add_executable(BcTest ${TEST_SOURCES})
|
||||
|
||||
target_link_libraries(BcTest
|
||||
PRIVATE
|
||||
bc
|
||||
"-framework AppKit"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WHOA_SYSTEM_LINUX OR WHOA_SYSTEM_WIN)
|
||||
add_executable(BcTest ${TEST_SOURCES})
|
||||
|
||||
target_link_libraries(BcTest
|
||||
PRIVATE
|
||||
bc
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(BcTest
|
||||
PRIVATE
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS BcTest DESTINATION "bin")
|
||||
20
test/Memory.cpp
Normal file
20
test/Memory.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "bc/Memory.hpp"
|
||||
#include "test/Test.hpp"
|
||||
|
||||
TEST_CASE("Blizzard::Memory::Allocate", "[memory]") {
|
||||
SECTION("allocates memory and returns pointer") {
|
||||
auto ptr = Blizzard::Memory::Allocate(100);
|
||||
|
||||
REQUIRE(ptr);
|
||||
|
||||
Blizzard::Memory::Free(ptr);
|
||||
}
|
||||
|
||||
SECTION("allocates memory and returns pointer using overload with flags") {
|
||||
auto ptr = Blizzard::Memory::Allocate(100, 0x0, __FILE__, __LINE__, nullptr);
|
||||
|
||||
REQUIRE(ptr);
|
||||
|
||||
Blizzard::Memory::Free(ptr);
|
||||
}
|
||||
}
|
||||
2
test/Test.cpp
Normal file
2
test/Test.cpp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include "test/Test.hpp"
|
||||
1
test/Test.hpp
Normal file
1
test/Test.hpp
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include "vendor/catch-2.13.10/catch.hpp"
|
||||
Loading…
Add table
Add a link
Reference in a new issue