/usr/share/freemat/toolbox/util/wbgentests.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | % update a testmatrix with a fieldname
function wbgentests(fname,fieldname,funcname)
% Load the test inputs
fprintf('loading %s..\n',fname);
load(fname)
fprintf('done\n');
if (exist('funcname'))
func_only = true;
else
func_only = false;
end
for ndx=1:size(recs,1)
if (rem(ndx,1000)==0)
fprintf('Processing test record %d of %d...\r',ndx,size(recs,1));
end
rec = recs{ndx};
error_flag = 0;
if (~func_only || strstr(rec.expr,funcname))
if (numel(rec.inputs) > 0)
x1 = inputs{rec.inputs(1)};
end
if (numel(rec.inputs) > 1)
x2 = inputs{rec.inputs(2)};
end
eval([rec.expr,';'],'error_flag = 1;');
evt.success = error_flag;
if (error_flag == 0)
if (rec.out_count == 1)
outpod = {y1};
elseif (rec.out_count == 2)
outpod = {y1,y2};
elseif (rec.out_count == 3)
outpod = {y1,y2,y3};
elseif (rec.out_count == 4)
outpod = {y1,y2,y3,y4};
elseif (rec.out_count == 5)
outpod = {y1,y2,y3,y4,y5};
else
outpod = {};
end
evt.result = outpod;
end
rec.(fieldname) = evt;
recs{ndx} = rec;
else
recs{ndx} = rec;
end
end
fprintf('\nsaving %s...\n',fname);
save(fname,'recs','inputs');
fprintf('done\n');
|