1//===-- ScanfMatcher.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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H
10#define LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H
11
12#include "src/stdio/scanf_core/core_structs.h"
13#include "test/UnitTest/Test.h"
14
15#include <errno.h>
16
17namespace LIBC_NAMESPACE {
18namespace testing {
19
20class FormatSectionMatcher : public Matcher<scanf_core::FormatSection> {
21 scanf_core::FormatSection expected;
22 scanf_core::FormatSection actual;
23
24public:
25 FormatSectionMatcher(scanf_core::FormatSection expectedValue)
26 : expected(expectedValue) {}
27
28 bool match(scanf_core::FormatSection actualValue);
29
30 void explainError() override;
31};
32
33} // namespace testing
34} // namespace LIBC_NAMESPACE
35
36#define EXPECT_SFORMAT_EQ(expected, actual) \
37 EXPECT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
38
39#define ASSERT_SFORMAT_EQ(expected, actual) \
40 ASSERT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))
41
42#endif // LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H
43

source code of libc/test/UnitTest/ScanfMatcher.h