This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #include <wchar.h>
22
23 #include "signature.h"
24 SIGNATURE_CHECK (wcstok, wchar_t *,
25 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
26
27 #include <string.h>
28
29 #include "macros.h"
30
31 int
32 main ()
33 {
34 wchar_t string[] = L"hello world!";
35 wchar_t delim[] = L" ";
36 wchar_t *ptr;
37 wchar_t *ret;
38
39 ret = wcstok (string, delim, &ptr);
40 ASSERT (ret == string);
41 ASSERT (memcmp (string, L"hello\0 world!", 14 * sizeof (wchar_t)) == 0);
42 ASSERT (ptr == string + 6);
43
44 ret = wcstok (NULL, delim, &ptr);
45 ASSERT (ret == string + 7);
46 ASSERT (memcmp (string, L"hello\0 world!", 14 * sizeof (wchar_t)) == 0);
47 ASSERT (ptr == NULL || *ptr == L'\0');
48
49 ret = wcstok (NULL, delim, &ptr);
50 ASSERT (ret == NULL);
51
52 return 0;
53 }