Make test more lenient for custom clang version strings
[llvm-project.git] / libc / test / src / stdio / fputc_test.cpp
blob0a776f70e353ddd1327c2604a5ccb1b7d75c6300
1 //===-- Unittests for fputc / putchar -------------------------------------===//
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 #include "src/__support/File/file.h"
10 #include "src/stdio/fputc.h"
11 #include "src/stdio/putchar.h"
13 #include "test/UnitTest/Test.h"
15 TEST(LlvmLibcPutcTest, PrintOut) {
16 int result;
18 constexpr char simple[] = "A simple string written to stdout\n";
19 for (const char &c : simple) {
20 result = LIBC_NAMESPACE::putchar(c);
21 EXPECT_GE(result, 0);
24 constexpr char more[] = "A simple string written to stderr\n";
25 for (const char &c : more) {
26 result = LIBC_NAMESPACE::fputc(
27 c, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr));
29 EXPECT_GE(result, 0);