File: wchar_c_h.c

package info (click to toggle)
frama-c 20161101%2Bsilicon%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,324 kB
  • ctags: 35,695
  • sloc: ml: 200,142; ansic: 31,465; makefile: 2,334; sh: 1,643; lisp: 259; python: 85; asm: 26
file content (50 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* run.config
   STDOPT: +"-cpp-extra-args=-DTEST_IMPLEMENTATION=1" +"-slevel 1000"
   STDOPT: +"-slevel 1000"
*/

#include <wchar.h>

#ifdef TEST_IMPLEMENTATION
#include "wchar.c"
#endif

volatile int nondet;

int main() {
  wchar_t *sc1 = L"Needle";
  wchar_t *sc2 = L"Haystack";
  wchar_t buf[20];
  wchar_t c = nondet;
  size_t n = 5, r;
  int i = -1;
  wchar_t *res = 0;

  if (nondet) res = wmemchr(sc1, c, n);
  if (nondet) i = wmemcmp(sc1, sc2, n);
  if (nondet) res = wmemcpy(buf, sc2, n);
  if (nondet) res = wmemmove(buf, sc2, n);
  if (nondet) res = wmemset(buf, c, n);
  if (nondet) res = wcschr(sc1, c);
  if (nondet) i = wcscmp(sc1, sc2);
  if (nondet) res = wcscpy(buf, sc2);
  if (nondet) r = wcscspn(sc1, sc2);
  if (nondet) r = wcslcat(buf, sc2, n);
  if (nondet) r = wcslcpy(buf, sc2, n);
  if (nondet) r = wcslen(sc1);
  if (nondet) i = wcsncmp(sc1, sc2, n);
  if (nondet) res = wcsncpy(buf, sc2, n);
  if (nondet) res = wcspbrk(sc1, sc2);
  if (nondet) res = wcsrchr(sc1, c);
  if (nondet) r = wcsspn(sc1, sc2);
  if (nondet) res = wcsstr(sc1, sc2);

  for (i = 0; i < 5; i++) buf[i] = nondet;
  buf[i] = L'\0';
  if (nondet) res = wcscat(buf, sc2);
  buf[i] = L'\0';
  if (nondet) res = wcsncat(buf, sc2, n);


  return 0;
}