annotate test/range.tst @ 30834:f1a9e55d850c stable

for all but range<double>, create arrays instead of range objects * ov.cc (integer_difference, range_numel_aux, range_numel, make_int_range, make_float_range): New functions. (make_char_range): New function, adapted from make_range<char>. (colon_op): Update to use new make_float_range, make_int_range, and make_char_range functions. (make_range<double>, make_range<float>, make_range<char>): Delete. * range.tst: Update tests.
author John W. Eaton <jwe@octave.org>
date Sun, 13 Mar 2022 12:57:22 -0400
parents 796f54d4ddbf
children cb0a54576eb0
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: 30418
diff changeset
3 ## Copyright (C) 2007-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
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: 6938
diff changeset
7 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6938
diff changeset
8 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6938
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: 6938
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: 6938
diff changeset
14 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6938
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: 6938
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: 6938
diff changeset
19 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6938
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: 6938
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: 6938
diff changeset
25
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
26 ## Test values of range
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
27
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
28 %!assert (full (1:9), [ 1 2 3 4 5 6 7 8 9 ])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
29 %!assert (full (1:0.4:3), [ 1.0 1.4 1.8 2.2 2.6 3.0 ])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
30 %!assert (full (9:1), zeros (1,0))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
31 %!assert (full (9:-1:1), [ 9 8 7 6 5 4 3 2 1 ])
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
32 %!assert (full (1:-1:9), zeros (1,0))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
33 %!assert (full (1:1:1), 1)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
34 %!assert (full (i:2i:10i), zeros (1,0))
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
35
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
36 ## Test mixing integer range with other types
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
37
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
38 %!shared expect, r, z
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
39 %! expect = [ 1 2 3 4 5 6 7 8 9
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
40 %! 0 0 0 0 0 0 0 0 0 ];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
41 %! z = zeros (1,9);
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
42 %! r = 1:9;
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
43
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
44 %!assert ([ r ; z ], expect)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
45 %!assert ([ r ; single(z) ], single (expect))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
46 %!assert ([ r ; logical(z) ], expect)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
47 %!assert ([ r ; sparse(z) ], sparse (expect))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
48 %!assert ([ r ; sparse(logical(z)) ], sparse (expect))
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
49
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
50 %!assert ([ r ; int8(z) ], int8 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
51 %!assert ([ r ; int16(z) ], int16 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
52 %!assert ([ r ; int32(z) ], int32 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
53 %!assert ([ r ; int64(z) ], int64 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
54 %!assert ([ r ; uint8(z) ], uint8 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
55 %!assert ([ r ; uint16(z) ], uint16 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
56 %!assert ([ r ; uint32(z) ], uint32 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
57 %!assert ([ r ; uint64(z) ], uint64 (expect))
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
58
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
59 ## Test mixing non-integer range with other types
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
60
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
61 %!shared expect, r, z
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
62 %! expect = [ 1.0 1.4 1.8 2.2 2.6 3.0
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
63 %! 0 0 0 0 0 0 ];
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
64 %! z = zeros (1,6);
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
65 %! r = 1:0.4:3;
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
66
14131
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
67 %!assert ([ r ; z ], expect)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
68 %!assert ([ r ; single(z) ], single (expect))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
69 %!assert ([ r ; logical(z) ], expect)
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
70 %!assert ([ r ; sparse(z) ], sparse (expect))
c3309e1ec50d test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
71 %!assert ([ r ; sparse(logical(z)) ], sparse (expect))
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
72
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
73 %!assert ([ r ; int8(z) ], int8 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
74 %!assert ([ r ; int16(z) ], int16 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
75 %!assert ([ r ; int32(z) ], int32 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
76 %!assert ([ r ; int64(z) ], int64 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
77 %!assert ([ r ; uint8(z) ], uint8 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
78 %!assert ([ r ; uint16(z) ], uint16 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
79 %!assert ([ r ; uint32(z) ], uint32 (expect))
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16179
diff changeset
80 %!assert ([ r ; uint64(z) ], uint64 (expect))
6938
688ef9440022 [project @ 2007-10-01 15:59:33 by dbateman]
dbateman
parents:
diff changeset
81
30142
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
82
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
83
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
84
16169
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
85 ## Test corner cases of ranges (base and limit)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
86
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
87 %!shared r, rrev, rneg
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
88 %! r = -0:3;
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
89 %! rrev = 3:-1:-0;
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
90 %! rneg = -3:-0;
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
91
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
92 %!assert (full (r), [-0 1 2 3])
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
93 %!assert (signbit (full (r)), logical ([1 0 0 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
94 %!assert (r(1), -0)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
95 %!assert (signbit (r(1)), true)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
96 %!assert (signbit (r(1:2)), logical ([1 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
97 %!assert (signbit (r(2:-1:1)), logical ([0 1]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
98 %!assert (signbit (r([2 1 1 3])), logical ([0 1 1 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
99
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
100 %!assert (full (rrev), [3 2 1 -0])
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
101 %!assert (signbit (full (rrev)), logical ([0 0 0 1]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
102 %!assert (rrev(4), -0)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
103 %!assert (signbit (rrev(4)), true)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
104 %!assert (signbit (rrev(3:4)), logical ([0 1]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
105 %!assert (signbit (rrev(4:-1:3)), logical ([1 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
106 %!assert (signbit (rrev([1 4 4 2])), logical ([0 1 1 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
107
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
108 %!assert (min (r), -0)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
109 %!assert (signbit (min (r)), true)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
110 %!assert (min (rrev), -0)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
111 %!assert (signbit (min (rrev)), true)
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
112
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
113 %!assert (max (rneg), -0)
16179
025393bef399 range.tst: Correct typo min -> max in test.
Rik <rik@octave.org>
parents: 16169
diff changeset
114 %!assert (signbit (max (rneg)), true)
16169
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
115
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
116 %!assert (sort (r, "descend"), [3 2 1 -0])
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
117 %!assert (signbit (sort (r, "descend")), logical ([0 0 0 1]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
118 %!assert (signbit (sort (rrev, "ascend")), logical ([1 0 0 0]))
0303fda3e929 Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents: 16030
diff changeset
119
25812
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
120 ## Test mathematical operations (also, non-finite values and 0)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
121 %!shared r
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
122 %! r = 1:5;
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
123
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
124 %!assert (-r, -1:-1:-5)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
125 %!assert (1 + r, 2:6)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
126 %!assert (Inf + r, Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
127 %!assert (NaN + r, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
128 %!assert (r + 1, 2:6)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
129 %!assert (r + Inf, Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
130 %!assert (r + NaN, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
131 %!assert (1 - r, 0:-1:-4)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
132 %!assert (Inf - r, Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
133 %!assert (NaN - r, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
134 %!assert (r - 1, 0:4)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
135 %!assert (r - Inf, -Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
136 %!assert (r - NaN, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
137 %!assert (2 * r, 2:2:10)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
138 %!assert (0 * r, zeros (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
139 %!assert (Inf * r, Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
140 %!assert (NaN * r, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
141 %!assert (r * 2, 2:2:10)
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
142 %!assert (r * 0, zeros (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
143 %!assert (r * Inf, Inf (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
144 %!assert (r * NaN, NaN (1,5))
fc74c8d2a584 Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents: 25808
diff changeset
145
20458
ba032e57fd96 range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents: 19697
diff changeset
146 ## Test sorting of ranges (bug #45739)
ba032e57fd96 range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents: 19697
diff changeset
147 %!shared r, rrev
ba032e57fd96 range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents: 19697
diff changeset
148 %! r = 1:2:10;
ba032e57fd96 range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents: 19697
diff changeset
149 %! rrev = 10:-2:1;
ba032e57fd96 range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents: 19697
diff changeset
150
25808
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
151 %!assert <*45739> (sort (r, "descend"), [9 7 5 3 1])
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
152 %!assert <*45739> (sort (rrev, "ascend"), [2 4 6 8 10])
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
153
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
154 ## Test final value within eps of an integer (bug #46859)
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
155 %!test <*46859>
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
156 %! rng = 1 : (1001/250)/(1/250);
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
157 %! assert (rng(end), 1001);
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
158
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
159 %!test <*46859>
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
160 %! rng = 2000: -1 : (1001/250)/(1/250);
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
161 %! assert (rng(end), 1001);
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
162
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
163 ## This is not Matlab compatible (stops at 1000 with 999 elements)
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
164 ## Octave prefers the more intuitive "pure math" approach where
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
165 ## (1001/250) / (1/250) => (1001/250)*(250/1) => 1001.
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
166 %!test <*46859>
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
167 %! rng = 1 : (1001/250)/(1/250);
dc47c9e48801 Guarantee an integer for max of Range when base and increment are ints (bug #46859).
Rik <rik@octave.org>
parents: 25054
diff changeset
168 %! assert (numel (1000));
29353
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
169
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
170 ## Combinations of exceptional values and a few normal ones.
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
171
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
172 %!shared mt_row, inf, nan, zero, pt3, pt6, pt9, one, epsilon
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
173 %! mt_row = zeros (1, 0, 'double');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
174 %! inf = Inf ('double');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
175 %! nan = NaN ('double');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
176 %! zero = double (0.0);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
177 %! pt3 = double (0.3);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
178 %! pt6 = double (0.6);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
179 %! pt9 = double (0.9);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
180 %! one = double (1.0);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
181 %! epsilon = eps ('double');
29493
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
182 %!assert <*59229> (nan:-pt3:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
183 %!assert <*59229> (nan:-pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
184 %!assert <*59229> (nan:-pt3:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
185 %!assert <*59229> (nan:-pt3:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
186 %!assert <*59229> (nan:-pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
187 %!assert <*59229> (nan:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
188 %!assert <*59229> (nan:-inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
189 %!assert <*59229> (nan:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
190 %!assert <*59229> (nan:-inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
191 %!assert <*59229> (nan:-inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
192 %!assert <*59229> (nan:-inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
193 %!assert <*59229> (nan:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
194 %!assert <*59229> (nan:zero:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
195 %!assert <*59229> (nan:zero:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
196 %!assert <*59229> (nan:zero:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
197 %!assert <*59229> (nan:zero:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
198 %!assert <*59229> (nan:zero:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
199 %!assert <*59229> (nan:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
200 %!assert <*59229> (nan:pt3:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
201 %!assert <*59229> (nan:pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
202 %!assert <*59229> (nan:pt3:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
203 %!assert <*59229> (nan:pt3:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
204 %!assert <*59229> (nan:pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
205 %!assert <*59229> (nan:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
206 %!assert <*59229> (nan:inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
207 %!assert <*59229> (nan:inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
208 %!assert <*59229> (nan:inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
209 %!assert <*59229> (nan:inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
210 %!assert <*59229> (nan:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
211 %!assert <*59229> (nan:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
212 %!assert <*59229> (nan:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
213 %!assert <*59229> (nan:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
214 %!assert <*59229> (nan:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
215 %!assert <*59229> (nan:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
216 %!assert <*59229> (nan:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
217 %!assert <*59229> (nan:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
218 %!assert <*59229> (-inf:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
219 %!assert <*59229> (-inf:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
220 %!assert <*59229> (-inf:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
221 %!assert <*59229> (-inf:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
222 %!assert <*59229> (-inf:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
223 %!assert <*59229> (zero:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
224 %!assert <*59229> (zero:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
225 %!assert <*59229> (zero:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
226 %!assert <*59229> (zero:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
227 %!assert <*59229> (zero:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
228 %!assert <*59229> (inf:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
229 %!assert <*59229> (inf:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
230 %!assert <*59229> (inf:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
231 %!assert <*59229> (inf:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
232 %!assert <*59229> (inf:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
233 %!assert <*59229> (-inf:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
234 %!assert <*59229> (-inf:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
235 %!assert <*59229> (-inf:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
236 %!assert <*59229> (-inf:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
237 %!assert <*59229> (-inf:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
238 %!assert <*59229> (-inf:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
239 %!assert <*59229> (zero:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
240 %!assert <*59229> (zero:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
241 %!assert <*59229> (zero:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
242 %!assert <*59229> (zero:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
243 %!assert <*59229> (zero:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
244 %!assert <*59229> (zero:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
245 %!assert <*59229> (inf:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
246 %!assert <*59229> (inf:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
247 %!assert <*59229> (inf:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
248 %!assert <*59229> (inf:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
249 %!assert <*59229> (inf:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
250 %!assert <*59229> (inf:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
251 %!assert <*59229> (inf:-pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
252 %!assert <*59229> (-inf:-pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
253 %!assert <*59229> (inf:pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
254 %!assert <*59229> (-inf:pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
255 %!assert <*59229> (-inf:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
256 %!assert <*59229> (zero:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
257 %!assert <*59229> (inf:-inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
258 %!assert <*59229> (inf:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
259 %!assert <*59229> (inf:-inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
260 %!assert <*59229> (inf:-inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
261 %!assert <*59229> (inf:-inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
262 %!assert <*59229> (-inf:inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
263 %!assert <*59229> (-inf:inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
264 %!assert <*59229> (-inf:inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
265 %!assert <*59229> (-inf:inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
266 %!assert <*59229> (-inf:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
267 %!assert <*59229> (zero:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
268 %!assert <*59229> (inf:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
269 %!assert <*59229> (zero:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
270 %!assert <*59229> (zero:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
271 %!assert <*59229> (zero:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
272 %!assert <*59229> (zero:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
273 %!assert <*59229> (zero:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
274 %!assert <*59229> (-inf:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
275 %!assert <*59229> (-inf:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
276 %!assert <*59229> (-inf:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
277 %!assert <*59229> (-inf:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
278 %!assert <*59229> (-inf:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
279 %!assert <*59229> (inf:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
280 %!assert <*59229> (inf:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
281 %!assert <*59229> (inf:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
282 %!assert <*59229> (inf:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
283 %!assert <*59229> (inf:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
284 %!assert <*59229> (zero:pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
285 %!assert <*59229> (zero:pt3:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
286 %!assert <*59229> (inf:pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
287 %!assert <*59229> (inf:pt3:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
288 %!assert <*59229> (inf:pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
289 %!assert <*59229> (inf:pt3:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
290 %!assert <*59229> (zero:inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
291 %!assert <*59229> (zero:inf:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
292 %!assert <*59229> (inf:inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
293 %!assert <*59229> (inf:inf:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
294 %!assert <*59229> (inf:inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
295 %!assert <*59229> (inf:inf:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
296 %!assert <*59229> (zero:-pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
297 %!assert <*59229> (zero:-pt3:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
298 %!assert <*59229> (-inf:-pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
299 %!assert <*59229> (-inf:-pt3:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
300 %!assert <*59229> (-inf:-pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
301 %!assert <*59229> (-inf:-pt3:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
302 %!assert <*59229> (zero:-inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
303 %!assert <*59229> (zero:-inf:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
304 %!assert <*59229> (-inf:-inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
305 %!assert <*59229> (-inf:-inf:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
306 %!assert <*59229> (-inf:-inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
307 %!assert <*59229> (-inf:-inf:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
308 %!assert <*59229> (zero:-inf:-one, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
309 %!assert <*59229> (zero:-inf:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
310 %!assert <*59229> (zero:inf:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
311 %!assert <*59229> (zero:inf:one, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
312 %!assert <*59229> (zero:-pt3:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
313 %!assert <*59229> (zero:pt3:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
314 %!assert <*59229> (zero:-pt3:-one, [zero, -pt3, -pt6, -pt9], epsilon)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
315 %!assert <*59229> (zero:pt3:one, [zero, pt3, pt6, pt9], epsilon)
29353
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
316 %!error <range with infinite number of elements cannot be stored> zero:-pt3:-inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
317 %!error <range with infinite number of elements cannot be stored> inf:-pt3:-one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
318 %!error <range with infinite number of elements cannot be stored> inf:-pt3:zero
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
319 %!error <range with infinite number of elements cannot be stored> inf:-pt3:one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
320 %!error <range with infinite number of elements cannot be stored> inf:-pt3:-inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
321 %!error <range with infinite number of elements cannot be stored> zero:pt3:inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
322 %!error <range with infinite number of elements cannot be stored> -inf:pt3:-one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
323 %!error <range with infinite number of elements cannot be stored> -inf:pt3:zero
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
324 %!error <range with infinite number of elements cannot be stored> -inf:pt3:one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
325 %!error <range with infinite number of elements cannot be stored> -inf:pt3:inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
326
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
327 ## Again, this time with singles.
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
328 %!shared mt_row, inf, nan, zero, pt3, pt6, pt9, one, epsilon
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
329 %! mt_row = zeros (1, 0, 'single');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
330 %! inf = Inf ('single');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
331 %! nan = NaN ('single');
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
332 %! zero = single (0.0);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
333 %! pt3 = single (0.3);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
334 %! pt6 = single (0.6);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
335 %! pt9 = single (0.9);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
336 %! one = single (1.0);
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
337 %! epsilon = eps ('single');
29493
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
338 %!assert <*59229> (nan:-pt3:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
339 %!assert <*59229> (nan:-pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
340 %!assert <*59229> (nan:-pt3:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
341 %!assert <*59229> (nan:-pt3:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
342 %!assert <*59229> (nan:-pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
343 %!assert <*59229> (nan:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
344 %!assert <*59229> (nan:-inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
345 %!assert <*59229> (nan:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
346 %!assert <*59229> (nan:-inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
347 %!assert <*59229> (nan:-inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
348 %!assert <*59229> (nan:-inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
349 %!assert <*59229> (nan:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
350 %!assert <*59229> (nan:zero:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
351 %!assert <*59229> (nan:zero:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
352 %!assert <*59229> (nan:zero:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
353 %!assert <*59229> (nan:zero:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
354 %!assert <*59229> (nan:zero:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
355 %!assert <*59229> (nan:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
356 %!assert <*59229> (nan:pt3:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
357 %!assert <*59229> (nan:pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
358 %!assert <*59229> (nan:pt3:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
359 %!assert <*59229> (nan:pt3:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
360 %!assert <*59229> (nan:pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
361 %!assert <*59229> (nan:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
362 %!assert <*59229> (nan:inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
363 %!assert <*59229> (nan:inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
364 %!assert <*59229> (nan:inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
365 %!assert <*59229> (nan:inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
366 %!assert <*59229> (nan:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
367 %!assert <*59229> (nan:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
368 %!assert <*59229> (nan:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
369 %!assert <*59229> (nan:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
370 %!assert <*59229> (nan:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
371 %!assert <*59229> (nan:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
372 %!assert <*59229> (nan:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
373 %!assert <*59229> (nan:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
374 %!assert <*59229> (-inf:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
375 %!assert <*59229> (-inf:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
376 %!assert <*59229> (-inf:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
377 %!assert <*59229> (-inf:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
378 %!assert <*59229> (-inf:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
379 %!assert <*59229> (zero:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
380 %!assert <*59229> (zero:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
381 %!assert <*59229> (zero:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
382 %!assert <*59229> (zero:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
383 %!assert <*59229> (zero:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
384 %!assert <*59229> (inf:-pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
385 %!assert <*59229> (inf:-inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
386 %!assert <*59229> (inf:zero:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
387 %!assert <*59229> (inf:pt3:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
388 %!assert <*59229> (inf:inf:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
389 %!assert <*59229> (-inf:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
390 %!assert <*59229> (-inf:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
391 %!assert <*59229> (-inf:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
392 %!assert <*59229> (-inf:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
393 %!assert <*59229> (-inf:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
394 %!assert <*59229> (-inf:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
395 %!assert <*59229> (zero:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
396 %!assert <*59229> (zero:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
397 %!assert <*59229> (zero:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
398 %!assert <*59229> (zero:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
399 %!assert <*59229> (zero:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
400 %!assert <*59229> (zero:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
401 %!assert <*59229> (inf:nan:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
402 %!assert <*59229> (inf:nan:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
403 %!assert <*59229> (inf:nan:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
404 %!assert <*59229> (inf:nan:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
405 %!assert <*59229> (inf:nan:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
406 %!assert <*59229> (inf:nan:nan, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
407 %!assert <*59229> (inf:-pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
408 %!assert <*59229> (-inf:-pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
409 %!assert <*59229> (inf:pt3:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
410 %!assert <*59229> (-inf:pt3:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
411 %!assert <*59229> (-inf:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
412 %!assert <*59229> (zero:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
413 %!assert <*59229> (inf:-inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
414 %!assert <*59229> (inf:-inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
415 %!assert <*59229> (inf:-inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
416 %!assert <*59229> (inf:-inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
417 %!assert <*59229> (inf:-inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
418 %!assert <*59229> (-inf:inf:-one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
419 %!assert <*59229> (-inf:inf:-inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
420 %!assert <*59229> (-inf:inf:zero, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
421 %!assert <*59229> (-inf:inf:one, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
422 %!assert <*59229> (-inf:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
423 %!assert <*59229> (zero:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
424 %!assert <*59229> (inf:inf:inf, nan)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
425 %!assert <*59229> (zero:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
426 %!assert <*59229> (zero:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
427 %!assert <*59229> (zero:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
428 %!assert <*59229> (zero:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
429 %!assert <*59229> (zero:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
430 %!assert <*59229> (-inf:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
431 %!assert <*59229> (-inf:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
432 %!assert <*59229> (-inf:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
433 %!assert <*59229> (-inf:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
434 %!assert <*59229> (-inf:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
435 %!assert <*59229> (inf:zero:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
436 %!assert <*59229> (inf:zero:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
437 %!assert <*59229> (inf:zero:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
438 %!assert <*59229> (inf:zero:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
439 %!assert <*59229> (inf:zero:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
440 %!assert <*59229> (zero:pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
441 %!assert <*59229> (zero:pt3:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
442 %!assert <*59229> (inf:pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
443 %!assert <*59229> (inf:pt3:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
444 %!assert <*59229> (inf:pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
445 %!assert <*59229> (inf:pt3:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
446 %!assert <*59229> (zero:inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
447 %!assert <*59229> (zero:inf:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
448 %!assert <*59229> (inf:inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
449 %!assert <*59229> (inf:inf:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
450 %!assert <*59229> (inf:inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
451 %!assert <*59229> (inf:inf:-inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
452 %!assert <*59229> (zero:-pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
453 %!assert <*59229> (zero:-pt3:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
454 %!assert <*59229> (-inf:-pt3:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
455 %!assert <*59229> (-inf:-pt3:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
456 %!assert <*59229> (-inf:-pt3:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
457 %!assert <*59229> (-inf:-pt3:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
458 %!assert <*59229> (zero:-inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
459 %!assert <*59229> (zero:-inf:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
460 %!assert <*59229> (-inf:-inf:-one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
461 %!assert <*59229> (-inf:-inf:zero, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
462 %!assert <*59229> (-inf:-inf:one, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
463 %!assert <*59229> (-inf:-inf:inf, mt_row)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
464 %!assert <*59229> (zero:-inf:-one, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
465 %!assert <*59229> (zero:-inf:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
466 %!assert <*59229> (zero:inf:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
467 %!assert <*59229> (zero:inf:one, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
468 %!assert <*59229> (zero:-pt3:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
469 %!assert <*59229> (zero:pt3:zero, zero)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
470 %!assert <*59229> (zero:-pt3:-one, [zero, -pt3, -pt6, -pt9], epsilon)
de40b395b9c3 update bug status in test suite
John W. Eaton <jwe@octave.org>
parents: 29410
diff changeset
471 %!assert <*59229> (zero:pt3:one, [zero, pt3, pt6, pt9], epsilon)
29353
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
472 %!error <range with infinite number of elements cannot be stored> zero:-pt3:-inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
473 %!error <range with infinite number of elements cannot be stored> inf:-pt3:-one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
474 %!error <range with infinite number of elements cannot be stored> inf:-pt3:zero
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
475 %!error <range with infinite number of elements cannot be stored> inf:-pt3:one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
476 %!error <range with infinite number of elements cannot be stored> inf:-pt3:-inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
477 %!error <range with infinite number of elements cannot be stored> zero:pt3:inf
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
478 %!error <range with infinite number of elements cannot be stored> -inf:pt3:-one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
479 %!error <range with infinite number of elements cannot be stored> -inf:pt3:zero
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
480 %!error <range with infinite number of elements cannot be stored> -inf:pt3:one
715344f405f0 improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
481 %!error <range with infinite number of elements cannot be stored> -inf:pt3:inf
29369
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
482
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
483 ## Tests with different input classes
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
484 %!error <invalid types found in range> ({1}:1:5)
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
485 %!error <invalid types found in range> (1:{1}:5)
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
486 %!error <invalid types found in range> (1:1:{5})
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
487 %!error <incompatible types found in range> (int8(1):int16(1):5)
c75996cbe3ba Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents: 29359
diff changeset
488 %!error <incompatible types found in range> (int8(1):1:int16(5))
30142
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
489
29410
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
490 ## Tests with mixed integer/floating point values
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
491 %!error <colon operator lower bound invalid> (1.5:uint8(1):5)
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
492 %!error <colon operator lower bound invalid> (-1:uint8(1):5)
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
493 %!error <colon operator increment invalid> (uint8(1):1.5:5)
30834
f1a9e55d850c for all but range<double>, create arrays instead of range objects
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
494 %!error <colon operator increment invalid> (uint8(1):NaN:5)
29410
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
495 %!error <colon operator upper bound invalid> (uint8(1):1:5.5)
65979d33f147 Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents: 29369
diff changeset
496 %!error <colon operator upper bound invalid> (uint8(1):1:256)
30416
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
497 %!error <colon operator upper bound invalid> (uint8(1):-1:-6)
30142
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
498
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
499 ## Extreme integer values.
30418
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
500 %!test <*61132>
30142
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
501 %! types = {"int8", "int16", "int32", "int64", ...
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
502 %! "uint8", "uint16", "uint32", "uint64"};
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
503 %! for i = 1:numel (types)
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
504 %! cls = types{i};
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
505 %! lo = intmin (cls);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
506 %! hi = intmax (cls);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
507 %! n = 99;
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
508 %! rlo = lo:(lo+n);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
509 %! rhi = (hi-n):hi;
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
510 %! assert (class (rlo), cls);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
511 %! assert (class (rhi), cls);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
512 %! assert (numel (rlo), n+1);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
513 %! assert (numel (rhi), n+1);
a4d1c080e445 fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents: 29493
diff changeset
514 %! endfor
30392
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
515
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
516 ## Test that ranges do not exceed limits for integer types
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
517
30418
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
518 ## Ascending ranges, signed and unsigned
30392
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
519 %!test <*61300>
30418
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
520 %! types = {@int8, @int16, @int32, @int64, @uint8, @uint16, @uint32, @uint64};
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
521 %! start = 0:5;
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
522 %! finish = start + 6 * floor ((100 - start) / 6);
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
523 %! for i_type = 1:numel (types)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
524 %! for i_start = 1:numel(start)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
525 %! assert ((types{i_type} (start(i_start)) : 6 : 100)([1,end]), ...
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
526 %! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]);
30392
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
527 %! endfor
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
528 %! endfor
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
529
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
530 ## Descending ranges, signed
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
531 %!test <*61300>
30418
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
532 %! types = {@int8, @int16, @int32, @int64};
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
533 %! start = 100:-1:95;
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
534 %! finish = start - 6 * floor (start / 6);
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
535 %! for i_type = 1:numel (types)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
536 %! for i_start = 1:numel(start)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
537 %! assert ((types{i_type} (start(i_start)) : -6 : 0)([1,end]), ...
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
538 %! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]);
30392
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
539 %! endfor
5793f0355bfa Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents: 30142
diff changeset
540 %! endfor
30416
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
541
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
542 ## Descending ranges, unsigned
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
543 %!test <*61132>
30418
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
544 %! types = {@uint8, @uint16, @uint32, @uint64};
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
545 %! start = 100:-1:95;
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
546 %! finish = start - 6 * floor (start / 6);
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
547 %! for i_type = 1:numel (types)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
548 %! for i_start = 1:numel(start)
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
549 %! assert ((types{i_type} (start(i_start)) : -6 : 0)([1,end]), ...
c32b6a3805e7 test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents: 30416
diff changeset
550 %! [types{i_type}(start(i_start)), types{i_type}(finish(i_start))]);
30416
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
551 %! endfor
4736bc8e9804 Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30392
diff changeset
552 %! endfor