summaryrefslogtreecommitdiff
path: root/libc/test/src/string/strncmp_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/string/strncmp_test.cpp')
-rw-r--r--libc/test/src/string/strncmp_test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc/test/src/string/strncmp_test.cpp b/libc/test/src/string/strncmp_test.cpp
index 8855e0f59db0..52add6b516e8 100644
--- a/libc/test/src/string/strncmp_test.cpp
+++ b/libc/test/src/string/strncmp_test.cpp
@@ -156,3 +156,14 @@ TEST(LlvmLibcStrNCmpTest, StringComparisonEndsOnNullByteEvenWithLongerLength) {
result = __llvm_libc::strncmp(s2, s1, 7);
ASSERT_EQ(result, 0);
}
+
+TEST(LlvmLibcStrNCmpTest, Case) {
+ const char *s1 = "aB";
+ const char *s2 = "ab";
+ int result = __llvm_libc::strncmp(s1, s2, 2);
+ ASSERT_LT(result, 0);
+
+ // Verify operands reversed.
+ result = __llvm_libc::strncmp(s2, s1, 2);
+ ASSERT_GT(result, 0);
+}