Add Buffer::MapReadAsync validation tests.

This also expands the Buffer validation tests to cover more creation
code paths and SetSubData. It also introduces a mechanism for
ValidationTests to check for device errors.
This commit is contained in:
Corentin Wallez
2017-06-12 13:11:54 -04:00
committed by Corentin Wallez
parent 43bfaae340
commit 68358b5c23
4 changed files with 306 additions and 18 deletions

View File

@@ -19,6 +19,11 @@
#include "nxt/nxtcpp.h"
#include "nxt/nxtcpp_traits.h"
#define ASSERT_DEVICE_ERROR(statement) \
StartExpectDeviceError(); \
statement; \
ASSERT_TRUE(EndExpectDeviceError());
class ValidationTest : public testing::Test {
public:
ValidationTest();
@@ -38,12 +43,19 @@ class ValidationTest : public testing::Test {
template<typename Builder>
Builder AssertWillBeError(Builder builder, std::string debugName = "");
void StartExpectDeviceError();
bool EndExpectDeviceError();
void TearDown() override;
protected:
nxt::Device device;
private:
static void OnDeviceError(const char* message, nxtCallbackUserdata userdata);
bool expectError = false;
bool error = false;
struct BuilderStatusExpectations {
bool expectSuccess;
std::string debugName;