From 55da46f6ef3bcc59f2c49cc17aa039a6f83e3f58 Mon Sep 17 00:00:00 2001 From: Justin Scofield Date: Thu, 28 Jul 2022 21:21:33 +0000 Subject: [PATCH] Found a matcher for the tests --- test/rom_test.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/rom_test.cc b/test/rom_test.cc index 7dbaeca0..51b712f2 100644 --- a/test/rom_test.cc +++ b/test/rom_test.cc @@ -1,7 +1,10 @@ #include "app/rom.h" +#include #include +#include + #include "absl/status/statusor.h" #define BUILD_HEADER(command, length) (command << 5) + (length - 1) @@ -12,6 +15,9 @@ namespace rom_test { using yaze::app::CompressionPiece; using yaze::app::ROM; +using ::testing::ElementsAreArray; +using ::testing::TypedEq; + namespace { Bytes ExpectCompressDataLoadedOk(ROM& rom, uchar* in, int in_size) { @@ -66,10 +72,12 @@ TEST(ROMTest, NewDecompressionPieceOk) { TEST(ROMTest, DecompressionValidCommand) { ROM rom; - uchar simple_copy_input[4] = {BUILD_HEADER(0, 2), 42, 69, 0xFF}; + std::array simple_copy_input = {BUILD_HEADER(0, 2), 42, 69, 0xFF}; uchar simple_copy_output[2] = {42, 69}; - auto data = ExpectDecompressDataLoadedOk(rom, simple_copy_input, 4); - for (int i = 0; i < 2; i++) ASSERT_EQ(simple_copy_output[i], data[i]); + auto decompressed_result = + ExpectDecompressDataLoadedOk(rom, simple_copy_input.data(), 4); + ASSERT_THAT(simple_copy_output, + ElementsAreArray(decompressed_result.data(), 2)); } TEST(ROMTest, DecompressionMixingCommand) {