1a9e0dbefSMichael Jones //===-- Unittests for puts ---------------------------------------------===// 2a9e0dbefSMichael Jones // 3a9e0dbefSMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4a9e0dbefSMichael Jones // See https://llvm.org/LICENSE.txt for license information. 5a9e0dbefSMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6a9e0dbefSMichael Jones // 7a9e0dbefSMichael Jones //===----------------------------------------------------------------------===// 8a9e0dbefSMichael Jones 9a9e0dbefSMichael Jones #include "src/stdio/puts.h" 10a9e0dbefSMichael Jones 11af1315c2SSiva Chandra Reddy #include "test/UnitTest/Test.h" 12a9e0dbefSMichael Jones TEST(LlvmLibcPutsTest,PrintOut)13a9e0dbefSMichael JonesTEST(LlvmLibcPutsTest, PrintOut) { 14a9e0dbefSMichael Jones int result; 15a9e0dbefSMichael Jones 16a9e0dbefSMichael Jones constexpr char simple[] = "A simple string"; 17*b6bc9d72SGuillaume Chatelet result = LIBC_NAMESPACE::puts(simple); 18a9e0dbefSMichael Jones EXPECT_GE(result, 0); 19a9e0dbefSMichael Jones 20a9e0dbefSMichael Jones // check that it appends a second newline at the end. 21a9e0dbefSMichael Jones constexpr char numbers[] = "1234567890\n"; 22*b6bc9d72SGuillaume Chatelet result = LIBC_NAMESPACE::puts(numbers); 23a9e0dbefSMichael Jones EXPECT_GE(result, 0); 24a9e0dbefSMichael Jones 25a9e0dbefSMichael Jones constexpr char more[] = "1234 and more\n6789 and rhyme"; 26*b6bc9d72SGuillaume Chatelet result = LIBC_NAMESPACE::puts(more); 27a9e0dbefSMichael Jones EXPECT_GE(result, 0); 28a9e0dbefSMichael Jones } 29