58 |
|
|
59 |
/* test readln() */ |
/* test readln() */ |
60 |
|
|
61 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
62 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
63 |
fclose(infile); |
fclose(infile); |
64 |
infile = redirect_stdin(infilename); |
infile = redirect_redirectstdin(infilename); |
65 |
CU_TEST(-1 == readln(NULL, STR_LEN)); /* NULL str */ |
CU_TEST(-1 == readln(NULL, STR_LEN)); /* NULL str */ |
66 |
rewind(infile); |
rewind(infile); |
67 |
CU_TEST(0 == readln(str1, 0)); /* max = 0 */ |
CU_TEST(0 == readln(str1, 0)); /* max = 0 */ |
72 |
else { |
else { |
73 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
74 |
} |
} |
75 |
|
#endif |
76 |
|
|
77 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
78 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
79 |
snprintf(str2, STR_LEN, "This is the string we expect back from readln()?\n"); |
snprintf(str2, STR_LEN, "This is the string we expect back from readln()?\n"); |
80 |
fputs(str2, infile); |
fputs(str2, infile); |
91 |
else { |
else { |
92 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
93 |
} |
} |
94 |
|
#endif |
95 |
|
|
96 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
97 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
98 |
snprintf(str2, STR_LEN, "\nThis is the string we expect back from readln()?\n"); |
snprintf(str2, STR_LEN, "\nThis is the string we expect back from readln()?\n"); |
99 |
fputs(str2, infile); |
fputs(str2, infile); |
110 |
else { |
else { |
111 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
112 |
} |
} |
113 |
|
#endif |
114 |
|
|
115 |
/* test freadln() */ |
/* test freadln() */ |
116 |
|
|
160 |
|
|
161 |
/* test areadln() */ |
/* test areadln() */ |
162 |
|
|
163 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
164 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
165 |
fclose(infile); |
fclose(infile); |
166 |
infile = redirect_stdin(infilename); |
infile = redirect_stdin(infilename); |
173 |
else { |
else { |
174 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
175 |
} |
} |
176 |
|
#endif |
177 |
|
|
178 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
179 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
180 |
snprintf(str2, STR_LEN, "This is the string we expect back from areadln()?\n"); |
snprintf(str2, STR_LEN, "This is the string we expect back from areadln()?\n"); |
181 |
fputs(str2, infile); |
fputs(str2, infile); |
192 |
else { |
else { |
193 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
194 |
} |
} |
195 |
|
#endif |
196 |
|
|
197 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
198 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
199 |
snprintf(str2, STR_LEN, "\nThis is the string we expect back from areadln()?\n"); |
snprintf(str2, STR_LEN, "\nThis is the string we expect back from areadln()?\n"); |
200 |
fputs(str2, infile); |
fputs(str2, infile); |
216 |
else { |
else { |
217 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
218 |
} |
} |
219 |
|
#endif |
220 |
|
|
221 |
/* test afreadln() */ |
/* test afreadln() */ |
222 |
|
|
269 |
|
|
270 |
/* test readlong() */ |
/* test readlong() */ |
271 |
|
|
272 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
273 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
274 |
fclose(infile); |
fclose(infile); |
275 |
infile = redirect_stdin(infilename); |
infile = redirect_stdin(infilename); |
280 |
else { |
else { |
281 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
282 |
} |
} |
283 |
|
#endif |
284 |
|
|
285 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
286 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
287 |
snprintf(str2, STR_LEN, "98765This is the string we expect back from areadln()?\n"); |
snprintf(str2, STR_LEN, "98765This is the string we expect back from areadln()?\n"); |
288 |
fputs(str2, infile); |
fputs(str2, infile); |
295 |
else { |
else { |
296 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
297 |
} |
} |
298 |
|
#endif |
299 |
|
|
300 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
301 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
302 |
snprintf(str2, STR_LEN, "\n-837\n"); |
snprintf(str2, STR_LEN, "\n-837\n"); |
303 |
fputs(str2, infile); |
fputs(str2, infile); |
312 |
else { |
else { |
313 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
314 |
} |
} |
315 |
|
#endif |
316 |
|
|
317 |
/* test readdouble() */ |
/* test readdouble() */ |
318 |
|
|
319 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
320 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
321 |
fclose(infile); |
fclose(infile); |
322 |
infile = redirect_stdin(infilename); |
infile = redirect_stdin(infilename); |
327 |
else { |
else { |
328 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
329 |
} |
} |
330 |
|
#endif |
331 |
|
|
332 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
333 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
334 |
snprintf(str2, STR_LEN, "-3.5670384e199This is the string we expect back from areadln()?\n"); |
snprintf(str2, STR_LEN, "-3.5670384e199This is the string we expect back from areadln()?\n"); |
335 |
fputs(str2, infile); |
fputs(str2, infile); |
342 |
else { |
else { |
343 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
344 |
} |
} |
345 |
|
#endif |
346 |
|
|
347 |
|
#if 0 /* removing support for stream redirection (too confusing) */ |
348 |
if (NULL != (infile = fopen(infilename, "w"))) { |
if (NULL != (infile = fopen(infilename, "w"))) { |
349 |
snprintf(str2, STR_LEN, "\n-642542146Good bye!\n"); |
snprintf(str2, STR_LEN, "\n-642542146Good bye!\n"); |
350 |
fputs(str2, infile); |
fputs(str2, infile); |
359 |
else { |
else { |
360 |
CU_FAIL("Output file could not be opened in test_readln()."); |
CU_FAIL("Output file could not be opened in test_readln()."); |
361 |
} |
} |
362 |
|
#endif |
363 |
|
|
364 |
if (TRUE == i_enabled_printing) { |
if (TRUE == i_enabled_printing) { |
365 |
test_disable_printing(); |
test_disable_printing(); |