| 1 | //===-- Unittests for puts ---------------------------------------------===// |
| 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 | #include "src/__support/File/file.h" |
| 10 | #include "src/stdio/fputs.h" |
| 11 | |
| 12 | #include "test/UnitTest/Test.h" |
| 13 | |
| 14 | TEST(LlvmLibcPutsTest, PrintOut) { |
| 15 | int result; |
| 16 | |
| 17 | constexpr char simple[] = "A simple string written to stdout\n" ; |
| 18 | result = LIBC_NAMESPACE::fputs( |
| 19 | simple, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stdout)); |
| 20 | EXPECT_GE(result, 0); |
| 21 | |
| 22 | constexpr char more[] = "A simple string written to stderr\n" ; |
| 23 | result = LIBC_NAMESPACE::fputs( |
| 24 | more, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr)); |
| 25 | EXPECT_GE(result, 0); |
| 26 | } |
| 27 | |