Make test more lenient for custom clang version strings
[llvm-project.git] / libc / test / src / string / strcat_test.cpp
blobe4f6c1ee75992e624a5f59dabb06f881cb437b2b
1 //===-- Unittests for strcat ----------------------------------------------===//
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/string/strcat.h"
10 #include "test/UnitTest/Test.h"
12 TEST(LlvmLibcStrCatTest, EmptyDest) {
13 const char *abc = "abc";
14 char dest[4];
16 dest[0] = '\0';
18 char *result = LIBC_NAMESPACE::strcat(dest, abc);
19 ASSERT_EQ(dest, result);
20 ASSERT_STREQ(dest, result);
21 ASSERT_STREQ(dest, abc);
24 TEST(LlvmLibcStrCatTest, NonEmptyDest) {
25 const char *abc = "abc";
26 char dest[7];
28 dest[0] = 'x';
29 dest[1] = 'y';
30 dest[2] = 'z';
31 dest[3] = '\0';
33 char *result = LIBC_NAMESPACE::strcat(dest, abc);
34 ASSERT_EQ(dest, result);
35 ASSERT_STREQ(dest, result);
36 ASSERT_STREQ(dest, "xyzabc");