Member rename: src/tests

This commit is contained in:
Corentin Wallez
2017-11-23 11:51:16 -08:00
committed by Corentin Wallez
parent ad6470466c
commit d5d77af5b6
5 changed files with 80 additions and 80 deletions

View File

@@ -41,9 +41,9 @@ ValidationTest::~ValidationTest() {
}
void ValidationTest::TearDown() {
ASSERT_FALSE(expectError);
ASSERT_FALSE(mExpectError);
for (auto& expectation : expectations) {
for (auto& expectation : mExpectations) {
std::string name = expectation.debugName;
if (name.empty()) {
name = "<no debug name set>";
@@ -61,12 +61,12 @@ void ValidationTest::TearDown() {
}
void ValidationTest::StartExpectDeviceError() {
expectError = true;
error = false;
mExpectError = true;
mError = false;
}
bool ValidationTest::EndExpectDeviceError() {
expectError = false;
return error;
mExpectError = false;
return mError;
}
void ValidationTest::CreateSimpleRenderPassAndFramebuffer(const nxt::Device& device, nxt::RenderPass* renderpass, nxt::Framebuffer* framebuffer) {
@@ -104,18 +104,18 @@ void ValidationTest::OnDeviceError(const char* message, nxtCallbackUserdata user
}
auto self = reinterpret_cast<ValidationTest*>(static_cast<uintptr_t>(userdata));
ASSERT_TRUE(self->expectError) << "Got unexpected device error: " << message;
ASSERT_FALSE(self->error) << "Got two errors in expect block";
self->error = true;
ASSERT_TRUE(self->mExpectError) << "Got unexpected device error: " << message;
ASSERT_FALSE(self->mError) << "Got two errors in expect block";
self->mError = true;
}
void ValidationTest::OnBuilderErrorStatus(nxtBuilderErrorStatus status, const char* message, nxt::CallbackUserdata userdata1, nxt::CallbackUserdata userdata2) {
auto* self = reinterpret_cast<ValidationTest*>(static_cast<uintptr_t>(userdata1));
size_t index = static_cast<size_t>(userdata2);
ASSERT_LT(index, self->expectations.size());
ASSERT_LT(index, self->mExpectations.size());
auto& expectation = self->expectations[index];
auto& expectation = self->mExpectations[index];
ASSERT_FALSE(expectation.gotStatus);
expectation.gotStatus = true;
expectation.status = status;

View File

@@ -67,8 +67,8 @@ class ValidationTest : public testing::Test {
private:
static void OnDeviceError(const char* message, nxtCallbackUserdata userdata);
bool expectError = false;
bool error = false;
bool mExpectError = false;
bool mError = false;
struct BuilderStatusExpectations {
bool expectSuccess;
@@ -78,7 +78,7 @@ class ValidationTest : public testing::Test {
std::string statusMessage;
nxtBuilderErrorStatus status;
};
std::vector<BuilderStatusExpectations> expectations;
std::vector<BuilderStatusExpectations> mExpectations;
template<typename Builder>
Builder AddExpectation(Builder& builder, std::string debugName, bool expectSuccess);
@@ -101,11 +101,11 @@ Builder ValidationTest::AssertWillBeError(Builder builder, std::string debugName
template<typename Builder>
Builder ValidationTest::AddExpectation(Builder& builder, std::string debugName, bool expectSuccess) {
uint64_t userdata1 = reinterpret_cast<uintptr_t>(this);
uint64_t userdata2 = expectations.size();
uint64_t userdata2 = mExpectations.size();
builder.SetErrorCallback(OnBuilderErrorStatus, userdata1, userdata2);
expectations.emplace_back();
auto& expectation = expectations.back();
mExpectations.emplace_back();
auto& expectation = mExpectations.back();
expectation.expectSuccess = expectSuccess;
expectation.debugName = debugName;