diff options
author | fearlessTobi <thm.frey@gmail.com> | 2018-09-15 15:21:06 +0200 |
---|---|---|
committer | fearlessTobi <thm.frey@gmail.com> | 2018-09-15 15:21:06 +0200 |
commit | 63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch) | |
tree | 8a90e8ef2804f147dff7225a543a8740ecf7160c /src/tests | |
parent | Merge pull request #1310 from lioncash/kernel-ns (diff) | |
download | yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.bz2 yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.lz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.zst yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip |
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/common/ring_buffer.cpp | 20 | ||||
-rw-r--r-- | src/tests/core/arm/arm_test_common.cpp | 9 | ||||
-rw-r--r-- | src/tests/core/arm/arm_test_common.h | 8 |
3 files changed, 19 insertions, 18 deletions
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp index f3fe57839..c883c4d56 100644 --- a/src/tests/common/ring_buffer.cpp +++ b/src/tests/common/ring_buffer.cpp @@ -17,9 +17,9 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { RingBuffer<char, 4, 1> buf; // Pushing values into a ring buffer with space should succeed. - for (size_t i = 0; i < 4; i++) { + for (std::size_t i = 0; i < 4; i++) { const char elem = static_cast<char>(i); - const size_t count = buf.Push(&elem, 1); + const std::size_t count = buf.Push(&elem, 1); REQUIRE(count == 1); } @@ -28,7 +28,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { // Pushing values into a full ring buffer should fail. { const char elem = static_cast<char>(42); - const size_t count = buf.Push(&elem, 1); + const std::size_t count = buf.Push(&elem, 1); REQUIRE(count == 0); } @@ -57,7 +57,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { { std::vector<char> to_push(6); std::iota(to_push.begin(), to_push.end(), 88); - const size_t count = buf.Push(to_push); + const std::size_t count = buf.Push(to_push); REQUIRE(count == 3); } @@ -79,9 +79,9 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { TEST_CASE("RingBuffer: Threaded Test", "[common]") { RingBuffer<char, 4, 2> buf; const char seed = 42; - const size_t count = 1000000; - size_t full = 0; - size_t empty = 0; + const std::size_t count = 1000000; + std::size_t full = 0; + std::size_t empty = 0; const auto next_value = [](std::array<char, 2>& value) { value[0] += 1; @@ -90,9 +90,9 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") { std::thread producer{[&] { std::array<char, 2> value = {seed, seed}; - size_t i = 0; + std::size_t i = 0; while (i < count) { - if (const size_t c = buf.Push(&value[0], 1); c > 0) { + if (const std::size_t c = buf.Push(&value[0], 1); c > 0) { REQUIRE(c == 1); i++; next_value(value); @@ -105,7 +105,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") { std::thread consumer{[&] { std::array<char, 2> value = {seed, seed}; - size_t i = 0; + std::size_t i = 0; while (i < count) { if (const std::vector<char> v = buf.Pop(1); v.size() > 0) { REQUIRE(v.size() == 2); diff --git a/src/tests/core/arm/arm_test_common.cpp b/src/tests/core/arm/arm_test_common.cpp index 038d57b3a..7c69fc26e 100644 --- a/src/tests/core/arm/arm_test_common.cpp +++ b/src/tests/core/arm/arm_test_common.cpp @@ -87,11 +87,11 @@ boost::optional<u64> TestEnvironment::TestMemory::Read64(VAddr addr) { return *Read32(addr) | static_cast<u64>(*Read32(addr + 4)) << 32; } -bool TestEnvironment::TestMemory::ReadBlock(VAddr src_addr, void* dest_buffer, size_t size) { +bool TestEnvironment::TestMemory::ReadBlock(VAddr src_addr, void* dest_buffer, std::size_t size) { VAddr addr = src_addr; u8* data = static_cast<u8*>(dest_buffer); - for (size_t i = 0; i < size; i++, addr++, data++) { + for (std::size_t i = 0; i < size; i++, addr++, data++) { *data = *Read8(addr); } @@ -126,11 +126,12 @@ bool TestEnvironment::TestMemory::Write64(VAddr addr, u64 data) { return true; } -bool TestEnvironment::TestMemory::WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size) { +bool TestEnvironment::TestMemory::WriteBlock(VAddr dest_addr, const void* src_buffer, + std::size_t size) { VAddr addr = dest_addr; const u8* data = static_cast<const u8*>(src_buffer); - for (size_t i = 0; i < size; i++, addr++, data++) { + for (std::size_t i = 0; i < size; i++, addr++, data++) { env->write_records.emplace_back(8, addr, *data); if (env->mutable_memory) env->SetMemory8(addr, *data); diff --git a/src/tests/core/arm/arm_test_common.h b/src/tests/core/arm/arm_test_common.h index e4b6df194..5de8dab4e 100644 --- a/src/tests/core/arm/arm_test_common.h +++ b/src/tests/core/arm/arm_test_common.h @@ -19,8 +19,8 @@ struct PageTable; namespace ArmTests { struct WriteRecord { - WriteRecord(size_t size, VAddr addr, u64 data) : size(size), addr(addr), data(data) {} - size_t size; + WriteRecord(std::size_t size, VAddr addr, u64 data) : size(size), addr(addr), data(data) {} + std::size_t size; VAddr addr; u64 data; bool operator==(const WriteRecord& o) const { @@ -71,14 +71,14 @@ private: boost::optional<u32> Read32(VAddr addr) override; boost::optional<u64> Read64(VAddr addr) override; - bool ReadBlock(VAddr src_addr, void* dest_buffer, size_t size) override; + bool ReadBlock(VAddr src_addr, void* dest_buffer, std::size_t size) override; bool Write8(VAddr addr, u8 data) override; bool Write16(VAddr addr, u16 data) override; bool Write32(VAddr addr, u32 data) override; bool Write64(VAddr addr, u64 data) override; - bool WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size) override; + bool WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size) override; std::unordered_map<VAddr, u8> data; }; |