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

@@ -55,7 +55,7 @@ static void ToMockBufferMapReadCallback(nxtBufferMapReadStatus status, const voi
class WireTestsBase : public Test {
protected:
WireTestsBase(bool ignoreSetCallbackCalls)
: ignoreSetCallbackCalls(ignoreSetCallbackCalls) {
: mIgnoreSetCallbackCalls(ignoreSetCallbackCalls) {
}
void SetUp() override {
@@ -69,42 +69,42 @@ class WireTestsBase : public Test {
// This SetCallback call cannot be ignored because it is done as soon as we start the server
EXPECT_CALL(api, OnDeviceSetErrorCallback(_, _, _)).Times(Exactly(1));
if (ignoreSetCallbackCalls) {
if (mIgnoreSetCallbackCalls) {
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
}
EXPECT_CALL(api, DeviceTick(_)).Times(AnyNumber());
s2cBuf = new TerribleCommandBuffer();
c2sBuf = new TerribleCommandBuffer(wireServer);
mS2cBuf = new TerribleCommandBuffer();
mC2sBuf = new TerribleCommandBuffer(mWireServer);
wireServer = NewServerCommandHandler(mockDevice, mockProcs, s2cBuf);
c2sBuf->SetHandler(wireServer);
mWireServer = NewServerCommandHandler(mockDevice, mockProcs, mS2cBuf);
mC2sBuf->SetHandler(mWireServer);
nxtProcTable clientProcs;
wireClient = NewClientDevice(&clientProcs, &device, c2sBuf);
mWireClient = NewClientDevice(&clientProcs, &device, mC2sBuf);
nxtSetProcs(&clientProcs);
s2cBuf->SetHandler(wireClient);
mS2cBuf->SetHandler(mWireClient);
apiDevice = mockDevice;
}
void TearDown() override {
nxtSetProcs(nullptr);
delete wireServer;
delete wireClient;
delete c2sBuf;
delete s2cBuf;
delete mWireServer;
delete mWireClient;
delete mC2sBuf;
delete mS2cBuf;
delete mockDeviceErrorCallback;
delete mockBuilderErrorCallback;
delete mockBufferMapReadCallback;
}
void FlushClient() {
c2sBuf->Flush();
mC2sBuf->Flush();
}
void FlushServer() {
s2cBuf->Flush();
mS2cBuf->Flush();
}
MockProcTable api;
@@ -112,12 +112,12 @@ class WireTestsBase : public Test {
nxtDevice device;
private:
bool ignoreSetCallbackCalls = false;
bool mIgnoreSetCallbackCalls = false;
CommandHandler* wireServer = nullptr;
CommandHandler* wireClient = nullptr;
TerribleCommandBuffer* s2cBuf = nullptr;
TerribleCommandBuffer* c2sBuf = nullptr;
CommandHandler* mWireServer = nullptr;
CommandHandler* mWireClient = nullptr;
TerribleCommandBuffer* mS2cBuf = nullptr;
TerribleCommandBuffer* mC2sBuf = nullptr;
};
class WireTests : public WireTestsBase {

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;