blob: be288554949d65731b77b6ff53f8a51ffa2d767d [file] [log] [blame]
Zhi An Ng0ba29e72022-01-20 11:26:01 -08001// 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 Ngf67f1be2022-01-21 10:06:54 -080018 EXPECT_INSTR(expected, *reinterpret_cast<const uint32_t*>(a.start()))
Zhi An Ng0ba29e72022-01-20 11:26:01 -080019
20#define EXPECT_ERROR(expected, call) \
21 a.reset(); \
22 call; \
23 EXPECT_EQ(expected, a.error());