annotate test/prefer.tst @ 31214:19bd1953fc1d stable

GitHub-CI: Remove ubuntu-18.04 runners from build matrix. * .github/workflow/make.yaml (ubuntu): GitHub-hosted runners for ubuntu-18.04 are being deprecated. Remove them from build matrix. See also: https://github.com/actions/runner-images/issues/6002
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 30 Aug 2022 11:16:27 +0200
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2006-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26596
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
7 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
8 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
19 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
20 ## You should have received a copy of the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5794
diff changeset
25
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
26 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
27 %! m = [3 2];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
28 %! assert (all (m == (3:-1:2)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
29
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
30 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
31 %! m = [3,
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
32 %! 2];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
33 %! assert (all (m == (3:-1:2)'));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
34
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
35 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
36 %! a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
37 %! assert ([a - 1], 1);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
38
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
39 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
40 %! m = [3,2];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
41 %! fail ("[m ']");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
42
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
43 %!assert (all ([3 2] == (3:-1:2)))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
44
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
45 %!assert (all ([3, 2] == (3:-1:2)))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
46
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
47 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
48 %! m = [3,2];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
49 %! assert (all ([m (1)] == (3:-1:1)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
50
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
51 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
52 %! m = [3,2];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
53 %! assert ([m(1)],3);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
54
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
55 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
56 %! a = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
57 %! assert ([a- 1], 1);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
58
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
59 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
60 %! a = 1;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
61 %! assert (all ([a -1] == (1:-2:-1)));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
62
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
63 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
64 %! wsn = warning ("query", "Octave:str-to-num");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
65 %! warning ("off", "Octave:str-to-num");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
66 %! assert ("d" + 0, 100);
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
67 %! warning (wsn.state, "Octave:str-to-num");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
68
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
69 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
70 %! wsn = warning ("query", "Octave:str-to-num");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
71 %! warning ("on", "Octave:str-to-num");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
72 %! fail ("'d' + 0", "warning");
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
73 %! warning (wsn.state, "Octave:str-to-num");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
74
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
75 %!test
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
76 %! wir = warning ("query", "Octave:imag-to-real");
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
77 %! warning ("off", "Octave:imag-to-real");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
78 %! assert (eye (1+i), 1);
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
79 %! warning (wir.state, "Octave:imag-to-real");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
80
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
81 %!test
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
82 %! wir = warning ("query", "Octave:imag-to-real");
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
83 %! warning ("on", "Octave:imag-to-real");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
84 %! fail ("eye (1+i)", "warning");
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
85 %! warning (wir.state, "Octave:imag-to-real");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
86
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
87 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
88 %! wrre = warning ("query", "Octave:resize-on-range-error");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
89 %! warning ("off", "Octave:resize-on-range-error");
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
90 %! clear a;
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
91 %! a(2) = 1; a(3) = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
92 %! assert (all (a == [0,1,2]));
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
93 %! warning (wrre.state, "Octave:resize-on-range-error");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
94
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
95 %!test
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
96 %! clear a;
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
97 %! a(1) = 1; a(2) = 2;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
98 %! assert (all (a == [1,2]));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
99
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
100 %!test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
101 %! ped = print_empty_dimensions ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
102 %! print_empty_dimensions (0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
103 %! a = cell (1, 1);
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8583
diff changeset
104 %! b = type ("-q", "a");
25760
2ccad4396afc findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents: 25054
diff changeset
105 %! assert (! isempty (strfind (b{1}, "[]")));
2ccad4396afc findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents: 25054
diff changeset
106 %! assert (isempty (strfind (b{1} ,"[](0x0)")));
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
107 %! print_empty_dimensions (ped);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
108
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
109 %!test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
110 %! ped = print_empty_dimensions ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
111 %! print_empty_dimensions (1);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
112 %! a = cell (1, 1);
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8583
diff changeset
113 %! b = type ("-q", "a");
25760
2ccad4396afc findstr.m: Make m-file a legacy function.
Rik <rik@octave.org>
parents: 25054
diff changeset
114 %! assert (! isempty (strfind (b{1}, "[](0x0)")));
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
115 %! print_empty_dimensions (ped);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
116
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
117 %!assert (all (size (inv ([])) == [0, 0]))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
118
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
119 %!assert (all (svd ([]) == zeros (0, 1)))
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
120
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
121 %!test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
122 %! sp = save_precision ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
123 %! save_precision (1);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
124 %! x = pi;
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19022
diff changeset
125 %! nm = tempname ();
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
126 %! save ("-text", nm, "x");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
127 %! clear x;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
128 %! load (nm);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
129 %! unlink (nm);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
130 %! assert (x,3);
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
131 %! save_precision (sp);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
132
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
133 %!test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
134 %! sp = save_precision ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
135 %! save_precision (5);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
136 %! x = pi;
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 19022
diff changeset
137 %! nm = tempname ();
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16030
diff changeset
138 %! save ("-text", nm, "x");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
139 %! clear x;
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
140 %! load (nm);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
141 %! unlink (nm);
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
142 %! assert (x, 3.1416);
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
143 %! save_precision (sp);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
144
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
145 %% FIXME: How to capture standard output for comparison?
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
146 %!function f ()
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
147 %! 1
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
148 %!endfunction
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
149 %!#test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
150 %! sf = silent_functions ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
151 %! silent_functions (0);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
152 %! f
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
153 %! assert (??);
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
154 %! silent_functions (sf);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
155
16215
6fe6ac8bbfdb test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents: 16213
diff changeset
156 %% FIXME: Same problem as above!!!
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
157 %!function f ()
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
158 %! 1
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
159 %!endfunction
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
160 %!#test
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
161 %! sf = silent_functions ();
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
162 %! silent_functions (1);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
163 %! f
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
164 %! assert (??);
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5781
diff changeset
165 %! silent_functions (sf);
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
166
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
167 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
168 %! wndz = warning ("query", "Octave:neg-dim-as-zero");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
169 %! warning ("on", "Octave:neg-dim-as-zero");
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
170 %! fail ("eye (-1) == []", "warning", "converting negative dimension");
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
171 %! warning (wndz.state, "Octave:neg-dim-as-zero");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
172
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
173 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
174 %! wndz = warning ("query", "Octave:neg-dim-as-zero");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
175 %! warning ("off", "Octave:neg-dim-as-zero");
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
176 %! assert (all (size (eye (-1)) == [0, 0]));
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
177 %! warning (wndz.state, "Octave:neg-dim-as-zero");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
178
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
179 %!test
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
180 %! watv = warning ("query", "Octave:assign-as-truth-value");
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
181 %! warning ("on", "Octave:assign-as-truth-value");
19022
cf24eef5051d prefer.tst: Fix typo "Ocave" warning ID.
Rik <rik@octave.org>
parents: 17744
diff changeset
182 %! fail ("if (x = 1) 1; endif", "warning", "assignment used as truth value");
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
183 %! warning (watv.state, "Octave:assign-as-truth-value");
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
184
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
185 %!test
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
186 %! assert (isinf (1/0));
5590
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
187
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
188 %!test
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
189 %! a = 1;
1ad66ea35fe5 [project @ 2006-01-06 00:24:05 by jwe]
jwe
parents:
diff changeset
190 %! b = 0;
26596
cc0d942d0e20 Remove inconsistent warning "Octave:divide-by-zero" (bug #46650).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
191 %! assert (isinf (a/b));