Fix loop count parsing.
[octave.git] / run-tests.m
1 #!/usr/bin/octave --silent
2 #
3 # You'll need to use the .octaverc in this directory to get the proper
4 # paths. You can pass it an integer on the command-line to specify how
5 # many times we should run the test suite in succession. The default
6 # is 1.
7 #
8
9 addpath('./unit_test');
10
11 global unittest_results;
12
13 unit_init(1, {});
14
15 test_files = glob('tests/*.m');
16
17 loop_count = 1;
18 arg_list = argv();
19 if (length(arg_list) > 0)
20 loop_count = str2num(arg_list{1});
21 end
22
23 ## Source every file that matches the glob above.
24 for idx = [ 1 : loop_count ]
25 cellfun(@source, test_files);
26 end
27
28
29 fprintf('\n');
30 fprintf('Total tests attempted: %d\n', unittest_results.total);
31 fprintf('Total tests passed: %d\n', unittest_results.pass);
32 fprintf('Total tests failed: %d\n', unittest_results.fail);