diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index b7d27e508..b0fffbf62 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -24,6 +24,6 @@ endif() create_target_directory_groups(tests) target_link_libraries(tests PRIVATE common core video_core audio_core) -target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 nihstro-headers Threads::Threads) +target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 Catch2::Catch2WithMain nihstro-headers Threads::Threads) add_test(NAME tests COMMAND tests) diff --git a/src/tests/audio_core/decoder_tests.cpp b/src/tests/audio_core/decoder_tests.cpp index 0e45b5b7d..a01c4a870 100644 --- a/src/tests/audio_core/decoder_tests.cpp +++ b/src/tests/audio_core/decoder_tests.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #if defined(HAVE_MF) || defined(HAVE_FFMPEG) -#include +#include #include "core/core.h" #include "core/core_timing.h" #include "core/hle/kernel/memory.h" diff --git a/src/tests/common/bit_field.cpp b/src/tests/common/bit_field.cpp index 182638000..7c8d66bcd 100644 --- a/src/tests/common/bit_field.cpp +++ b/src/tests/common/bit_field.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "common/bit_field.h" TEST_CASE("BitField", "[common]") { diff --git a/src/tests/common/param_package.cpp b/src/tests/common/param_package.cpp index 26ac40a9b..75442cea4 100644 --- a/src/tests/common/param_package.cpp +++ b/src/tests/common/param_package.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include -#include +#include #include "common/param_package.h" namespace Common { diff --git a/src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp b/src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp index f0152eb7d..8b045021e 100644 --- a/src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp +++ b/src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include #include "core/arm/dyncom/arm_dyncom.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp index b3247aed8..e82ffc8a3 100644 --- a/src/tests/core/core_timing.cpp +++ b/src/tests/core/core_timing.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include +#include #include #include diff --git a/src/tests/core/file_sys/path_parser.cpp b/src/tests/core/file_sys/path_parser.cpp index da9380da6..6401fff91 100644 --- a/src/tests/core/file_sys/path_parser.cpp +++ b/src/tests/core/file_sys/path_parser.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include #include "common/file_util.h" #include "core/file_sys/path_parser.h" diff --git a/src/tests/core/hle/kernel/hle_ipc.cpp b/src/tests/core/hle/kernel/hle_ipc.cpp index 890343cd8..f3193b7ba 100644 --- a/src/tests/core/hle/kernel/hle_ipc.cpp +++ b/src/tests/core/hle/kernel/hle_ipc.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include #include "common/archives.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/tests/core/memory/memory.cpp b/src/tests/core/memory/memory.cpp index ebd4e1c2f..22fb69219 100644 --- a/src/tests/core/memory/memory.cpp +++ b/src/tests/core/memory/memory.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include #include "core/core.h" #include "core/core_timing.h" #include "core/hle/kernel/memory.h" diff --git a/src/tests/core/memory/vm_manager.cpp b/src/tests/core/memory/vm_manager.cpp index 5a8e8b788..ff8ef1156 100644 --- a/src/tests/core/memory/vm_manager.cpp +++ b/src/tests/core/memory/vm_manager.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include -#include +#include #include "core/hle/kernel/errors.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/vm_manager.h" diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index 275b430d9..fb92b7c58 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -1,9 +1,10 @@ -// Copyright 2016 Citra Emulator Project +// Copyright 2022 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#define CATCH_CONFIG_MAIN -#include +#include -// Catch provides the main function since we've given it the -// CATCH_CONFIG_MAIN preprocessor directive. +// Standard C/C++ main entry point +int main(int argc, char* argv[]) { + return Catch::Session().run(argc, argv); +} \ No newline at end of file diff --git a/src/tests/video_core/shader/shader_jit_x64_compiler.cpp b/src/tests/video_core/shader/shader_jit_x64_compiler.cpp index d4576acac..514b8405d 100644 --- a/src/tests/video_core/shader/shader_jit_x64_compiler.cpp +++ b/src/tests/video_core/shader/shader_jit_x64_compiler.cpp @@ -5,7 +5,8 @@ #include #include #include -#include +#include +#include #include #include "video_core/shader/shader_jit_x64_compiler.h" @@ -65,9 +66,9 @@ TEST_CASE("LG2", "[video_core][shader][shader_jit]") { REQUIRE(std::isnan(shader.Run(NAN))); REQUIRE(std::isnan(shader.Run(-1.f))); REQUIRE(std::isinf(shader.Run(0.f))); - REQUIRE(shader.Run(4.f) == Approx(2.f)); - REQUIRE(shader.Run(64.f) == Approx(6.f)); - REQUIRE(shader.Run(1.e24f) == Approx(79.7262742773f)); + REQUIRE(shader.Run(4.f) == Catch2::Approx(2.f)); + REQUIRE(shader.Run(64.f) == Catch2::Approx(6.f)); + REQUIRE(shader.Run(1.e24f) == Catch2::Approx(79.7262742773f)); } TEST_CASE("EX2", "[video_core][shader][shader_jit]") { @@ -82,10 +83,10 @@ TEST_CASE("EX2", "[video_core][shader][shader_jit]") { }); REQUIRE(std::isnan(shader.Run(NAN))); - REQUIRE(shader.Run(-800.f) == Approx(0.f)); - REQUIRE(shader.Run(0.f) == Approx(1.f)); - REQUIRE(shader.Run(2.f) == Approx(4.f)); - REQUIRE(shader.Run(6.f) == Approx(64.f)); - REQUIRE(shader.Run(79.7262742773f) == Approx(1.e24f)); + REQUIRE(shader.Run(-800.f) == Catch2::Approx(0.f)); + REQUIRE(shader.Run(0.f) == Catch2::Approx(1.f)); + REQUIRE(shader.Run(2.f) == Catch2::Approx(4.f)); + REQUIRE(shader.Run(6.f) == Catch2::Approx(64.f)); + REQUIRE(shader.Run(79.7262742773f) == Catch2::Approx(1.e24f)); REQUIRE(std::isinf(shader.Run(800.f))); }