diff options
| author | 2020-02-10 14:45:08 -0400 | |
|---|---|---|
| committer | 2020-06-18 16:29:21 -0400 | |
| commit | 1f7dd36499786d373b143a4437d4c32e077a32aa (patch) | |
| tree | 26d21b113d85c6630f3ff67f7affc7c1b6f508a5 /src/tests | |
| parent | Common: Make MinGW build use Windows Fibers instead of fcontext_t (diff) | |
| download | yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.gz yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.xz yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.zip | |
Common/Tests: Address Feedback
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/common/fibers.cpp | 20 | ||||
| -rw-r--r-- | src/tests/core/host_timing.cpp | 28 |
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: | |||
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | static void WorkControl1(void* control) { | 36 | static void WorkControl1(void* control) { |
| 37 | TestControl1* test_control = static_cast<TestControl1*>(control); | 37 | auto* test_control = static_cast<TestControl1*>(control); |
| 38 | test_control->DoWork(); | 38 | test_control->DoWork(); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| @@ -70,8 +70,8 @@ static void ThreadStart1(u32 id, TestControl1& test_control) { | |||
| 70 | TEST_CASE("Fibers::Setup", "[common]") { | 70 | TEST_CASE("Fibers::Setup", "[common]") { |
| 71 | constexpr u32 num_threads = 7; | 71 | constexpr u32 num_threads = 7; |
| 72 | TestControl1 test_control{}; | 72 | TestControl1 test_control{}; |
| 73 | test_control.thread_fibers.resize(num_threads, nullptr); | 73 | test_control.thread_fibers.resize(num_threads); |
| 74 | test_control.work_fibers.resize(num_threads, nullptr); | 74 | test_control.work_fibers.resize(num_threads); |
| 75 | test_control.items.resize(num_threads, 0); | 75 | test_control.items.resize(num_threads, 0); |
| 76 | test_control.results.resize(num_threads, 0); | 76 | test_control.results.resize(num_threads, 0); |
| 77 | std::vector<std::thread> threads; | 77 | std::vector<std::thread> threads; |
| @@ -153,17 +153,17 @@ public: | |||
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | static void WorkControl2_1(void* control) { | 155 | static void WorkControl2_1(void* control) { |
| 156 | TestControl2* test_control = static_cast<TestControl2*>(control); | 156 | auto* test_control = static_cast<TestControl2*>(control); |
| 157 | test_control->DoWork1(); | 157 | test_control->DoWork1(); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | static void WorkControl2_2(void* control) { | 160 | static void WorkControl2_2(void* control) { |
| 161 | TestControl2* test_control = static_cast<TestControl2*>(control); | 161 | auto* test_control = static_cast<TestControl2*>(control); |
| 162 | test_control->DoWork2(); | 162 | test_control->DoWork2(); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static void WorkControl2_3(void* control) { | 165 | static void WorkControl2_3(void* control) { |
| 166 | TestControl2* test_control = static_cast<TestControl2*>(control); | 166 | auto* test_control = static_cast<TestControl2*>(control); |
| 167 | test_control->DoWork3(); | 167 | test_control->DoWork3(); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| @@ -198,7 +198,7 @@ static void ThreadStart2_2(u32 id, TestControl2& test_control) { | |||
| 198 | */ | 198 | */ |
| 199 | TEST_CASE("Fibers::InterExchange", "[common]") { | 199 | TEST_CASE("Fibers::InterExchange", "[common]") { |
| 200 | TestControl2 test_control{}; | 200 | TestControl2 test_control{}; |
| 201 | test_control.thread_fibers.resize(2, nullptr); | 201 | test_control.thread_fibers.resize(2); |
| 202 | test_control.fiber1 = | 202 | test_control.fiber1 = |
| 203 | std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_1}, &test_control); | 203 | std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_1}, &test_control); |
| 204 | test_control.fiber2 = | 204 | test_control.fiber2 = |
| @@ -261,12 +261,12 @@ public: | |||
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| 263 | static void WorkControl3_1(void* control) { | 263 | static void WorkControl3_1(void* control) { |
| 264 | TestControl3* test_control = static_cast<TestControl3*>(control); | 264 | auto* test_control = static_cast<TestControl3*>(control); |
| 265 | test_control->DoWork1(); | 265 | test_control->DoWork1(); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static void WorkControl3_2(void* control) { | 268 | static void WorkControl3_2(void* control) { |
| 269 | TestControl3* test_control = static_cast<TestControl3*>(control); | 269 | auto* test_control = static_cast<TestControl3*>(control); |
| 270 | test_control->DoWork2(); | 270 | test_control->DoWork2(); |
| 271 | } | 271 | } |
| 272 | 272 | ||
| @@ -295,7 +295,7 @@ static void ThreadStart3(u32 id, TestControl3& test_control) { | |||
| 295 | */ | 295 | */ |
| 296 | TEST_CASE("Fibers::StartRace", "[common]") { | 296 | TEST_CASE("Fibers::StartRace", "[common]") { |
| 297 | TestControl3 test_control{}; | 297 | TestControl3 test_control{}; |
| 298 | test_control.thread_fibers.resize(2, nullptr); | 298 | test_control.thread_fibers.resize(2); |
| 299 | test_control.fiber1 = | 299 | test_control.fiber1 = |
| 300 | std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_1}, &test_control); | 300 | std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_1}, &test_control); |
| 301 | test_control.fiber2 = | 301 | 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 { | |||
| 50 | TEST_CASE("HostTiming[BasicOrder]", "[core]") { | 50 | TEST_CASE("HostTiming[BasicOrder]", "[core]") { |
| 51 | ScopeInit guard; | 51 | ScopeInit guard; |
| 52 | auto& core_timing = guard.core_timing; | 52 | auto& core_timing = guard.core_timing; |
| 53 | std::vector<std::shared_ptr<Core::HostTiming::EventType>> events; | 53 | std::vector<std::shared_ptr<Core::HostTiming::EventType>> events{ |
| 54 | events.resize(5); | 54 | Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>), |
| 55 | events[0] = Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>); | 55 | Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>), |
| 56 | events[1] = Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>); | 56 | Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>), |
| 57 | events[2] = Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>); | 57 | Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>), |
| 58 | events[3] = Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>); | 58 | Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>), |
| 59 | events[4] = Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>); | 59 | }; |
| 60 | 60 | ||
| 61 | expected_callback = 0; | 61 | expected_callback = 0; |
| 62 | 62 | ||
| @@ -100,13 +100,13 @@ u64 TestTimerSpeed(Core::HostTiming::CoreTiming& core_timing) { | |||
| 100 | TEST_CASE("HostTiming[BasicOrderNoPausing]", "[core]") { | 100 | TEST_CASE("HostTiming[BasicOrderNoPausing]", "[core]") { |
| 101 | ScopeInit guard; | 101 | ScopeInit guard; |
| 102 | auto& core_timing = guard.core_timing; | 102 | auto& core_timing = guard.core_timing; |
| 103 | std::vector<std::shared_ptr<Core::HostTiming::EventType>> events; | 103 | std::vector<std::shared_ptr<Core::HostTiming::EventType>> events{ |
| 104 | events.resize(5); | 104 | Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>), |
| 105 | events[0] = Core::HostTiming::CreateEvent("callbackA", HostCallbackTemplate<0>); | 105 | Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>), |
| 106 | events[1] = Core::HostTiming::CreateEvent("callbackB", HostCallbackTemplate<1>); | 106 | Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>), |
| 107 | events[2] = Core::HostTiming::CreateEvent("callbackC", HostCallbackTemplate<2>); | 107 | Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>), |
| 108 | events[3] = Core::HostTiming::CreateEvent("callbackD", HostCallbackTemplate<3>); | 108 | Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>), |
| 109 | events[4] = Core::HostTiming::CreateEvent("callbackE", HostCallbackTemplate<4>); | 109 | }; |
| 110 | 110 | ||
| 111 | core_timing.SyncPause(true); | 111 | core_timing.SyncPause(true); |
| 112 | core_timing.SyncPause(false); | 112 | core_timing.SyncPause(false); |