-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c57de7
commit 40c160e
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
project(centurion-test-unit CXX) | ||
|
||
add_executable(centurion-unit-tests) | ||
|
||
file(GLOB_RECURSE CEN_UNIT_TEST_SOURCE_FILES CONFIGURE_DEPENDS | ||
"${PROJECT_SOURCE_DIR}/**/*.cpp" | ||
) | ||
target_sources(centurion-unit-tests PRIVATE "${CEN_UNIT_TEST_SOURCE_FILES}") | ||
|
||
cen_prepare_target_options(centurion-unit-tests) | ||
|
||
target_link_libraries(centurion-unit-tests | ||
PRIVATE | ||
centurion::centurion | ||
GTest::gtest | ||
) | ||
|
||
cen_install_assets("${PROJECT_BINARY_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (C) 2019-2023 Albin Johansson (MIT License) | ||
|
||
#include <iomanip> | ||
#include <iostream> | ||
|
||
#include <SDL3/SDL.h> | ||
#include <gtest/gtest.h> | ||
|
||
#include "centurion/core/init.hpp" | ||
#include "centurion/core/version.hpp" | ||
|
||
auto main(int argc, char* argv[]) -> int | ||
{ | ||
std::cout << "Centurion version: " << cen::version::current() << '\n'; | ||
|
||
const auto sdl_flags = SDL_INIT_TIMER | SDL_INIT_EVENTS | SDL_INIT_VIDEO; | ||
const auto sdl [[maybe_unused]] = cen::sdl_library::init(sdl_flags).value(); | ||
|
||
std::cout << "SDL header version: " << cen::sdl_header_version() << '\n'; | ||
std::cout << "SDL linked version: " << cen::sdl_linked_version() << '\n'; | ||
std::cout << "SDL revision: " << std::quoted(SDL_GetRevision()) << '\n'; | ||
|
||
#ifndef CENTURION_NO_SDL_IMAGE | ||
const auto img_flags = IMG_INIT_PNG; | ||
const auto img [[maybe_unused]] = cen::img_library::init(img_flags).value(); | ||
|
||
std::cout << "SDL_image header version: " << cen::img_header_version() | ||
<< '\n'; | ||
std::cout << "SDL_image linked version: " << cen::img_linked_version() | ||
<< '\n'; | ||
#endif // CENTURION_NO_SDL_IMAGE | ||
|
||
#ifndef CENTURION_NO_SDL_MIXER | ||
const auto mix_flags = MIX_INIT_MP3; | ||
const auto mix [[maybe_unused]] = cen::mix_library::init(mix_flags).value(); | ||
|
||
std::cout << "SDL_mixer header version: " << cen::mix_header_version() | ||
<< '\n'; | ||
std::cout << "SDL_mixer linked version: " << cen::mix_linked_version() | ||
<< '\n'; | ||
#endif // CENTURION_NO_SDL_MIXER | ||
|
||
#ifndef CENTURION_NO_SDL_TTF | ||
const auto ttf [[maybe_unused]] = cen::ttf_library::init().value(); | ||
|
||
std::cout << "SDL_ttf header version: " << cen::ttf_header_version() << '\n'; | ||
std::cout << "SDL_ttf linked version: " << cen::ttf_linked_version() << '\n'; | ||
#endif // CENTURION_NO_SDL_TTF | ||
|
||
testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |