Merge pull request #746 from lioncash/tests

tests/arm_test_common: Minor changes
This commit is contained in:
bunnei 2018-07-21 10:55:29 -07:00 committed by GitHub
commit 1c7c1347d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -10,8 +10,6 @@
namespace ArmTests {
static Memory::PageTable* page_table = nullptr;
TestEnvironment::TestEnvironment(bool mutable_memory_)
: mutable_memory(mutable_memory_), test_memory(std::make_shared<TestMemory>(this)) {
@ -67,10 +65,13 @@ boost::optional<bool> TestEnvironment::TestMemory::IsValidAddress(VAddr addr) {
}
boost::optional<u8> TestEnvironment::TestMemory::Read8(VAddr addr) {
auto iter = data.find(addr);
const auto iter = data.find(addr);
if (iter == data.end()) {
return addr; // Some arbitrary data
// Some arbitrary data
return static_cast<u8>(addr);
}
return iter->second;
}

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <tuple>
#include <unordered_map>
#include <vector>
@ -9,6 +11,10 @@
#include "common/common_types.h"
#include "core/memory_hook.h"
namespace Memory {
struct PageTable;
}
namespace ArmTests {
struct WriteRecord {
@ -79,6 +85,7 @@ private:
bool mutable_memory;
std::shared_ptr<TestMemory> test_memory;
std::vector<WriteRecord> write_records;
Memory::PageTable* page_table = nullptr;
};
} // namespace ArmTests