brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · cb9d13f Raw
42 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H10#define LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H11 12#include "src/__support/macros/config.h"13#include "src/stdio/scanf_core/core_structs.h"14#include "test/UnitTest/Test.h"15 16namespace LIBC_NAMESPACE_DECL {17namespace testing {18 19class FormatSectionMatcher : public Matcher<scanf_core::FormatSection> {20  scanf_core::FormatSection expected;21  scanf_core::FormatSection actual;22 23public:24  FormatSectionMatcher(scanf_core::FormatSection expectedValue)25      : expected(expectedValue) {}26 27  bool match(scanf_core::FormatSection actualValue);28 29  void explainError() override;30};31 32} // namespace testing33} // namespace LIBC_NAMESPACE_DECL34 35#define EXPECT_SFORMAT_EQ(expected, actual)                                    \36  EXPECT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))37 38#define ASSERT_SFORMAT_EQ(expected, actual)                                    \39  ASSERT_THAT(actual, LIBC_NAMESPACE::testing::FormatSectionMatcher(expected))40 41#endif // LLVM_LIBC_UTILS_UNITTEST_SCANF_MATCHER_H42