1() = evalfile ("./common.sl"); 2 3require ("print"); 4 5private define test_print () 6{ 7 variable x = [1:20:0.1]; 8 variable ref_x, file_x, fp_x; 9 print (x, &ref_x); 10 11 variable file = sprintf ("/tmp/test_print_%X_%d", _time(), getpid()); 12 print (x, file); 13 variable fp = fopen (file, "r"); 14 () = fread_bytes (&file_x, 2*strlen (ref_x), fp); 15 () = fclose (fp); 16 17 fp = fopen (file, "wb"); 18 print (x, fp); 19 () = fclose (fp); 20 fp = fopen (file, "r"); 21 () = fread_bytes (&fp_x, 2*strlen (ref_x), fp); 22 () = fclose (fp); 23 24 () = remove (file); 25 if ((ref_x != file_x) || (ref_x != fp_x)) 26 { 27 failed ("Failed: print failed to produce identical results\n"); 28 } 29} 30 31define slsh_main () 32{ 33 start_test ("print"); 34 test_print (); 35 end_test (); 36} 37 38