Extract expected report validation. I'm very much not proud of the

hack of using a macro for this, but I'm happy to simplify test scripts

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/966/head
Jesse Vincent 4 years ago
parent eebf8e639b
commit 072892111e
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -123,3 +123,19 @@ class VirtualDeviceTest : public ::testing::Test {
} // namespace testing
} // namespace kaleidoscope
// XXX This is a horrible hack and this should be a function, but I (Jesse)
// can't quite figure out the right way to get ASSERT_EQ and ElementsAreArray
// into a method in VirtualDeviceTest
#define CHECK_EXPECTED_REPORTS() \
LoadState(); \
ASSERT_EQ(HIDReports()->Keyboard().size(), expected_reports_.size()); \
\
for (auto i = 0; i < expected_reports_.size(); ++i) { \
EXPECT_THAT(HIDReports()->Keyboard(i).ActiveKeycodes(), \
::testing::ElementsAreArray(expected_reports_[i].Keycodes())) \
<< expected_reports_[i].Message(); \
} \

Loading…
Cancel
Save