summaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Posix/sl_add.cc
blob: 4da70c7888f68249a51bc6bbc04831f686be75ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
//
// UNSUPPORTED: linux, darwin, solaris

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stringlist.h>

int main(void) {
  printf("sl_add\n");

  StringList *sl = sl_init();
  assert(sl);
  char *p = strdup("entry");
  assert(!sl_add(sl, p));
  char *entry = sl_find(sl, "entry");
  assert(!strcmp(entry, p));
  printf("Found '%s'\n", entry);
  sl_free(sl, 1);

  return 0;
  // CHECK: sl_add
  // CHECK: Found '{{.*}}'
}