LV/test: clean up a test and regen with UTC (#118394)
[llvm-project.git] / libc / test / UnitTest / PrintfMatcher.h
blob4f79832ab59facd2f2136a3efa8cf1994bb9da10
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/__support/macros/config.h"
13 #include "src/stdio/printf_core/core_structs.h"
14 #include "test/UnitTest/Test.h"
16 namespace LIBC_NAMESPACE_DECL {
17 namespace testing {
19 class FormatSectionMatcher : public Matcher<printf_core::FormatSection> {
20 printf_core::FormatSection expected;
21 printf_core::FormatSection actual;
23 public:
24 FormatSectionMatcher(printf_core::FormatSection expectedValue)
25 : expected(expectedValue) {}
27 bool match(printf_core::FormatSection actualValue);
29 void explainError() override;
32 } // namespace testing
33 } // namespace LIBC_NAMESPACE_DECL
35 #define EXPECT_PFORMAT_EQ(expected, actual) \
36 EXPECT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
38 #define ASSERT_PFORMAT_EQ(expected, actual) \
39 ASSERT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
41 #endif // LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H