tests: Update test suite for Catch2 3.0.1

This commit is contained in:
emufan4568
2022-07-15 16:37:32 +03:00
parent e7a6af73c1
commit a9436e01ca
12 changed files with 26 additions and 24 deletions

View File

@ -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)

View File

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/memory.h"

View File

@ -5,7 +5,7 @@
#include <array>
#include <cstring>
#include <type_traits>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/bit_field.h"
TEST_CASE("BitField", "[common]") {

View File

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include <cmath>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/param_package.h"
namespace Common {

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/arm/dyncom/arm_dyncom.h"
#include "core/core.h"
#include "core/core_timing.h"

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <array>
#include <bitset>

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/file_util.h"
#include "core/file_sys/path_parser.h"

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "common/archives.h"
#include "core/core.h"
#include "core/core_timing.h"

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/memory.h"

View File

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include <vector>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/memory.h"
#include "core/hle/kernel/vm_manager.h"

View File

@ -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 <catch2/catch.hpp>
#include <catch2/catch_session.hpp>
// 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);
}

View File

@ -5,7 +5,8 @@
#include <algorithm>
#include <cmath>
#include <memory>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <nihstro/inline_assembly.h>
#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)));
}