summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common/TestCases/strnlen.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/sanitizer_common/TestCases/strnlen.c')
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/strnlen.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/strnlen.c b/compiler-rt/test/sanitizer_common/TestCases/strnlen.c
new file mode 100644
index 00000000000..8ab8ec91151
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/strnlen.c
@@ -0,0 +1,12 @@
+// RUN: %clang %s -o %t && %run %t 2>&1
+
+#include <assert.h>
+#include <string.h>
+int main(int argc, char **argv) {
+ const char *s = "mytest";
+ assert(strnlen(s, 0) == 0UL);
+ assert(strnlen(s, 1) == 1UL);
+ assert(strnlen(s, 6) == strlen(s));
+ assert(strnlen(s, 7) == strlen(s));
+ return 0;
+}
OpenPOWER on IntegriCloud