xref: /llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp (revision 975fa725063fe33aba02164a53c4ef66662e68d8)
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
2 //
3 // UNSUPPORTED: darwin, target={{.*(linux|solaris).*}}
4 
5 #include <assert.h>
6 #include <errno.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <stringlist.h>
10 
main(void)11 int main(void) {
12   printf("sl_add\n");
13 
14   StringList *sl = sl_init();
15   assert(sl);
16   char *p = strdup("entry");
17   assert(!sl_add(sl, p));
18   char *entry = sl_find(sl, "entry");
19   assert(!strcmp(entry, p));
20   printf("Found '%s'\n", entry);
21   sl_free(sl, 1);
22 
23   return 0;
24   // CHECK: sl_add
25   // CHECK: Found '{{.*}}'
26 }
27