[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / libc / test / src / string / strcoll_test.cpp
bloba10f98f1ca4d6aead025225fd7f5462683377ff3
1 //===-- Unittests for strcoll ---------------------------------------------===//
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/strcoll.h"
10 #include "test/UnitTest/Test.h"
12 // TODO: Add more comprehensive tests once locale support is added.
14 TEST(LlvmLibcStrcollTest, SimpleTest) {
15 const char *s1 = "abc";
16 const char *s2 = "abc";
17 const char *s3 = "def";
18 int result = LIBC_NAMESPACE::strcoll(s1, s2);
19 ASSERT_EQ(result, 0);
21 // Verify operands reversed.
22 result = LIBC_NAMESPACE::strcoll(s2, s1);
23 ASSERT_EQ(result, 0);
25 result = LIBC_NAMESPACE::strcoll(s1, s3);
26 ASSERT_LT(result, 0);
28 result = LIBC_NAMESPACE::strcoll(s3, s1);
29 ASSERT_GT(result, 0);