Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 778 lines (681 sloc) 18.103 kb
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
1 /* verify.c */
2 /* Copyright 1995 by Steve Kirkendall */
3
4
5 /* This file contains a replacement for elvis' main() function. The resulting
6 * program will test each component of elvis.
7 */
8
9 #include <stdio.h>
10 #include "elvis.h"
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
11 #ifdef FEATURE_RCSID
12 char id_verify[] = "$Id: verify.c,v 1.14 2003/10/17 17:41:23 steve Exp $";
13 #endif
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
14
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
15 #ifdef PROTOCOL_FTP
16 # error You must #undef PROTOCOL_FTP in config.h to compile this program
17 #endif
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
18 #ifdef FEATURE_COMPLETE
19 # error You must #undef FEATURE_COMPLETE in config.h to compile this program
20 #endif
21 #ifdef FEATURE_SHOWTAG
22 # error You must #undef FEATURE_SHOWTAG in config.h to compile this program
23 #endif
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
24 #ifdef FEATURE_ALIAS
25 # error You must #undef FEATURE_ALIAS in config.h to compile this program
26 #endif
27 #ifdef FEATURE_REGION
28 # error You must #undef FEATURE_REGION in config.h to compile this program
29 #endif
30 #ifdef FEATURE_AUTOCMD
31 # error You must #undef FEATURE_AUTOCMD in config.h to compile this program
32 #endif
33 #ifdef FEATURE_SPELL
34 # error You must #undef FEATURE_SPELL in config.h to compile this program
35 #endif
36 #ifdef FEATURE_FOLD
37 # error You must #undef FEATURE_FOLD in config.h to compile this program
38 #endif
39 #ifdef FEATURE_PROTO
40 # error You must #undef FEATURE_PROTO in config.h to compile this program
41 #endif
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
42
43
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
44 static BLK blkbuf;
45
46 #ifdef USE_PROTOTYPES
47 extern int main(int argc, char **argv);
48 static void init(void);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
49 extern ELVBOOL buffer(void);
50 extern ELVBOOL lowbuf(void);
51 extern ELVBOOL session(void);
52 extern ELVBOOL options(void);
53 extern ELVBOOL ostext(void);
54 extern ELVBOOL osblock(void);
55 extern ELVBOOL osdir(void);
56 extern ELVBOOL sesmacro(void);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
57 extern WINDOW winofbuf(WINDOW win, BUFFER buf);
58 extern WINDOW winalloc(GUIWIN *gw, OPTVAL *gvals, BUFFER buf, long rows, long columns);
59 extern void msg(MSGIMP imp, char *terse, ...);
60 extern void drawchar(CHAR *cp, long qty, _char_ font, long offset);
61 extern void draw1ch(CHAR c, _char_ font, long offset);
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
62 extern void drawopencomplete(WINDOW win);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
63 extern char *perm2str(DIRPERM perm);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
64 extern char *bool2str(ELVBOOL bool);
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
65 extern void urlbytes(long totbytes);
66 extern void urlclose(void);
67 extern char *urllocal(char *url);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
68 extern ELVBOOL urlopen(char *url, ELVBOOL force, _char_ rwa);
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
69 extern DIRPERM urlperm(char *url);
70 extern int urlread(CHAR *buf, int bytes);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
71 extern ELVBOOL urlremote(char *url);
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
72 extern int urlwrite(CHAR *buf, int bytes);
73 extern CHAR *msgtranslate(char *word);
74 extern TAG *tetag(CHAR *select);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
75 extern BUFFER cutbuffer(_CHAR_ cbname, ELVBOOL create);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
76 #endif /* USE_PROTOTYPES */
77
78 /*****************************************************************************
79 * Start of stub functions
80 */
81
97d89980 »
2011-12-10 Import Elvis 2.1_4 (written by Steve Kirkendall)
82 EXCTLSTATE exctlstate;
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
83 long eventcounter;
84 GUI dummygui, *chosengui = &dummygui;
85
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
86 char *bool2str(ELVBOOL bool)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
87 {
88 return (bool ? "TRUE" : "FALSE");
89 }
90
91 char *perm2str(DIRPERM perm)
92 {
93 switch (perm)
94 {
95 case DIR_INVALID: return "DIR_INVALID";
96 case DIR_BADPATH: return "DIR_BADPATH";
97 case DIR_NOTFILE: return "DIR_NOTFILE";
98 case DIR_NEW: return "DIR_NEW";
99 case DIR_UNREADABLE: return "DIR_UNREADABLE";
100 case DIR_READONLY: return "DIR_READONLY";
101 default: return "DIR_READWRITE";
102 }
103 }
104
105 void draw1ch(CHAR c, _char_ font, long offset)
106 {
107 static char prevfont = 'n';
108
109 if (prevfont != font)
110 {
111 switch (font)
112 {
113 case 'b': fputs("\033[1m", stdout); break;
114 case 'u': fputs("\033[4m", stdout); break;
115 default: fputs("\033[m", stdout); break;
116 }
117 prevfont = font;
118 }
119 putchar(c);
120 }
121
122 void drawchar(CHAR *cp, long qty, _char_ font, long offset)
123 {
124 long delta = 1;
125 if (qty < 0)
126 {
127 qty = -qty;
128 delta = 0;
129 }
130 while(--qty >= 0)
131 {
132 draw1ch(*cp, font, offset);
133 cp += delta;
134 offset += delta;
135 }
136 }
137
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
138 void drawopencomplete(WINDOW win)
139 {
140 }
141
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
142 void msg(MSGIMP imp, char *terse, ...)
143 {
144 fputs(terse, stderr);
145 if (imp == MSG_FATAL)
146 {
147 exit(2);
148 }
149 }
150
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
151
152 ELVBOOL msghide(hide)
153 ELVBOOL hide; /* should we hide messages? (else reveal them) */
154 {
155 return ElvFalse;
156 }
157
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
158 void drawextext(WINDOW win, CHAR *text, int len){}
159 int wincount(BUFFER buf){ return 0; }
160 WINDOW windefault;
161 WINDOW windows;
162 WINDOW winalloc(GUIWIN *gw, OPTVAL *gvals, BUFFER buf, long rows, long columns)
163 {
164 WINDOW newp;
165
166 /* allocate a window, and initialize it */
167 newp = (WINDOW)safealloc(1, sizeof *newp);
168 newp->next = windows;
169 windows = newp;
170 newp->gw = gw;
171 newp->guivals = gvals;
172 newp->cursor = markalloc(buf, 0);
173 newp->wantcol = 0;
174
175 /* initialize the options */
176 optpreset(o_columns(newp), columns, OPT_SET|OPT_LOCK);
177 optpreset(o_lines(newp), rows, OPT_SET|OPT_LOCK);
178 optflags(o_display(newp)) = OPT_LOCK;
179 o_scroll(newp) = rows / 2;
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
180 o_ruler(newp) = o_showmode(newp) = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
181
182 /* no text is selected, initially */
183 newp->seltop = newp->selbottom = NULL;
184
185 return newp;
186 }
187
188 WINDOW winofbuf(WINDOW win, BUFFER buf)
189 {
190 /* if "win" is NULL, then start searching at first window */
191 if (!win)
192 {
193 win = windows;
194 }
195 else
196 {
197 win = win->next;
198 }
199
200 /* search for "buf", or NULL */
201 while (win && buf && markbuffer(win->cursor) != buf)
202 {
203 win = win->next;
204 }
205 return win;
206 }
207
208
209 RESULT experform(WINDOW win, MARK top, MARK bottom)
210 {
211 return RESULT_ERROR;
212 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
213 ELVBOOL exparseaddress(CHAR **refp, EXINFO *xinf)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
214 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
215 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
216 }
217 void exfree(EXINFO *xinf)
218 {
219 }
220 RESULT _viperform(WINDOW win)
221 {
222 return RESULT_ERROR;
223 }
224
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
225 void urlbytes(long totbytes)
226 {
227 }
228
229 void urlclose(void)
230 {
231 }
232
233 char *urllocal(char *url)
234 {
235 return url;
236 }
237
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
238 ELVBOOL urlopen(char *url, ELVBOOL force, _char_ rwa)
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
239 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
240 return ElvFalse;
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
241 }
242
243 DIRPERM urlperm(char *url)
244 {
245 return dirperm(url);
246 }
247
248 int urlread(CHAR *buf, int bytes)
249 {
250 return 0;
251 }
252
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
253 ELVBOOL urlremote(char *url)
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
254 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
255 return ElvFalse;
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
256 }
257
258 int urlwrite(CHAR *buf, int bytes)
259 {
260 return 0;
261 }
262
263 CHAR *msgtranslate(char *word)
264 {
265 return toCHAR(word);
266 }
267
268 TAG *tetag(CHAR *select)
269 {
270 return NULL;
271 }
272
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
273 BUFFER cutbuffer(_CHAR_ cbname, ELVBOOL create)
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
274 {
275 abort();
276 }
277
278
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
279 CHAR *regbuild(delim, refp, reg)
280 _CHAR_ delim; /* the delimiter */
281 CHAR **refp; /* reference to a CHAR* already used with scanalloc() */
282 ELVBOOL reg; /* really a regular expression? else replacement text */
283 {
284 return NULL;
285 }
286
287
288 regexp *regcomp(exp, cursor)
289 CHAR *exp; /* source code of the regular expression */
290 MARK cursor; /* cursor position, to support "\@" */
291 {
292 return NULL;
293 }
294
295 int regexec(re, str, bol)
296 regexp *re; /* a compiled regular expression */
297 MARK str; /* a string to compare against the regexp */
298 ELVBOOL bol; /* if ElvTrue, "str" is the beginning of a string */
299 {
300 return 0;
301 }
302
303
304 CHAR *regsub(re, newp, doit)
305 regexp *re; /* a regular expression that has been matched */
306 REG CHAR *newp; /* the replacement text */
307 ELVBOOL doit; /* perform the substitution? (else just return string) */
308 {
309 return NULL;
310 }
311
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
312
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
313 /*
314 * End of stubs
315 *****************************************************************************
316 * Start of tests
317 */
318
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
319 ELVBOOL sesmacro(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
320 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
321 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
322
323 if ((char *)&blkbuf.super.buf[SES_MAXSUPER] > &blkbuf.sizetester[o_blksize])
324 {
325 printf("\tSES_MAXSUPER = %ld\n", SES_MAXSUPER);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
326 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
327 }
328 if ((char *)&blkbuf.bufinfo.name[SES_MAXBUFINFO] > &blkbuf.sizetester[o_blksize])
329 {
330 printf("\tSES_MAXBUFINFO = %ld\n", SES_MAXBUFINFO);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
331 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
332 }
333 if ((char *)&blkbuf.blklist.blk[SES_MAXBLKLIST] > &blkbuf.sizetester[o_blksize])
334 {
335 printf("\tSES_MAXBLKLIST = %ld\n", SES_MAXBLKLIST);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
336 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
337 }
338 if ((char *)&blkbuf.chars.chars[SES_MAXCHARS] > &blkbuf.sizetester[o_blksize])
339 {
340 printf("\tSES_MAXCHARS = %ld\n", SES_MAXCHARS);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
341 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
342 }
343
344 return passed;
345 }
346
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
347 ELVBOOL osdir(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
348 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
349 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
350 char *tmp;
351
352 tmp = dirpath("directory", "file");
353 printf("\tdirpath(\"directory\", \"file\") = \"%s\"\n", tmp);
354 printf("\tdirdir(\"%s\") = \"%s\"\n", tmp, dirdir(tmp));
355 if (strcmp(dirdir(tmp), "directory"))
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
356 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
357 printf("\tdirfile(\"%s\") = \"%s\"\n", tmp, dirfile(tmp));
358 if (strcmp(dirfile(tmp), "file"))
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
359 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
360
361 /* wildcard expansion */
362 printf("\tdiriswild(\"*.c\") = %s\n", bool2str(diriswild("*.c")));
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
363 tmp = dirfirst("*.c", ElvFalse);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
364 printf("\tdirfirst(\"*.c\") = \"%s\"\n", tmp);
365 while ((tmp = dirnext()) != NULL)
366 {
367 printf("\tdirnext() = \"%s\"\n", tmp);
368 }
369 printf("\tdirnext() = NULL\n");
370
371 /* current working directory */
372 printf("\tdircwd() = \"%s\"\n", dircwd());
373
374 /* permissions */
375 printf("\tdirperm(\"verify.c\") = %s\n", perm2str(dirperm("verify.c")));
376 if (dirperm("verify.c") != DIR_READWRITE)
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
377 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
378 printf("\tdirperm(\"foo\") = %s\n", perm2str(dirperm("foo")));
379 if (dirperm("foo") != DIR_NEW)
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
380 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
381 tmp = dircwd();
382 printf("\tdirperm(\"%s\") = %s\n", tmp, perm2str(dirperm(tmp)));
383 if (dirperm(tmp) != DIR_NOTFILE)
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
384 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
385
386 return passed;
387 }
388
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
389 ELVBOOL osblock(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
390 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
391 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
392
393 blkbuf.super.magic = SESSION_MAGIC;
394 blkbuf.super.blksize = sizeof(BLK);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
395 printf("\tblkopen(ElvFalse, &blkbuf) = %s\n",
396 bool2str(passed &= blkopen(ElvFalse, &blkbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
397 blkclose(&blkbuf);
398 printf("\tblkclose()\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
399 printf("\tblkopen(ElvFalse, &blkbuf) = %s\n",
400 bool2str(passed &= blkopen(ElvFalse, &blkbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
401 memset(&blkbuf, 0, o_blksize);
402 blkread(&blkbuf, 0);
403 printf("\tblkbuf.super.magic = 0x%lx (expect %lx)\n",
404 blkbuf.super.magic, SESSION_MAGIC);
405 if (blkbuf.super.magic != SESSION_MAGIC)
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
406 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
407 printf("\tblkbuf.super.blksize = %d (expect %d)\n",
408 blkbuf.super.blksize, sizeof(BLK));
409 if (blkbuf.super.blksize != sizeof(BLK))
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
410 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
411 printf("\tblkbuf.super.inuse = %ld (expect non-0)\n",
412 blkbuf.super.inuse);
413 if (!blkbuf.super.inuse)
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
414 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
415 blkclose(&blkbuf);
416
417 return passed;
418 }
419
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
420 ELVBOOL ostext(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
421 {
422 static CHAR written[] = "line 1\n" "line 2\n" "line 3\n";
423 CHAR readback[2 * sizeof written];
424
425 /* if "verify.txt" already exists, don't clobber it! */
426 if (dirperm("verify.txt") != DIR_NEW)
427 {
428 printf("\t\"verify.txt\" already exists\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
429 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
430 }
431
432 /* test writing */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
433 if (txtopen("verify.txt", 'w', ElvFalse))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
434 {
435 printf("\ttxtopen(\"verify.txt\", 'w') failed\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
436 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
437 }
438 if (txtwrite(written, QTY(written) - 1) <= 0)
439 {
440 printf("\ttxtwrite() failed\n");
441 txtclose();
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
442 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
443 }
444 txtclose();
445
446 /* readback, and compare */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
447 if (txtopen("verify.txt", 'r', ElvFalse))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
448 {
449 printf("\ttxtopen(\"verify.txt\", 'r') failed\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
450 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
451 }
452 if (txtread(readback, QTY(readback)) != QTY(written) - 1)
453 {
454 txtclose();
455 printf("\ttxtread() returned short count\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
456 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
457 }
458 txtclose();
459 if (memcmp(written, readback, (QTY(written) - 1) * sizeof(CHAR)))
460 {
461 printf("\tread text doesn't match written text.\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
462 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
463 }
464
465 /* test appending */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
466 if (txtopen("verify.txt", 'a', ElvFalse))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
467 {
468 printf("\ttxtopen(\"verify.txt\", 'a') failed\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
469 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
470 }
471 if (txtwrite(written, QTY(written) - 1) <= 0)
472 {
473 printf("\ttxtwrite() failed\n");
474 txtclose();
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
475 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
476 }
477 txtclose();
478
479 /* readback, and compare */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
480 if (txtopen("verify.txt", 'r', ElvFalse))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
481 {
482 printf("\ttxtopen(\"verify.txt\", 'r') failed\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
483 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
484 }
485 if (txtread(readback, QTY(readback)) != 2 * (QTY(written) - 1))
486 {
487 txtclose();
488 printf("\ttxtread() returned short count, after appending\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
489 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
490 }
491 txtclose();
492 if (memcmp(written, readback, (QTY(written) - 1) * sizeof(CHAR))
493 || memcmp(written, readback + QTY(written) - 1, (QTY(written) - 1) * sizeof(CHAR)))
494 {
495 printf("\tread text doesn't match written text, after appending\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
496 return ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
497 }
498
499 remove("verify.txt");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
500 return ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
501 }
502
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
503 ELVBOOL options(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
504 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
505 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
506 CHAR outbuf[100];
507 char argbuf[20];
508
509 /* boolean testing */
510 #if 0
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
511 if (!optset(ElvFalse, strcpy(argbuf, "warn"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
512 || !o_warn
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
513 || !optset(ElvFalse, strcpy(argbuf, "warn?"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
514 || strcmp(outbuf, "warn\n")
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
515 || !optset(ElvFalse, strcpy(argbuf, "nowarn"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
516 || o_warn
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
517 || !optset(ElvFalse, strcpy(argbuf, "warn?"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
518 || strcmp(outbuf, "nowarn\n")
519 || (optflags(o_warn) & OPT_SET) == 0)
520 {
521 printf("\ttrouble with boolean options\n", argbuf, outbuf);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
522 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
523 }
524 #else
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
525 assert(optset(ElvFalse, strcpy(argbuf, "warn"), outbuf, sizeof(outbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
526 assert(o_warn);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
527 assert(optset(ElvFalse, strcpy(argbuf, "warn?"), outbuf, sizeof(outbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
528 assert(!strcmp(outbuf, "warn\n"));
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
529 assert(optset(ElvFalse, strcpy(argbuf, "nowarn"), outbuf, sizeof(outbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
530 assert(!o_warn);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
531 assert(optset(ElvFalse, strcpy(argbuf, "warn?"), outbuf, sizeof(outbuf)));
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
532 assert(!strcmp(outbuf, "nowarn\n"));
533 assert((optflags(o_warn) & OPT_SET) != 0);
534 #endif
535
536 /* string testing */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
537 if (!optset(ElvFalse, (CHAR *)strcpy(argbuf, "sh=csh"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
538 || !o_shell
539 || strcmp(tochar8(o_shell), "csh")
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
540 || !optset(ElvFalse, (CHAR *)strcpy(argbuf, "shell"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
541 || !strcmp(tochar8(outbuf), "shell=sh\n")
542 || (optflags(o_shell) & OPT_SET) == 0)
543 {
544 printf("\ttrouble with string options\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
545 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
546 }
547
548 /* number testing */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
549 if (!optset(ElvFalse, (CHAR *)strcpy(argbuf, "window=17"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
550 || o_window != 17
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
551 || !optset(ElvFalse, (CHAR *)strcpy(argbuf, "window"), outbuf, sizeof(outbuf))
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
552 || strcmp(tochar8(outbuf), "window=17\n")
553 || (optflags(o_window) & OPT_SET) == 0)
554 {
555 printf("\ttrouble with number options\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
556 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
557 }
558
559 return passed;
560 }
561
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
562 ELVBOOL session(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
563 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
564 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
565 BLK *super;
566 BLKNO blkno1, blkno2;
567
568 /* open the session file */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
569 sesopen(ElvFalse);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
570
571 /* see if we can read the superblock */
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
572 blkno1 = seslock(0, ElvTrue, SES_SUPER);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
573 if (blkno1 != 0)
574 {
575 printf("\tseslock(0, ...) returned %d (expect 0)\n", blkno1);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
576 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
577 }
578 super = sesblk(blkno1);
579 if (super->super.magic != SESSION_MAGIC)
580 {
581 printf("\tbad magic\n");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
582 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
583 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
584 sesunlock(0, ElvTrue);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
585
586 /* allocate another block */
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
587 blkno1 = sesalloc(0, SES_CHARS);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
588 if (blkno1 != 1)
589 {
590 printf("\tbad allocation of first block -- got %d (expect 1)\n", blkno1);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
591 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
592 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
593 blkno1 = seslock(blkno1, ElvTrue, SES_CHARS);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
594 if (blkno1 != 1)
595 {
596 printf("\tcopy-on-write when not necessary -- got %d (expect 1)\n", blkno1);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
597 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
598 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
599 sesunlock(blkno1, ElvFalse);
8d1ac0c1 »
2011-12-10 Import Elvis 2.1 (written by Steve Kirkendall)
600 blkno2 = sesalloc(blkno1, SES_CHARS);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
601 if (blkno2 != 1)
602 {
603 printf("\tsesalloc of block 1 failed -- got %d (expect 1)\n", blkno2);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
604 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
605 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
606 blkno2 = seslock(blkno2, ElvTrue, SES_CHARS);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
607 if (blkno2 != 2)
608 {
609 printf("\tcopy-on-write when necessary -- got %d (expect 2)\n", blkno2);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
610 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
611 }
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
612 sesunlock(blkno2, ElvFalse);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
613
614 sesclose();
615 remove("verify.elv");
616 return passed;
617 }
618
619
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
620 ELVBOOL lowbuf(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
621 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
622 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
623 BLKNO first, second, third, duped;
624 char text[20];
625 long off;
626 int i;
627
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
628 sesopen(ElvFalse);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
629
630 /* create/destroy/dup test */
631 first = lowalloc("first");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
632 if (first != 1) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
633 second = lowalloc("second");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
634 if (second != 2) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
635 third = lowalloc("third");
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
636 if (third != 3) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
637 lowfree(second);
638 duped = lowdup(first);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
639 if (duped != 2) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
640
641 /* insertion test */
642 for (i = 0, off = 0; i < 10000; i++)
643 {
644 sprintf(text, "line A%d\n", i);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
645 if (lowinsert(third, off, (CHAR *)text, strlen(text)) != 1) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
646 off += strlen(text);
647 sessync();
648 }
649 for (i = 0; i < 300; i++)
650 {
651 sprintf(text, "line B%d\n", i);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
652 if (lowinsert(third, 0, (CHAR *)text, strlen(text)) != 1) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
653 off += strlen(text);
654 sessync();
655 }
656 for (i = 0; i < 300; i++)
657 {
658 sprintf(text, "line C%d\n", i);
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
659 if (lowinsert(third, o_blkfill, (CHAR *)text, strlen(text)) != 1) passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
660 off += strlen(text);
661 sessync();
662 }
663
664 /* paste test */
665 printf("lowpaste(first, 0, third, 0, %ld) = %ld\n", o_blksize * 2,
666 lowpaste(first, 0, third, 0, o_blksize * 2));
667
668 /* deletion test */
669 printf("lowdelete(third, %ld, %ld) = %ld\n", o_blksize / 2, o_blksize * 5 / 2,
670 lowdelete(third, o_blksize / 2, o_blksize * 5 / 2));
671
672 sesclose();
673 return passed;
674 }
675
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
676 ELVBOOL buffer(void)
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
677 {
678 BUFFER buf;
679 WINDOW win;
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
680 ELVBOOL passed = ElvTrue;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
681 MARKBUF mark;
682 int i;
683
684 o_session = toCHAR("verify.ses");
685 bufinit();
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
686 buf = bufalloc(toCHAR("buffer"), 0, ElvFalse);
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
687 (void)marktmp(mark, buf, 0);
688 for (i = 0; i < 200; i++)
689 {
690 bufreplace(&mark, &mark, toCHAR("This is a test\n"), 15);
691 }
692 if (o_buflines(buf) != 200)
693 {
694 printf("o_buflines(buf) = %ld (expect 200)\n", o_buflines(buf));
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
695 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
696 }
697 if (o_bufchars(buf) != 3000)
698 {
699 printf("o_bufchars(buf) = %ld (expect 3000)\n", o_bufchars(buf));
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
700 passed = ElvFalse;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
701 }
702 win = winalloc(NULL, NULL, buf, 24, 80);
703 while (markoffset(&mark) < o_bufchars(buf))
704 {
705 dmhex.image(win, &mark, (ELVISSTATE)0, drawchar);
706 }
707 sesclose();
708 return passed;
709 }
710
711 /*
712 * End of tests
713 *****************************************************************************
714 * Start of control functions
715 */
716
717 struct
718 {
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
719 ELVBOOL (*func)(void); /* the testing function - TRUE if passed */
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
720 char *label; /* label of the test */
721 char *desc; /* description of the test */
722 } test[] =
723 {
724 { sesmacro, "sesmacro", "Macros in session.h" },
725 { osdir, "osdir", "OS-dependent directory I/O" },
726 { osblock, "osblock", "OS-dependent session file I/O" },
727 { ostext, "ostext", "OS-dependent text file I/O" },
728 { options, "options", "Options" },
729 { session, "session", "low-level session file I/O" },
730 { lowbuf, "lowbuf", "low-level buffer management" },
731 { buffer, "buffer", "high-level buffer management" },
732
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
733 { (ELVBOOL (*)(void))0 }
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
734 };
735
736
737 static void init(void)
738 {
739 setbuf(stdout, NULL);
740 #ifdef OSINIT
741 osinit();
742 #endif
743 optglobinit();
744 }
745
746 int main(int argc, char **argv)
747 {
748 int i, j;
9f1c6f0f »
2011-12-10 Import Elvis 2.2_0 (written by Steve Kirkendall)
749 ELVBOOL passed;
cf92e3be »
2011-12-10 Import Elvis 2.0 (written by Steve Kirkendall)
750
751 /* initialization */
752 init();
753
754 /* for each test... */
755 for (i = 0; test[i].func; i++)
756 {
757 /* skip if not in explicit list */
758 if (argc > 1)
759 {
760 for (j = 1; j < argc && strcmp(argv[j], test[i].label); j++)
761 {
762 }
763 if (j == argc)
764 {
765 continue;
766 }
767 }
768
769 /* perform the test */
770 passed = (*test[i].func)();
771
772 /* report the results */
773 fprintf(stderr, "%s %-10s %s\n", passed ? "PASSED" : "FAILED", test[i].label, test[i].desc);
774 }
775
776 exit(0);
777 /*NOTREACHED*/
778 }
Something went wrong with that request. Please try again.