Files
clang-p2996/libc/test/src/stdio/fputc_test.cpp
Mikhail R. Gadelha dbceb1d936 [libc] Fix unused variable in fputc test (#67830)
This is probably a copy-and-paste error and the variable 'more' was left
unused.
2023-09-29 12:31:40 -04:00

31 lines
947 B
C++

//===-- Unittests for fputc / putchar -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "src/__support/File/file.h"
#include "src/stdio/fputc.h"
#include "src/stdio/putchar.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcPutcTest, PrintOut) {
int result;
constexpr char simple[] = "A simple string written to stdout\n";
for (const char &c : simple) {
result = LIBC_NAMESPACE::putchar(c);
EXPECT_GE(result, 0);
}
constexpr char more[] = "A simple string written to stderr\n";
for (const char &c : more) {
result = LIBC_NAMESPACE::fputc(
c, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr));
}
EXPECT_GE(result, 0);
}