Zhi An Ng | 0ba29e7 | 2022-01-20 11:26:01 -0800 | [diff] [blame] | 1 | // Copyright 2022 Google LLC |
| 2 | // |
| 3 | // This source code is licensed under the BSD-style license found in the |
| 4 | // LICENSE file in the root directory of this source tree. |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | // clang-format off |
| 9 | #define EXPECT_INSTR(expected, actual) \ |
| 10 | EXPECT_EQ(expected, actual) << "expected = 0x" << std::hex << std::setw(8) << std::setfill('0') << expected \ |
| 11 | << std::endl << " actual = 0x" << actual; |
| 12 | // clang-format on |
| 13 | |
| 14 | #define CHECK_ENCODING(expected, call) \ |
| 15 | a.reset(); \ |
| 16 | call; \ |
| 17 | EXPECT_EQ(Error::kNoError, a.error()); \ |
Zhi An Ng | f67f1be | 2022-01-21 10:06:54 -0800 | [diff] [blame] | 18 | EXPECT_INSTR(expected, *reinterpret_cast<const uint32_t*>(a.start())) |
Zhi An Ng | 0ba29e7 | 2022-01-20 11:26:01 -0800 | [diff] [blame] | 19 | |
| 20 | #define EXPECT_ERROR(expected, call) \ |
| 21 | a.reset(); \ |
| 22 | call; \ |
| 23 | EXPECT_EQ(expected, a.error()); |