io.write('Testing readlib\'ing all C and Agena packages for ' & os.system()[1] & ' ...\n\n');

readlib('ads');
readlib('astro');
readlib('bags');
readlib('bloom');
readlib('calc');
readlib('clock');
readlib('divs');
readlib('hashes');
readlib('linalg');
readlib('llist');
readlib('mapm');
readlib('numarray');
readlib('stats');
readlib('skycrane');
readlib('tar');
readlib('xbase');
readlib('zx');
readlib('bloom');
readlib('factory');

if os.system()[1] in {'SunOS', 'Windows', 'Linux', 'Darwin'} then
   readlib('fractals');
   readlib('gdi');
   readlib('gzip');
   a, b := gzip.deflate('agena programming language');
   if [gzip.inflate(a, b)] <> ['agena programming language', 26] then
      print('error in gzip.in\\deflate')
   fi;
   try  # provoke segfaults
      for i from 0 to 100 do
         gzip.inflate(a, i)
      od
   yrt;
   to 100 do readlib('net') od  # try crashing Agena at exit
   readlib('net');
   readlib('xml')
fi;

if os.isdos() then
   readlib('xml')
fi

# try to crash Agena with new internal parameter handling

to 100 do
   readlib 'stats'
od;

clear a, b, blue, cyan, cyanalex, cyannew, red, violet, white;
