comparison test/test_io.m @ 16019:5b2126a8c84f

install tests and functions to run them * configure.ac (octtestsdir): New variable. * build-aux/common.mk (octtestsdir): New variable. (do_subst_default_vals): Substitute it. (test-file-commands): New macro. (%.cc-tst:%.cc, %.yy-tst:%.yy, %.ll-tst:%.ll): New rules. * libinterp/Makefile.am (TST_FILES_SRC, TST_FILES, libinterptestsdir, nobase_libinterptests_DATA): New variables. * defaults.in.h (OCTAVE_OCTTESTSDIR): New macro. * liboctave/Makefile.am (LIBOCTAVE_TST_SRC, TST_FILES_SRC, TST_FILES, liboctavetestsdir, nobase_liboctavetests_DATA): New variables. * toplev.cc (Foctave_config_info): Include octtestsdir in the struct. * fntests.m: Look in topbuilddir for C++ test files. * __run_test_suite__.m: New function, extracted from test/fntests.m. Look for -tst files, not .cc files. Don't report -tst files that are missing tests (there won't be any). * __prog_output_assert__.m, __printf_assert__.m: New functions, extracted from __run_test_suite__.m and renamed from prog_output_assert and printf_assert. Change all uses. * scripts/testfun/module.mk (testfun_FCN_FILES): Include new files in the list. * test/Makefile.am (GENERATED_BC_OVERLOADS_DIRS, GENERATED_BC_OVERLOADS_FILES, fixedtestsdir, nobase_fixedtests_DATA): New variables. (CLEANFILES): Include $(GENERATED_BC_OVERRLOADS_FILES) in the list. (clean-local): Use $(GENERATED_BC_OVERLOADS_DIRS). * build_bc_overload_tests.sh: New options, --list-files, --list-dirs, and --list-classes. * test/classes/module.mk (classes_FCN_FILES): Include recently added .m files in the list. * test.m: Use "var" argument for exist in tests.
author John W. Eaton <jwe@octave.org>
date Fri, 08 Feb 2013 16:53:14 -0500
parents 757f729fd41d
children
comparison
equal deleted inserted replaced
16018:e0df71fbe39b 16019:5b2126a8c84f
350 %! nm = tmpnam (); 350 %! nm = tmpnam ();
351 %! for k = 1:3 351 %! for k = 1:3
352 %! mode = deblank (mode_list (k,:)); 352 %! mode = deblank (mode_list (k,:));
353 %! [id, err] = fopen (nm, mode, arch); 353 %! [id, err] = fopen (nm, mode, arch);
354 %! if (id < 0) 354 %! if (id < 0)
355 %! printf_assert ("open failed: %s (%s, %s): %s\n", nm, mode, arch, err); 355 %! __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, mode, arch, err);
356 %! status = 0; 356 %! status = 0;
357 %! break; 357 %! break;
358 %! else 358 %! else
359 %! fclose (id); 359 %! fclose (id);
360 %! endif 360 %! endif
361 %! tmp_mode = cstrcat (mode, "b"); 361 %! tmp_mode = cstrcat (mode, "b");
362 %! [id, err] = fopen (nm, tmp_mode, arch); 362 %! [id, err] = fopen (nm, tmp_mode, arch);
363 %! if (id < 0) 363 %! if (id < 0)
364 %! printf_assert ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err); 364 %! __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
365 %! status = 0; 365 %! status = 0;
366 %! break; 366 %! break;
367 %! else 367 %! else
368 %! fclose (id); 368 %! fclose (id);
369 %! endif 369 %! endif
370 %! tmp_mode = cstrcat (mode, "t"); 370 %! tmp_mode = cstrcat (mode, "t");
371 %! [id, err] = fopen (nm, tmp_mode, arch); 371 %! [id, err] = fopen (nm, tmp_mode, arch);
372 %! if (id < 0) 372 %! if (id < 0)
373 %! printf_assert ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err); 373 %! __printf_assert__ ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
374 %! status = 0; 374 %! status = 0;
375 %! break; 375 %! break;
376 %! else 376 %! else
377 %! fclose (id); 377 %! fclose (id);
378 %! endif 378 %! endif
397 %% test/octave.test/io/fopen-3.m 397 %% test/octave.test/io/fopen-3.m
398 %!error fopen ("foo", "x") 398 %!error fopen ("foo", "x")
399 399
400 %% test/octave.test/io/fopen-4.m 400 %% test/octave.test/io/fopen-4.m
401 %! fopen ("foo", "wb", "noodle"); 401 %! fopen ("foo", "wb", "noodle");
402 %! assert (prog_output_assert ("error:")); 402 %! assert (__prog_output_assert__ ("error:"));
403 403
404 %% test/octave.test/io/fopen-5.m 404 %% test/octave.test/io/fopen-5.m
405 %!error <Invalid call to fopen> fopen () 405 %!error <Invalid call to fopen> fopen ()
406 406
407 %% test/octave.test/io/fopen-6.m 407 %% test/octave.test/io/fopen-6.m
450 %! for i = 1:n 450 %! for i = 1:n
451 %! x(i) = fread (id, [1, 1], deblank (type_list(i,:))); 451 %! x(i) = fread (id, [1, 1], deblank (type_list(i,:)));
452 %! endfor 452 %! endfor
453 %! 453 %!
454 %! if (x == 1:n) 454 %! if (x == 1:n)
455 %! printf_assert ("ok\n"); 455 %! __printf_assert__ ("ok\n");
456 %! endif 456 %! endif
457 %! endif 457 %! endif
458 %! endif 458 %! endif
459 %! 459 %!
460 %! unlink (nm); 460 %! unlink (nm);
461 %! assert (prog_output_assert ("ok")); 461 %! assert (__prog_output_assert__ ("ok"));
462 462
463 %% test/octave.test/io/file-pos-1.m 463 %% test/octave.test/io/file-pos-1.m
464 %!test 464 %!test
465 %! nm = tmpnam (); 465 %! nm = tmpnam ();
466 %! id = fopen (nm, "wb"); 466 %! id = fopen (nm, "wb");