summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-10 19:45:08 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-18 22:29:21 +0200
commit1f7dd36499786d373b143a4437d4c32e077a32aa (patch)
tree26d21b113d85c6630f3ff67f7affc7c1b6f508a5 /src/tests
parentCommon: Make MinGW build use Windows Fibers instead of fcontext_t (diff)
downloadyuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.gz
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.bz2
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.lz
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.xz
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.zst
yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.zip
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/common/fibers.cpp20
-rw-r--r--src/tests/core/host_timing.cpp28
2 files changed, 24 insertions, 24 deletions
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp
index d63194dd4..0d3d5153d 100644
--- a/src/tests/common/fibers.cpp
+++ b/src/tests/common/fibers.cpp
@@ -34,7 +34,7 @@ public:
};
static void WorkControl1(void* control) {
- TestControl1* test_control = static_cast<TestControl1*>(control);
+ auto* test_control = static_cast<TestControl1*>(control);
test_control->DoWork();
}
@@ -70,8 +70,8 @@ static void ThreadStart1(u32 id, TestControl1& test_control) {
TEST_CASE("Fibers::Setup", "[common]") {
constexpr u32 num_threads = 7;
TestControl1 test_control{};
- test_control.thread_fibers.resize(num_threads, nullptr);
- test_control.work_fibers.resize(num_threads, nullptr);
+ test_control.thread_fibers.resize(num_threads);
+ test_control.work_fibers.resize(num_threads);
test_control.items.resize(num_threads, 0);
test_control.results.resize(num_threads, 0);
std::vector<std::thread> threads;
@@ -153,17 +153,17 @@ public:
};
static void WorkControl2_1(void* control) {
- TestControl2* test_control = static_cast<TestControl2*>(control);
+ auto* test_control = static_cast<TestControl2*>(control);
test_control->DoWork1();
}
static void WorkControl2_2(void* control) {
- TestControl2* test_control = static_cast<TestControl2*>(control);
+ auto* test_control = static_cast<TestControl2*>(control);
test_control->DoWork2();
}
static void WorkControl2_3(void* control) {
- TestControl2* test_control = static_cast<TestControl2*>(control);
+ auto* test_control = static_cast<TestControl2*>(control);
test_control->DoWork3();
}
@@ -198,7 +198,7 @@ static void ThreadStart2_2(u32 id, TestControl2& test_control) {
*/
TEST_CASE("Fibers::InterExchange", "[common]") {
TestControl2 test_control{};
- test_control.thread_fibers.resize(2, nullptr);
+ test_control.thread_fibers.resize(2);
test_control.fiber1 =
std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_1}, &test_control);
test_control.fiber2 =
@@ -261,12 +261,12 @@ public:
};
static void WorkControl3_1(void* control) {
- TestControl3* test_control = static_cast<TestControl3*>(control);
+ auto* test_control = static_cast<TestControl3*>(control);
test_control->DoWork1();
}
static void WorkControl3_2(void* control) {
- TestControl3* test_control = static_cast<TestControl3*>(control);
+ auto* test_control = static_cast<TestControl3*>(control);
test_control->DoWork2();
}
@@ -295,7 +295,7 @@ static void ThreadStart3(u32 id, TestControl3& test_control) {
*/
TEST_CASE("Fibers::StartRace", "[common]") {
TestControl3 test_control{};
- test_control.thread_fibers.resize(2, nullptr);
+ test_control.thread_fibers.resize(2);
test_control.fiber1 =
std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_1}, &test_control);
test_control.fiber2 =
diff --git a/src/tests/core/host_timing.cpp b/src/tests/core/host_timing.cpp
index 3d0532d02..ed060be55 100644
--- a/src/tests/core/host_timing.cpp
+++ b/src/tests/core/host_timing.cpp
@@ -50,13 +50,13 @@ struct ScopeInit final {
TEST_CASE("HostTiming[BasicOrder]", "[core]") {
ScopeInit guard;
auto& core_timing = guard.core_timing;
- std::vector<std::shared_ptr<Core::HostTiming::EventType>> events;
- events.resize(5);
- events[0] = Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>);
- events[1] = Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>);
- events[2] = Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>);
- events[3] = Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>);
- events[4] = Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>);
+ std::vector<std::shared_ptr<Core::HostTiming::EventType>> events{
+ Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>),
+ Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>),
+ Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>),
+ Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>),
+ Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>),
+ };
expected_callback = 0;
@@ -100,13 +100,13 @@ u64 TestTimerSpeed(Core::HostTiming::CoreTiming& core_timing) {
TEST_CASE("HostTiming[BasicOrderNoPausing]", "[core]") {
ScopeInit guard;
auto& core_timing = guard.core_timing;
- std::vector<std::shared_ptr<Core::HostTiming::EventType>> events;
- events.resize(5);
- events[0] = Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>);
- events[1] = Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>);
- events[2] = Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>);
- events[3] = Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>);
- events[4] = Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>);
+ std::vector<std::shared_ptr<Core::HostTiming::EventType>> events{
+ Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>),
+ Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>),
+ Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>),
+ Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>),
+ Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>),
+ };
core_timing.SyncPause(true);
core_timing.SyncPause(false);