/[ascend]/trunk/base/generic/utilities/test/test_readln.c
ViewVC logotype

Diff of /trunk/base/generic/utilities/test/test_readln.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 955 by johnpye, Fri Mar 31 08:52:57 2006 UTC revision 956 by johnpye, Sat Dec 9 15:38:05 2006 UTC
# Line 58  static void test_readln(void) Line 58  static void test_readln(void)
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 */
# Line 71  static void test_readln(void) Line 72  static void test_readln(void)
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);
# Line 88  static void test_readln(void) Line 91  static void test_readln(void)
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);
# Line 105  static void test_readln(void) Line 110  static void test_readln(void)
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    
# Line 154  static void test_readln(void) Line 160  static void test_readln(void)
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);
# Line 166  static void test_readln(void) Line 173  static void test_readln(void)
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);
# Line 183  static void test_readln(void) Line 192  static void test_readln(void)
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);
# Line 205  static void test_readln(void) Line 216  static void test_readln(void)
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    
# Line 257  static void test_readln(void) Line 269  static void test_readln(void)
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);
# Line 267  static void test_readln(void) Line 280  static void test_readln(void)
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);
# Line 280  static void test_readln(void) Line 295  static void test_readln(void)
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);
# Line 295  static void test_readln(void) Line 312  static void test_readln(void)
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);
# Line 308  static void test_readln(void) Line 327  static void test_readln(void)
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);
# Line 321  static void test_readln(void) Line 342  static void test_readln(void)
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);
# Line 336  static void test_readln(void) Line 359  static void test_readln(void)
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();

Legend:
Removed from v.955  
changed lines
  Added in v.956

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22