feat: first working set
This commit is contained in:
parent
cccebf674a
commit
bed7360063
5 changed files with 59 additions and 42 deletions
|
@ -18,8 +18,8 @@ include(../cmake/tools.cmake)
|
|||
|
||||
include(../cmake/get_cpm.cmake)
|
||||
|
||||
# CPMAddPackage("gh:doctest/doctest@2.4.9")
|
||||
CPMAddPackage("gh:TheLartians/Format.cmake@1.7.3")
|
||||
CPMAddPackage(NAME Catch2 GITHUB_REPOSITORY catchorg/Catch2 VERSION 3.8.1)
|
||||
CPMAddPackage("gh:TheLartians/Format.cmake@1.8.3")
|
||||
|
||||
if(TEST_INSTALLED_VERSION)
|
||||
find_package(Glimpses REQUIRED)
|
||||
|
@ -31,11 +31,7 @@ endif()
|
|||
|
||||
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
# doctest::doctest
|
||||
Glimpses::Glimpses
|
||||
)
|
||||
target_link_libraries(${PROJECT_NAME} Catch2::Catch2WithMain Glimpses::Glimpses)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
||||
|
||||
# enable compiler warnings
|
||||
|
@ -52,6 +48,9 @@ endif()
|
|||
|
||||
enable_testing()
|
||||
|
||||
include(CTest)
|
||||
add_test(GlimpsesTests GlimpsesTests)
|
||||
|
||||
# Note: doctest and similar testing frameworks can automatically configure CMake tests. For other testing frameworks add the tests target
|
||||
# instead: add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||
|
||||
|
|
|
@ -2,24 +2,21 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <glimpses/glimpses.hpp>
|
||||
#include <glimpses/version.h>
|
||||
|
||||
#include <string>
|
||||
/*
|
||||
TEST_CASE("Glimpses") {
|
||||
using namespace greeter;
|
||||
|
||||
Glimpses greeter("Tests");
|
||||
TEST_CASE("CPU count")
|
||||
{
|
||||
|
||||
CHECK(greeter.greet(LanguageCode::EN) == "Hello, Tests!");
|
||||
CHECK(greeter.greet(LanguageCode::DE) == "Hallo Tests!");
|
||||
CHECK(greeter.greet(LanguageCode::ES) == "¡Hola Tests!");
|
||||
CHECK(greeter.greet(LanguageCode::FR) == "Bonjour Tests!");
|
||||
glimpses::Glimpses glimpses{};
|
||||
|
||||
CHECK(glimpses.getCPUCount().size() > 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Glimpses version") {
|
||||
static_assert(std::string_view(GREETER_VERSION) == std::string_view("1.0"));
|
||||
/*
|
||||
TEST_CASE("Glimpses version") { static_assert(std::string_view(GREETER_VERSION) == std::string_view("0.1.0"));
|
||||
CHECK(std::string(GREETER_VERSION) == std::string("1.0"));
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 Tobias Schmidl
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#if 0
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue