Mercurial > pytave
annotate __py_tests__.m @ 384:c6e93e7dcfba
Make test suite compatible with Octave 4.2
* __py_tests__.m: Handle old and new forms of the test function to remain
compatible with Octave 4.2.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sun, 02 Apr 2017 15:29:34 -0700 |
parents | d18843ff4dfd |
children | ce61206a61f8 |
rev | line source |
---|---|
383
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2017 Mike Miller |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
2 ## Copyright (C) 2005-2017 David Bateman |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
3 ## |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
4 ## This file is part of Pytave. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
5 ## |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
6 ## Pytave is free software; you can redistribute it and/or modify it |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
7 ## under the terms of the GNU General Public License as published by |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
8 ## the Free Software Foundation; either version 3 of the License, or |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
9 ## (at your option) any later version. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
10 ## |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
11 ## Pytave is distributed in the hope that it will be useful, but |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
14 ## GNU General Public License for more details. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
15 ## |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
16 ## You should have received a copy of the GNU General Public License |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
17 ## along with Pytave; see the file COPYING. If not, see |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
18 ## <http://www.gnu.org/licenses/>. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
19 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
20 ## This is a script file, derived from Octave's __run_test_suite__.m |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
21 true; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
22 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
23 function retval = __run_py_tests__ (varargin) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
24 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
25 files_with_no_tests = {}; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
26 files_with_tests = {}; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
27 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
28 pso = page_screen_output (); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
29 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
30 logfile = make_absolute_filename ("fntests.log"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
31 unwind_protect |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
32 page_screen_output (false); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
33 try |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
34 fid = fopen (logfile, "wt"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
35 if (fid < 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
36 error ("__run_test_suite__: could not open %s for writing", logfile); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
37 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
38 test ("", "explain", fid); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
39 dp = dn = dxf = dsk = drtsk = 0; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
40 puts ("\nIntegrated test scripts:\n\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
41 for i = 1:length (varargin) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
42 f = varargin{i}; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
43 if (has_tests (f)) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
44 print_test_file_name (f); |
384
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
45 if (nargout ("test") < 5) |
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
46 rtsk = 0; |
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
47 [p, n, xf, sk] = test (f, "quiet", fid); |
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
48 else |
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
49 [p, n, xf, sk, rtsk] = test (f, "quiet", fid); |
c6e93e7dcfba
Make test suite compatible with Octave 4.2
Mike Miller <mtmiller@octave.org>
parents:
383
diff
changeset
|
50 endif |
383
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
51 print_pass_fail (p, n, xf, sk, rtsk); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
52 dp += p; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
53 dn += n; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
54 dxf += xf; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
55 dsk += sk; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
56 drtsk += rtsk; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
57 files_with_tests(end+1) = f; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
58 else |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
59 ## To reduce the list length, only mark .cc files that contain |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
60 ## DEFUN definitions. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
61 files_with_no_tests(end+1) = f; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
62 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
63 endfor |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
64 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
65 puts ("\nSummary:\n\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
66 nfail = dn - dp - dxf; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
67 printf (" PASS %6d\n", dp); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
68 printf (" FAIL %6d\n", nfail); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
69 if (dxf > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
70 printf (" XFAIL %6d\n", dxf); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
71 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
72 if (dsk > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
73 printf (" SKIPPED (feature) %6d\n", dsk); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
74 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
75 if (drtsk > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
76 printf (" SKIPPED (run-time condition) %6d\n", drtsk); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
77 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
78 puts ("\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
79 printf ("See the file %s for additional details.\n", logfile); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
80 if (dxf > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
81 puts ("\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
82 puts ("Items listed as XFAIL above are known bugs.\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
83 puts ("Bug report numbers for them may be found in the log file:\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
84 puts (logfile); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
85 puts ("\nPlease help improve Pytave by contributing fixes for them.\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
86 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
87 if (dsk > 0 || drtsk > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
88 puts ("\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
89 puts ("Tests are most often skipped because the features they require\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
90 puts ("have been disabled. Features are most often disabled because\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
91 puts ("they require dependencies that were not present when Octave or\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
92 puts ("Pytave was built.\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
93 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
94 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
95 report_files_with_no_tests (files_with_tests, files_with_no_tests, ".m"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
96 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
97 puts ("\nPlease help improve Pytave by contributing tests for these files\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
98 printf ("(see the list in the file %s).\n\n", logfile); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
99 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
100 fprintf (fid, "\nFiles with no tests:\n\n%s", |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
101 list_in_columns (files_with_no_tests, 80)); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
102 fclose (fid); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
103 catch |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
104 disp (lasterr ()); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
105 end_try_catch |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
106 unwind_protect_cleanup |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
107 page_screen_output (pso); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
108 end_unwind_protect |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
109 retval = (nfail != 0); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
110 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
111 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
112 function print_test_file_name (nm) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
113 filler = repmat (".", 1, 60-length (nm)); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
114 printf (" %s %s", nm, filler); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
115 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
116 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
117 function print_pass_fail (p, n, xf, sk, rtsk) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
118 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
119 if ((n + sk + rtsk) > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
120 printf (" PASS %4d/%-4d", p, n); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
121 nfail = n - p - xf; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
122 if (nfail > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
123 printf ("\n%71s %3d", "FAIL ", nfail); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
124 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
125 if (sk > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
126 printf ("\n%71s %3d", "(missing feature) SKIP ", sk); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
127 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
128 if (rtsk > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
129 printf ("\n%71s %3d", "(run-time condition) SKIP ", rtsk); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
130 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
131 if (xf > 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
132 printf ("\n%71s %3d", "XFAIL", xf); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
133 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
134 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
135 puts ("\n"); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
136 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
137 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
138 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
139 function retval = has_tests (f) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
140 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
141 fid = fopen (f); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
142 if (fid < 0) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
143 error ("__run_test_suite__: fopen failed: %s", f); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
144 endif |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
145 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
146 str = fread (fid, "*char")'; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
147 fclose (fid); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
148 retval = ! isempty (regexp (str, |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
149 '^%!(assert|error|fail|test|xtest|warning)', |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
150 'lineanchors', 'once')); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
151 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
152 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
153 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
154 function n = num_elts_matching_pattern (lst, pat) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
155 n = sum (! cellfun ("isempty", regexp (lst, pat, 'once'))); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
156 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
157 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
158 function report_files_with_no_tests (with, without, typ) |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
159 pat = ['\' typ "$"]; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
160 n_with = num_elts_matching_pattern (with, pat); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
161 n_without = num_elts_matching_pattern (without, pat); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
162 n_tot = n_with + n_without; |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
163 printf ("\n%d (of %d) %s files have no tests.\n", n_without, n_tot, typ); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
164 endfunction |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
165 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
166 exit (__run_py_tests__ (argv (){:})); |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
167 |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
168 ## Mark this file as fully tested. |
d18843ff4dfd
Rewrite the test suite to run Octave-style built-in tests
Mike Miller <mtmiller@octave.org>
parents:
diff
changeset
|
169 %!assert (1) |