1 //===-- Unittests for fputc / putchar -------------------------------------===//
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
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
) {
18 constexpr char simple
[] = "A simple string written to stdout\n";
19 for (const char &c
: simple
) {
20 result
= LIBC_NAMESPACE::putchar(c
);
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
));