# This is a collection of code that, at some time in the past, would
# choke Algae.
printf( "Starting the old bugs test...\n" );
assert = strip( function( t ) {
if ( !test(t) ) {
message( "...failed.\a" );
exception();
}
});
# File names were referenced after being deleted.
fn = tmp_file();
fprintf (fn; "%s\n"; "jnk = function () { s = file(); };");
close (fn);
src (fn);
jnk ();
assert (s == fn);
# Labels were being dropped in array division.
assert (((1,2)/label(1,2;1,2)).eid != NULL);
# Surely this one hasn't been there for very long!
assert (function(x){return x.a=1;}(sin));
# Diag didn't check for missing data.
assert (diag (zero (1,6)) == 0);
# Comment on last line caused trouble.
assert (exec ("x=123;\n# OK") == 0);
# Binary write of sparse arrays was hosed.
fn = tmp_file ();
z = zero (1000);
z[12,222] = 3;
fwrite (fn; z; {int});
close (fn);
zz = fread (fn; ; {int});
assert (equal (z; zz));
# Sort labels were temporarily hosed.
v = label (9, 1, 3, 2, 5; 1:5);
assert (equal (sort(v).eid; 2,4,3,5,1));
# NULL members in tables caused trouble.
putmat ({a=NULL}; "/dev/null");
# atanh was fouled up
assert (abs (atanh(.5) - 0.549306144334054891) < 1e-8);
printf( "...passed.\n" );
syntax highlighted by Code2HTML, v. 0.9.1