Skip to content

Commit

Permalink
[test] get all tests working again
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Oct 31, 2024
1 parent e9dc5df commit 88a95eb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmake/build_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ endfunction()

function(configure_debug)
# TODO
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=1)
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=1 -DTOPAZ_SHIPPING=0)
endfunction()

function(configure_release)
# TODO
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0)
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0 -DTOPAZ_SHIPPING=1)
endfunction()

function(configure_profile)
# TODO
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0)
target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0 -DTOPAZ_SHIPPING=0)
endfunction()
6 changes: 6 additions & 0 deletions cmake/topaz.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ function(topaz_add_executable)
${ARGN}
)

if(${CMAKE_BUILD_TYPE} MATCHES "release")
add_executable(${TOPAZ_ADD_EXECUTABLE_TARGET} WIN32
${TOPAZ_ADD_EXECUTABLE_SOURCES}
)
else()
add_executable(${TOPAZ_ADD_EXECUTABLE_TARGET}
${TOPAZ_ADD_EXECUTABLE_SOURCES}
)
endif()
topaz_add_shader(
TARGET ${TOPAZ_ADD_EXECUTABLE_TARGET}
SHADERS
Expand Down
4 changes: 4 additions & 0 deletions include/tz/main.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef TZMAIN_HPP
#ifdef _WIN32
#if TOPAZ_SHIPPING
#define NOMINMAX
#include <Windows.h>
#define tz_main() WINAPI wWinMain([[maybe_unused]] HINSTANCE, [[maybe_unused]] HINSTANCE,[[maybe_unused]] LPWSTR, [[maybe_unused]] _In_ int)
#else
#define tz_main() main()
#endif
#endif
#endif // TZMAIN_HPP
3 changes: 2 additions & 1 deletion test/tz/gpu_resource_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ int tz_main()
tz::gpu::hardware gpu = tz::gpu::find_best_hardware();
tz_must(tz::gpu::use_hardware(gpu));

std::array<std::byte, 80u * 80u * 4> empty_imgdata;
tz::gpu::resource_handle img = tz_must(tz::gpu::create_image
({
.width = 80u,
.height = 80u,
.type = tz::gpu::image_type::rgba,
.data = {}
.data = empty_imgdata
}));

int data = 5;
Expand Down
6 changes: 3 additions & 3 deletions test/tz/vector_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ void test_constructor()
tz_assert(zero_vec == vec_t(arr0), "zero() failed. Expected: {{0.0f, ...}}");

// Test constructor with variadic arguments
vec_t variadic_vec(static_cast<T>(1.5f));
tz_assert((variadic_vec == vec_t{static_cast<T>(1.5f)}),
"variadic constructor failed. Expected: {{1.5f}}");
vec_t variadic_vec(static_cast<T>(1.5f), static_cast<T>(1.0f));
tz_assert((variadic_vec == vec_t{static_cast<T>(1.5f), static_cast<T>(1.0f)}),
"variadic constructor failed. Expected: {{1.5f, 1.0f}}");

// Test array constructor
std::array<T, N> arr;
Expand Down

0 comments on commit 88a95eb

Please sign in to comment.