This repository has been archived by the owner on Feb 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
do
executable file
·320 lines (288 loc) · 10.7 KB
/
do
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
#!/bin/sh -ex
for i in uint8.h uint32.h uint64.h int64.h
do
(
for x in $i:*
do
rm -f $i.test
cp $x $i.impl || continue
./compile -c $i.test.c || continue
./compile -o $i.test $i.test.o || continue
./$i.test || continue
exit 0
done
) || (
rm -f $i.impl
rm -f $i.test
rm -f $i.test.o
exit 111
) || exit 111
cat $i.impl > $i
rm -f $i.impl
rm -f $i.test
rm -f $i.test.o
done
./compile -c critbit0_allprefixed.c
./compile -c critbit0_clear.c
./compile -c critbit0_contains.c
./compile -c critbit0_delete.c
./compile -c critbit0_firstprefixed.c
./compile -c critbit0_insert.c
./compile -c critbit0-test1.c
./compile -c limitmalloc_close.c
./compile -c limitmalloc_open.c
./compile -c limitmalloc_open_if2.c
./compile -c limitmalloc-test1.c
./compile -c qhasm-ops.c
./compile -c qhasm-regs.c
./compile -c str0_colon.c
./compile -c str0_concat.c
./compile -c str0_concatc.c
./compile -c str0_copy.c
./compile -c str0_copyc.c
./compile -c str0_copycl.c
./compile -c str0_equal.c
./compile -c str0_equalc.c
./compile -c str0_free.c
./compile -c str0_getline.c
./compile -c str0_increment.c
./compile -c str0_length.c
./compile -c str0_putline.c
./compile -c str0-test1.c
./compile -c str0-test2.c
./compile -c str0-test3.c
./compile -c str0-test4.c
./compile -c str0-test5.c
./compile -c str0_uint64.c
./compile -c str0_word.c
./load -o critbit0-test1 \
critbit0_contains.o \
critbit0_delete.o \
critbit0_insert.o \
critbit0-test1.o \
limitmalloc_close.o \
limitmalloc_open_if2.o \
limitmalloc_open.o \
str0_copyc.o \
str0_equalc.o \
str0_equal.o \
str0_free.o \
str0_length.o
./load -o limitmalloc-test1 \
limitmalloc_close.o \
limitmalloc_open.o \
limitmalloc-test1.o
./load -o str0-test1 \
limitmalloc_close.o \
limitmalloc_open.o \
str0_concatc.o \
str0_copyc.o \
str0_copy.o \
str0_free.o \
str0_getline.o \
str0_length.o \
str0_putline.o \
str0-test1.o
./load -o str0-test2 \
limitmalloc_close.o \
limitmalloc_open.o \
str0_colon.o \
str0_concatc.o \
str0_copycl.o \
str0_copyc.o \
str0_free.o \
str0_getline.o \
str0_length.o \
str0_putline.o \
str0-test2.o
./load -o str0-test3 \
limitmalloc_close.o \
limitmalloc_open.o \
str0_concatc.o \
str0_copycl.o \
str0_copyc.o \
str0_free.o \
str0_getline.o \
str0_length.o \
str0_putline.o \
str0-test3.o \
str0_word.o
./load -o str0-test4 \
limitmalloc_close.o \
limitmalloc_open.o \
str0_free.o \
str0_length.o \
str0_putline.o \
str0-test4.o \
str0_uint64.o
./load -o str0-test5 \
limitmalloc_close.o \
limitmalloc_open.o \
str0_concatc.o \
str0_copyc.o \
str0_free.o \
str0_getline.o \
str0_increment.o \
str0_length.o \
str0_putline.o \
str0-test5.o
./load -o qhasm-ops \
critbit0_allprefixed.o \
critbit0_clear.o \
critbit0_contains.o \
critbit0_delete.o \
critbit0_firstprefixed.o \
critbit0_insert.o \
limitmalloc_close.o \
limitmalloc_open_if2.o \
limitmalloc_open.o \
qhasm-ops.o \
str0_colon.o \
str0_concatc.o \
str0_concat.o \
str0_copycl.o \
str0_copyc.o \
str0_copy.o \
str0_equalc.o \
str0_equal.o \
str0_free.o \
str0_getline.o \
str0_increment.o \
str0_length.o \
str0_putline.o \
str0_uint64.o \
str0_word.o
./load -o qhasm-regs \
critbit0_allprefixed.o \
critbit0_clear.o \
critbit0_contains.o \
critbit0_delete.o \
critbit0_firstprefixed.o \
critbit0_insert.o \
limitmalloc_close.o \
limitmalloc_open_if2.o \
limitmalloc_open.o \
qhasm-regs.o \
str0_colon.o \
str0_concatc.o \
str0_concat.o \
str0_copycl.o \
str0_copyc.o \
str0_copy.o \
str0_equalc.o \
str0_equal.o \
str0_free.o \
str0_getline.o \
str0_increment.o \
str0_length.o \
str0_putline.o \
str0_uint64.o \
str0_word.o
(
echo '--- limitmalloc library works'
./limitmalloc-test1
echo $?
echo '--- str0_getline handles empty input'
: | ./str0-test1
echo $?
echo '--- str0_getline handles normal lines'
( echo hello; echo there ) | ./str0-test1
echo $?
echo '--- str0_getline handles partial final lines'
( echo hello; echo there | tr -d '\012' ) | ./str0-test1
echo $?
echo '--- str0_getline handles long lines'
( echo 0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
echo 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
) | ./str0-test1
echo $?
echo '--- str0_getline and str0_putline handle nulls properly'
echo hello | tr l '\0' | ./str0-test1 | tr '\0' x
echo '--- str0_colon splits into fields'
echo hello:world | ./str0-test2
echo $?
echo '--- str0_colon handles empty final field'
echo hello:world: | ./str0-test2
echo $?
echo '--- str0_colon handles many fields'
echo one:two:three:four:five:six:seven | ./str0-test2
echo $?
echo '--- str0_colon handles 1 field'
echo hello world | ./str0-test2
echo $?
echo '--- str0_colon handles empty line'
echo '' | ./str0-test2
echo $?
echo '--- str0_word splits into words'
echo 'hello, world. "this is a test---really," he said.' | ./str0-test3
echo $?
echo '--- str0_word handles empty line'
echo '' | ./str0-test3
echo $?
echo '--- str0_uint64 works'
./str0-test4
echo $?
echo '--- str0_increment works'
( echo 0
echo 1
echo 2
echo 9
echo 10
echo 11
echo 19
echo 89
echo 99
echo 999999999999999999999999999999999999999999999
echo ''
) | ./str0-test5
echo $?
echo '--- critbit0 library works'
./critbit0-test1
echo $?
echo '--- qhasm-ops prioritizes variable name over text'
(
echo ':name:int32:%eax:%ecx:%edx:%ebx:%esi:%edi:%ebp:'
echo 'int32 r:var/r=int32:'
echo 'zero r:>r=int32:asm/set >r to 0:'
echo ':'
echo 'int32 x'
echo 'zero x'
echo 'int32 zero'
echo 'zero zero'
) | ./qhasm-ops
echo $?
echo '--- qhasm-regs handles register limits'
(
echo ':name:int32:%eax:%ecx:%edx:%ebx:%esi:%edi:%ebp:'
echo 'int32 r:var/r=int32:'
echo 'zero r:>r=int32#3,4,5:asm/set >r to 0:'
echo 'read r:<r=int32:asm/inspect <r:'
echo 'enter f:enter/f:asm/enter #f:'
echo 'leave:nofallthrough:leave:asm/leave:'
echo ':'
echo 'enter f'
echo 'int32 x'
echo 'int32 y'
echo 'int32 z'
echo 'zero x'
echo 'zero y'
echo 'zero z'
echo 'read x'
echo 'read y'
echo 'read z'
echo 'zero x'
echo 'zero y'
echo 'read x'
echo 'zero z'
echo 'read y'
echo 'read z'
echo 'leave'
) | ./qhasm-ops | ./qhasm-regs
echo $?
) > tests.out
diff -u tests.exp tests.out >&2