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 int
20 main ()
21 {
22
23 {
24 static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
25 size_t n;
26
27 for (n = 0; n <= SIZEOF (src); n++)
28 {
29 UNIT dest[1 + SIZEOF (src) + 1] =
30 { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
31 UNIT *ret;
32 size_t i;
33
34 ret = U_MOVE (dest + 1, src, n);
35 ASSERT (ret == dest + 1);
36 ASSERT (dest[0] == MAGIC);
37 for (i = 0; i < n; i++)
38 ASSERT (dest[1 + i] == src[i]);
39 ASSERT (dest[1 + n] == MAGIC);
40 }
41 }
42
43
44 {
45 static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
46 size_t n;
47
48 for (n = 0; n <= SIZEOF (src); n++)
49 {
50 UNIT dest[1 + SIZEOF (src) + 1];
51 UNIT *ret;
52 size_t i;
53
54 dest[0] = MAGIC;
55 for (i = 0; i < n; i++)
56 dest[1 + i] = src[i];
57 dest[1 + n] = MAGIC;
58
59 ret = U_MOVE (dest + 1, dest + 1, n);
60 ASSERT (ret == dest + 1);
61 ASSERT (dest[0] == MAGIC);
62 for (i = 0; i < n; i++)
63 ASSERT (dest[1 + i] == src[i]);
64 ASSERT (dest[1 + n] == MAGIC);
65 }
66 }
67
68
69 {
70 static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
71 static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
72 size_t d;
73
74 ASSERT (SIZEOF (src) == SIZEOF (src2));
75 for (d = 0; d <= SIZEOF (src); d++)
76 {
77 size_t n;
78
79 for (n = 0; n <= SIZEOF (src); n++)
80 {
81 UNIT dest[1 + 2 * SIZEOF (src) + 1];
82 UNIT *ret;
83 size_t i;
84
85 dest[0] = MAGIC;
86 for (i = 0; i < SIZEOF (src2); i++)
87 dest[1 + i] = src2[i];
88 for (i = 0; i < SIZEOF (src); i++)
89 dest[1 + SIZEOF (src) + i] = src[i];
90 dest[1 + 2 * SIZEOF (src)] = MAGIC;
91
92 ret =
93 U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n);
94 ASSERT (ret == dest + 1 + SIZEOF (src) - d);
95 ASSERT (dest[0] == MAGIC);
96 for (i = 0; i < SIZEOF (src) - d; i++)
97 ASSERT (dest[1 + i] == src2[i]);
98 for (i = 0; i < n; i++)
99 ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]);
100 for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++)
101 ASSERT (dest[1 + i] == src2[i]);
102 for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++)
103 ASSERT (dest[1 + SIZEOF (src) + i] == src[i]);
104 ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC);
105 }
106 }
107 }
108
109
110 {
111 static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
112 static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
113 size_t d;
114
115 ASSERT (SIZEOF (src) == SIZEOF (src2));
116 for (d = 0; d <= SIZEOF (src); d++)
117 {
118 size_t n;
119
120 for (n = 0; n <= SIZEOF (src); n++)
121 {
122 UNIT dest[1 + 2 * SIZEOF (src) + 1];
123 UNIT *ret;
124 size_t i;
125
126 dest[0] = MAGIC;
127 for (i = 0; i < SIZEOF (src); i++)
128 dest[1 + i] = src[i];
129 for (i = 0; i < SIZEOF (src2); i++)
130 dest[1 + SIZEOF (src) + i] = src2[i];
131 dest[1 + 2 * SIZEOF (src)] = MAGIC;
132
133 ret = U_MOVE (dest + 1 + d, dest + 1, n);
134 ASSERT (ret == dest + 1 + d);
135 ASSERT (dest[0] == MAGIC);
136 for (i = 0; i < d; i++)
137 ASSERT (dest[1 + i] == src[i]);
138 for (i = 0; i < n; i++)
139 ASSERT (dest[1 + d + i] == src[i]);
140 for (i = d + n; i < SIZEOF (src); i++)
141 ASSERT (dest[1 + i] == src[i]);
142 for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0);
143 i < SIZEOF (src2);
144 i++)
145 ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]);
146 ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC);
147 }
148 }
149 }
150
151 return 0;
152 }