mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 16:20:14 +00:00
tests: Add tests for vadd
This commit is contained in:
parent
567c3a2ee7
commit
a08edd67eb
@ -301,9 +301,9 @@ get_git_head_revision(GIT_REF_SPEC GIT_REV)
|
|||||||
git_describe(GIT_DESC --always --long --dirty)
|
git_describe(GIT_DESC --always --long --dirty)
|
||||||
git_branch_name(GIT_BRANCH)
|
git_branch_name(GIT_BRANCH)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
add_subdirectory(externals)
|
add_subdirectory(externals)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
|
|
||||||
# Installation instructions
|
# Installation instructions
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
set(SRCS
|
set(SRCS
|
||||||
common/param_package.cpp
|
common/param_package.cpp
|
||||||
core/arm/arm_test_common.cpp
|
core/arm/arm_test_common.cpp
|
||||||
|
core/arm/dyncom/arm_dyncom_vfp_tests.cpp
|
||||||
core/file_sys/path_parser.cpp
|
core/file_sys/path_parser.cpp
|
||||||
core/hle/kernel/hle_ipc.cpp
|
core/hle/kernel/hle_ipc.cpp
|
||||||
glad.cpp
|
glad.cpp
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
namespace ArmTests {
|
namespace ArmTests {
|
||||||
|
|
||||||
TestEnvironment::TestEnvironment(bool mutable_memory_)
|
TestEnvironment::TestEnvironment(bool mutable_memory_)
|
||||||
: mutable_memory(mutable_memory_), test_memory(std::make_shared<TestMemory>(this)) {
|
: mutable_memory(mutable_memory_), test_memory(std::make_shared<TestMemory>(this)) {
|
||||||
Memory::MapIoRegion(0x00000000, 0x80000000, test_memory);
|
Memory::MapIoRegion(0x00000000, 0x80000000, test_memory);
|
||||||
Memory::MapIoRegion(0x80000000, 0x80000000, test_memory);
|
Memory::MapIoRegion(0x80000000, 0x80000000, test_memory);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ class TestEnvironment final {
|
|||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
* Inititalise test environment
|
* Inititalise test environment
|
||||||
* @param mutable_memory If false, writes to memory can never be read back. (Memory is immutable.)
|
* @param mutable_memory If false, writes to memory can never be read back.
|
||||||
|
* (Memory is immutable.)
|
||||||
*/
|
*/
|
||||||
explicit TestEnvironment(bool mutable_memory = false);
|
explicit TestEnvironment(bool mutable_memory = false);
|
||||||
|
|
||||||
|
50
src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp
Normal file
50
src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright 2016 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <catch.hpp>
|
||||||
|
|
||||||
|
#include "core/arm/dyncom/arm_dyncom.h"
|
||||||
|
#include "tests/core/arm/arm_test_common.h"
|
||||||
|
|
||||||
|
namespace ArmTests {
|
||||||
|
|
||||||
|
struct VfpTestCase {
|
||||||
|
u32 initial_fpscr;
|
||||||
|
u32 a;
|
||||||
|
u32 b;
|
||||||
|
u32 result;
|
||||||
|
u32 final_fpscr;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_CASE("ARM_DynCom (vfp): vadd", "[arm_dyncom]") {
|
||||||
|
TestEnvironment test_env(false);
|
||||||
|
test_env.SetMemory32(0, 0xEE321A03); // vadd.f32 s2, s4, s6
|
||||||
|
test_env.SetMemory32(4, 0xEAFFFFFE); // b +#0
|
||||||
|
|
||||||
|
ARM_DynCom dyncom(USER32MODE);
|
||||||
|
|
||||||
|
std::vector<VfpTestCase> test_cases{{
|
||||||
|
#include "vfp_vadd_f32.inc"
|
||||||
|
}};
|
||||||
|
|
||||||
|
for (const auto& test_case : test_cases) {
|
||||||
|
dyncom.down_count = 1000; // Ensure that CoreTimeing will not be called.
|
||||||
|
dyncom.SetPC(0);
|
||||||
|
dyncom.SetVFPSystemReg(VFP_FPSCR, test_case.initial_fpscr);
|
||||||
|
dyncom.SetVFPReg(4, test_case.a);
|
||||||
|
dyncom.SetVFPReg(6, test_case.b);
|
||||||
|
dyncom.ExecuteInstructions(1);
|
||||||
|
if (dyncom.GetVFPReg(2) != test_case.result ||
|
||||||
|
dyncom.GetVFPSystemReg(VFP_FPSCR) != test_case.final_fpscr) {
|
||||||
|
printf("f: %x\n", test_case.initial_fpscr);
|
||||||
|
printf("a: %x\n", test_case.a);
|
||||||
|
printf("b: %x\n", test_case.b);
|
||||||
|
printf("c: %x (%x)\n", dyncom.GetVFPReg(2), test_case.result);
|
||||||
|
printf("f: %x (%x)\n", dyncom.GetVFPSystemReg(VFP_FPSCR), test_case.final_fpscr);
|
||||||
|
FAIL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ArmTests
|
13456
src/tests/core/arm/dyncom/vfp_vadd_f32.inc
Normal file
13456
src/tests/core/arm/dyncom/vfp_vadd_f32.inc
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user