Mercurial > hg > octave-lyh
comparison scripts/testfun/test.m @ 5908:9c134531c2c4
[project @ 2006-07-27 17:14:24 by jwe]
author | jwe |
---|---|
date | Thu, 27 Jul 2006 17:16:14 +0000 |
parents | c86a550a91c0 |
children | 500d884ae373 |
comparison
equal
deleted
inserted
replaced
5907:288c341438f9 | 5908:9c134531c2c4 |
---|---|
103 __fid = fopen(__fid, "wt"); | 103 __fid = fopen(__fid, "wt"); |
104 if __fid < 0, error("could not open log file"); endif | 104 if __fid < 0, error("could not open log file"); endif |
105 __close_fid = 1; | 105 __close_fid = 1; |
106 endif | 106 endif |
107 fprintf (__fid, "%sprocessing %s\n", __signal_file, __name); | 107 fprintf (__fid, "%sprocessing %s\n", __signal_file, __name); |
108 fflush (__fid); | |
108 else | 109 else |
109 __fid = stdout; | 110 __fid = stdout; |
110 endif | 111 endif |
111 | 112 |
112 if (strcmp(__flag, "normal")) | 113 if (strcmp(__flag, "normal")) |
135 fprintf (__fid, "# Search for the unexpected results in the file\n"); | 136 fprintf (__fid, "# Search for the unexpected results in the file\n"); |
136 fprintf (__fid, "# then page back to find the file name which caused it.\n"); | 137 fprintf (__fid, "# then page back to find the file name which caused it.\n"); |
137 fprintf (__fid, "# The result may be an unexpected failure (in which\n"); | 138 fprintf (__fid, "# The result may be an unexpected failure (in which\n"); |
138 fprintf (__fid, "# case an error will be reported) or an unexpected\n"); | 139 fprintf (__fid, "# case an error will be reported) or an unexpected\n"); |
139 fprintf (__fid, "# success (in which case no error will be reported).\n"); | 140 fprintf (__fid, "# success (in which case no error will be reported).\n"); |
141 fflush (__fid); | |
140 if (__close_fid) fclose(__fid); endif | 142 if (__close_fid) fclose(__fid); endif |
141 return; | 143 return; |
142 else | 144 else |
143 error("test unknown flag '%s'", __flag); | 145 error("test unknown flag '%s'", __flag); |
144 endif | 146 endif |
155 if (__grabdemo) | 157 if (__grabdemo) |
156 __ret1 = ""; | 158 __ret1 = ""; |
157 __ret2 = []; | 159 __ret2 = []; |
158 else | 160 else |
159 fprintf(__fid, "%s%s does not exist in path\n", __signal_empty, __name); | 161 fprintf(__fid, "%s%s does not exist in path\n", __signal_empty, __name); |
162 fflush (__fid); | |
160 if (nargout > 0) __ret1 = __ret2 = 0; endif | 163 if (nargout > 0) __ret1 = __ret2 = 0; endif |
161 endif | 164 endif |
162 if (__close_fid) fclose(__fid); endif | 165 if (__close_fid) fclose(__fid); endif |
163 return; | 166 return; |
164 endif | 167 endif |
170 if (__grabdemo) | 173 if (__grabdemo) |
171 __ret1 = ""; | 174 __ret1 = ""; |
172 __ret2 = []; | 175 __ret2 = []; |
173 else | 176 else |
174 fprintf(__fid, "%s%s has no tests available\n", __signal_empty, __file); | 177 fprintf(__fid, "%s%s has no tests available\n", __signal_empty, __file); |
178 fflush (__fid); | |
175 if (nargout > 0) __ret1 = __ret2 = 0; endif | 179 if (nargout > 0) __ret1 = __ret2 = 0; endif |
176 endif | 180 endif |
177 if (__close_fid) fclose(__fid); endif | 181 if (__close_fid) fclose(__fid); endif |
178 return; | 182 return; |
179 else | 183 else |
208 __block = __body(__blockidx(__i):__blockidx(__i+1)-2); | 212 __block = __body(__blockidx(__i):__blockidx(__i+1)-2); |
209 | 213 |
210 ## let the user/logfile know what is happening | 214 ## let the user/logfile know what is happening |
211 if (__verbose) | 215 if (__verbose) |
212 fprintf (__fid, "%s%s\n", __signal_block, __block); | 216 fprintf (__fid, "%s%s\n", __signal_block, __block); |
217 fflush (__fid); | |
213 endif | 218 endif |
214 | 219 |
215 ## split __block into __type and __code | 220 ## split __block into __type and __code |
216 __idx = find(!isletter(__block)); | 221 __idx = find(!isletter(__block)); |
217 if (isempty(__idx)) | 222 if (isempty(__idx)) |
422 ## All done. Remember if we were successful and print any messages | 427 ## All done. Remember if we were successful and print any messages |
423 if (!isempty(__msg)) | 428 if (!isempty(__msg)) |
424 ## make sure the user knows what caused the error | 429 ## make sure the user knows what caused the error |
425 if (!__verbose) | 430 if (!__verbose) |
426 fprintf (__fid, "%s%s\n", __signal_block, __block); | 431 fprintf (__fid, "%s%s\n", __signal_block, __block); |
432 fflush (__fid); | |
427 endif | 433 endif |
428 fputs (__fid, __msg); | 434 fputs (__fid, __msg); |
435 fflush (__fid); | |
429 ## show the variable context | 436 ## show the variable context |
430 if !strcmp(__type, "error") && !all(__shared==" ") | 437 if (!strcmp(__type, "error") && !all(__shared==" ")) |
431 fputs(__fid, "shared variables "); | 438 fputs(__fid, "shared variables "); |
432 eval (sprintf("fdisp(__fid,bundle(%s));", __shared)); | 439 eval (sprintf("fdisp(__fid,bundle(%s));", __shared)); |
440 fflush (__fid); | |
433 endif | 441 endif |
434 endif | 442 endif |
435 if (__success == 0) | 443 if (__success == 0) |
436 __all_success = 0; | 444 __all_success = 0; |
437 ## stop after one error if not in batch mode | 445 ## stop after one error if not in batch mode |