1 //===---------------------- Unittests for strcat --------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 #include "src/string/strcat/strcat.h"
12 #include "gtest/gtest.h"
14 TEST(StrCatTest, EmptyDest) {
15 std::string abc = "abc";
20 char *result = __llvm_libc::strcat(dest, abc.c_str());
21 ASSERT_EQ(dest, result);
22 ASSERT_EQ(std::string(dest), abc);
23 ASSERT_EQ(std::string(dest).size(), abc.size());
26 TEST(StrCatTest, NonEmptyDest) {
27 std::string abc = "abc";
35 char *result = __llvm_libc::strcat(dest, abc.c_str());
36 ASSERT_EQ(dest, result);
37 ASSERT_EQ(std::string(dest), std::string("xyz") + abc);
38 ASSERT_EQ(std::string(dest).size(), abc.size() + 3);