Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / test / src / stdio / fputs_test.cpp
blob6583738acb94c1c2647e0310b4cab2eb725ca85e
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 //===----------------------------------------------------------------------===//
9 #include "src/__support/File/file.h"
10 #include "src/stdio/fputs.h"
12 #include "test/UnitTest/Test.h"
14 TEST(LlvmLibcPutsTest, PrintOut) {
15 int result;
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);
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);