scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <assert.h>
 2#include <stdio.h>
 3#include <wchar.h>
 4
 5#define SIZ 6
 6
 7/*
 8output:
 9testing
10test1
11test2
12test3
13done
14end:
15*/
16
17int
18main()
19{
20	wchar_t *s, buf[SIZ];
21	wchar_t abc[] = {'a', 'b', 'c'};
22
23	puts("testing");
24
25	puts("test1");
26	wmemset(buf, '0', SIZ);
27	s = wcsncpy(buf, abc, SIZ);
28	assert(s == buf);
29	assert(!wmemcmp(s, abc, SIZ));
30
31	puts("test2");
32	wmemset(buf, '0', SIZ);
33	s = wcsncpy(buf, (wchar_t[]) {0}, SIZ);
34	assert(s == buf);
35	assert(!wmemcmp(s, (wchar_t[SIZ]) {0}, SIZ));
36
37	puts("test3");
38	wmemset(buf, '0', SIZ);
39	s = wcsncpy(buf, (wchar_t[]) {0}, 1);
40	assert(s == buf);
41	assert(!wmemcmp(s,
42	                (wchar_t[SIZ]) {'\0', '0', '0', '0', '0', '0'},
43	                SIZ));
44
45	puts("done");
46
47	return 0;
48}