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
11int main(void) {
12 printf(format: "sl_add\n");
13
14 StringList *sl = sl_init();
15 assert(sl);
16 char *p = strdup(s: "entry");
17 assert(!sl_add(sl, p));
18 char *entry = sl_find(sl, "entry");
19 assert(!strcmp(entry, p));
20 printf(format: "Found '%s'\n", entry);
21 sl_free(sl, 1);
22
23 return 0;
24 // CHECK: sl_add
25 // CHECK: Found '{{.*}}'
26}
27

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/sl_add.cpp