xref: /aosp_15_r20/external/XNNPACK/test/assembler-helpers.h (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
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()); \
18   EXPECT_INSTR(expected, *reinterpret_cast<const uint32_t*>(a.start()))
19 
20 #define EXPECT_ERROR(expected, call) \
21   a.reset();                         \
22   call;                              \
23   EXPECT_EQ(expected, a.error());
24