[RDF] Add RegisterRef::idx and make toUnitId constexpr
[llvm-project.git] / libc / test / UnitTest / PrintfMatcher.h
blob148c9ff80931dbba45b72fc026ee27fd3824695e
1 //===-- PrintfMatcher.h -----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H
10 #define LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H
12 #include "src/stdio/printf_core/core_structs.h"
13 #include "test/UnitTest/Test.h"
15 #include <errno.h>
17 namespace __llvm_libc {
18 namespace testing {
20 class FormatSectionMatcher : public Matcher<printf_core::FormatSection> {
21 printf_core::FormatSection expected;
22 printf_core::FormatSection actual;
24 public:
25 FormatSectionMatcher(printf_core::FormatSection expectedValue)
26 : expected(expectedValue) {}
28 bool match(printf_core::FormatSection actualValue);
30 void explainError() override;
33 } // namespace testing
34 } // namespace __llvm_libc
36 #define EXPECT_PFORMAT_EQ(expected, actual) \
37 EXPECT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
39 #define ASSERT_PFORMAT_EQ(expected, actual) \
40 ASSERT_THAT(actual, __llvm_libc::testing::FormatSectionMatcher(expected))
42 #endif // LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H