X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=run-tests.m;h=9d0e7fa03ba48af8a5d619e4553e8f15077684b6;hp=ef72b10731fecb8f6f324d4b25150153140af948;hb=0c265577029ccdc5a232de637a557c304d1ace71;hpb=62d652799ded51169bda744d8728e1d33582fa5f diff --git a/run-tests.m b/run-tests.m index ef72b10..9d0e7fa 100755 --- a/run-tests.m +++ b/run-tests.m @@ -1,15 +1,32 @@ #!/usr/bin/octave --silent +# +# You'll need to use the .octaverc in this directory to get the proper +# paths. You can pass it an integer on the command-line to specify how +# many times we should run the test suite in succession. The default +# is 1. +# + +addpath('./unit_test'); + +global unittest_results; unit_init(1, {}); -unit_test_equals("sin[0] == 0", ... - 0, ... - divided_difference(@sin, 0)); +test_files = glob('tests/*.m'); + +loop_count = 1; +arg_list = argv(); +if (length(arg_list) > 0) + loop_count = str2num(arg_list{1}); +end + +## Source every file that matches the glob above. +for idx = [ 1 : loop_count ] + cellfun(@source, test_files); +end -unit_test_equals("sin[0, pi] == 0", ... - 0, ... - divided_difference(@sin, [0,pi])); -unit_test_equals("sin[0, pi, 2*pi] == 0", ... - 0, ... - divided_difference(@sin, [0,pi,2*pi])); +fprintf('\n'); +fprintf('Total tests attempted: %d\n', unittest_results.total); +fprintf('Total tests passed: %d\n', unittest_results.pass); +fprintf('Total tests failed: %d\n', unittest_results.fail);