1ed34cb2cSJoseph Huber //===-- Unittests for puts ---------------------------------------------===// 2ed34cb2cSJoseph Huber // 3ed34cb2cSJoseph Huber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4ed34cb2cSJoseph Huber // See https://llvm.org/LICENSE.txt for license information. 5ed34cb2cSJoseph Huber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6ed34cb2cSJoseph Huber // 7ed34cb2cSJoseph Huber //===----------------------------------------------------------------------===// 8ed34cb2cSJoseph Huber 9ed34cb2cSJoseph Huber #include "src/__support/File/file.h" 10ed34cb2cSJoseph Huber #include "src/stdio/fputs.h" 11ed34cb2cSJoseph Huber 12ed34cb2cSJoseph Huber #include "test/UnitTest/Test.h" 13ed34cb2cSJoseph Huber TEST(LlvmLibcPutsTest,PrintOut)14ed34cb2cSJoseph HuberTEST(LlvmLibcPutsTest, PrintOut) { 15ed34cb2cSJoseph Huber int result; 16ed34cb2cSJoseph Huber 17ed34cb2cSJoseph Huber constexpr char simple[] = "A simple string written to stdout\n"; 18*b6bc9d72SGuillaume Chatelet result = LIBC_NAMESPACE::fputs( 19*b6bc9d72SGuillaume Chatelet simple, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stdout)); 20ed34cb2cSJoseph Huber EXPECT_GE(result, 0); 21ed34cb2cSJoseph Huber 22ed34cb2cSJoseph Huber constexpr char more[] = "A simple string written to stderr\n"; 23*b6bc9d72SGuillaume Chatelet result = LIBC_NAMESPACE::fputs( 24*b6bc9d72SGuillaume Chatelet more, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr)); 25ed34cb2cSJoseph Huber EXPECT_GE(result, 0); 26ed34cb2cSJoseph Huber } 27