29 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/stdio/puts.h"10 11#include "test/UnitTest/Test.h"12 13TEST(LlvmLibcPutsTest, PrintOut) {14 int result;15 16 constexpr char simple[] = "A simple string";17 result = LIBC_NAMESPACE::puts(simple);18 EXPECT_GE(result, 0);19 20 // check that it appends a second newline at the end.21 constexpr char numbers[] = "1234567890\n";22 result = LIBC_NAMESPACE::puts(numbers);23 EXPECT_GE(result, 0);24 25 constexpr char more[] = "1234 and more\n6789 and rhyme";26 result = LIBC_NAMESPACE::puts(more);27 EXPECT_GE(result, 0);28}29