comparison scripts/testfun/test.m @ 7540:3422f39573b1

strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
author Ben Abbott <bpabbott@mac.com>
date Thu, 28 Feb 2008 02:41:19 -0500
parents 5a9561046b89
children 1bfb88e78027
comparison
equal deleted inserted replaced
7539:3e107d73aeb4 7540:3422f39573b1
155 endif 155 endif
156 156
157 ## locate the file to test 157 ## locate the file to test
158 __file = file_in_loadpath (__name, "all"); 158 __file = file_in_loadpath (__name, "all");
159 if (isempty (__file)) 159 if (isempty (__file))
160 __file = file_in_loadpath (strcat (__name, ".m"), "all"); 160 __file = file_in_loadpath (cstrcat (__name, ".m"), "all");
161 endif 161 endif
162 if (isempty (__file)) 162 if (isempty (__file))
163 __file = file_in_loadpath (strcat (__name, ".cc"), "all"); 163 __file = file_in_loadpath (cstrcat (__name, ".cc"), "all");
164 endif 164 endif
165 if (iscell (__file)) 165 if (iscell (__file))
166 ## If repeats, return first in path. 166 ## If repeats, return first in path.
167 if (isempty (__file)) 167 if (isempty (__file))
168 __file = ""; 168 __file = "";
218 __lineidx = find (__body == "\n"); 218 __lineidx = find (__body == "\n");
219 __blockidx = __lineidx(find (! isspace (__body(__lineidx+1))))+1; 219 __blockidx = __lineidx(find (! isspace (__body(__lineidx+1))))+1;
220 220
221 ## ready to start tests ... if in batch mode, tell us what is happening 221 ## ready to start tests ... if in batch mode, tell us what is happening
222 if (__verbose) 222 if (__verbose)
223 disp (strcat ( __signal_file, __file)); 223 disp (cstrcat ( __signal_file, __file));
224 endif 224 endif
225 225
226 ## assume all tests will pass 226 ## assume all tests will pass
227 __all_success = 1; 227 __all_success = 1;
228 228
268 if (__grabdemo && __isdemo) 268 if (__grabdemo && __isdemo)
269 if (isempty(__demo_code)) 269 if (isempty(__demo_code))
270 __demo_code = __code; 270 __demo_code = __code;
271 __demo_idx = [1, length(__demo_code)+1]; 271 __demo_idx = [1, length(__demo_code)+1];
272 else 272 else
273 __demo_code = strcat(__demo_code, __code); 273 __demo_code = cstrcat(__demo_code, __code);
274 __demo_idx = [__demo_idx, length(__demo_code)+1]; 274 __demo_idx = [__demo_idx, length(__demo_code)+1];
275 endif 275 endif
276 276
277 elseif (__rundemo && __isdemo) 277 elseif (__rundemo && __isdemo)
278 try 278 try
311 311
312 ## assign default values to variables 312 ## assign default values to variables
313 try 313 try
314 __vars = deblank (__vars); 314 __vars = deblank (__vars);
315 if (! isempty (__vars)) 315 if (! isempty (__vars))
316 eval (strcat (strrep (__vars, ",", "=[];"), "=[];")); 316 eval (cstrcat (strrep (__vars, ",", "=[];"), "=[];"));
317 __shared = __vars; 317 __shared = __vars;
318 __shared_r = strcat ("[ ", __vars, "] = "); 318 __shared_r = cstrcat ("[ ", __vars, "] = ");
319 else 319 else
320 __shared = " "; 320 __shared = " ";
321 __shared_r = " "; 321 __shared_r = " ";
322 endif 322 endif
323 catch 323 catch
572 endif 572 endif
573 endfunction 573 endfunction
574 574
575 ## strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks 575 ## strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks
576 function msg = trimerr (msg, prefix) 576 function msg = trimerr (msg, prefix)
577 idx = index (msg, strcat (prefix, ":")); 577 idx = index (msg, cstrcat (prefix, ":"));
578 if (idx > 0) 578 if (idx > 0)
579 msg(1:idx+length(prefix)) = []; 579 msg(1:idx+length(prefix)) = [];
580 endif 580 endif
581 msg = trimleft (deblank (msg)); 581 msg = trimleft (deblank (msg));
582 endfunction 582 endfunction
605 while (! feof (fid)) 605 while (! feof (fid))
606 ln = fgetl (fid); 606 ln = fgetl (fid);
607 if (length (ln) >= 2 && strcmp (ln(1:2), "%!")) 607 if (length (ln) >= 2 && strcmp (ln(1:2), "%!"))
608 body = [body, "\n"]; 608 body = [body, "\n"];
609 if (length(ln) > 2) 609 if (length(ln) > 2)
610 body = strcat (body, ln(3:end)); 610 body = cstrcat (body, ln(3:end));
611 endif 611 endif
612 endif 612 endif
613 endwhile 613 endwhile
614 fclose (fid); 614 fclose (fid);
615 endif 615 endif