Mercurial > octave
annotate test/range.tst @ 33608:5fba13104493 bytecode-interpreter tip
maint: merge default to bytecode-interpreter.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Sat, 18 May 2024 22:40:00 -0400 |
parents | 2e484f9f1f18 |
children |
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 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
32068
diff
changeset
|
3 ## Copyright (C) 2007-2024 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 | 7 ## |
8 ## This file is part of Octave. | |
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 | 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 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
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 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
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 | 25 |
6938 | 26 ## Test values of range |
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) |
32068
13362cd35b72
Suppress unexpected warning messages when running .tst files in test/ dir (bug #64123)
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
34 %!test |
13362cd35b72
Suppress unexpected warning messages when running .tst files in test/ dir (bug #64123)
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
35 %! warning ('off', 'Octave:colon-complex-argument', 'local'); |
13362cd35b72
Suppress unexpected warning messages when running .tst files in test/ dir (bug #64123)
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
36 %! assert (full (i:2i:10i), zeros (1,0)); |
6938 | 37 |
38 ## Test mixing integer range with other types | |
39 | |
40 %!shared expect, r, z | |
41 %! expect = [ 1 2 3 4 5 6 7 8 9 | |
42 %! 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
|
43 %! z = zeros (1,9); |
6938 | 44 %! r = 1:9; |
45 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
46 %!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
|
47 %!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
|
48 %!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
|
49 %!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
|
50 %!assert ([ r ; sparse(logical(z)) ], sparse (expect)) |
6938 | 51 |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16179
diff
changeset
|
52 %!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
|
53 %!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
|
54 %!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
|
55 %!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
|
56 %!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
|
57 %!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
|
58 %!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
|
59 %!assert ([ r ; uint64(z) ], uint64 (expect)) |
6938 | 60 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
61 ## Test mixing non-integer range with other types |
6938 | 62 |
63 %!shared expect, r, z | |
64 %! expect = [ 1.0 1.4 1.8 2.2 2.6 3.0 | |
65 %! 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
|
66 %! z = zeros (1,6); |
6938 | 67 %! r = 1:0.4:3; |
68 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
69 %!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
|
70 %!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
|
71 %!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
|
72 %!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
|
73 %!assert ([ r ; sparse(logical(z)) ], sparse (expect)) |
6938 | 74 |
16213
b1283d4c06c2
test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents:
16179
diff
changeset
|
75 %!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
|
76 %!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
|
77 %!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
|
78 %!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
|
79 %!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
|
80 %!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
|
81 %!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
|
82 %!assert ([ r ; uint64(z) ], uint64 (expect)) |
6938 | 83 |
16169
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
84 ## 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
|
85 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
86 %!shared r, rrev, rneg |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
87 %! r = -0:3; |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
88 %! rrev = 3:-1:-0; |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
89 %! rneg = -3:-0; |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
90 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
91 %!assert (full (r), [-0 1 2 3]) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
92 %!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
|
93 %!assert (r(1), -0) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
94 %!assert (signbit (r(1)), true) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
95 %!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
|
96 %!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
|
97 %!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
|
98 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
99 %!assert (full (rrev), [3 2 1 -0]) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
100 %!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
|
101 %!assert (rrev(4), -0) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
102 %!assert (signbit (rrev(4)), true) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
103 %!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
|
104 %!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
|
105 %!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
|
106 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
107 %!assert (min (r), -0) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
108 %!assert (signbit (min (r)), true) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
109 %!assert (min (rrev), -0) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
110 %!assert (signbit (min (rrev)), true) |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
111 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
112 %!assert (max (rneg), -0) |
16179
025393bef399
range.tst: Correct typo min -> max in test.
Rik <rik@octave.org>
parents:
16169
diff
changeset
|
113 %!assert (signbit (max (rneg)), true) |
16169
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
114 |
0303fda3e929
Fix range behavior with -0 endpoints (bug #38423)
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
115 %!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
|
116 %!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
|
117 %!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
|
118 |
25812
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
119 ## Test mathematical operations (also, non-finite values and 0) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
120 %!shared r |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
121 %! r = 1:5; |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
122 |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
123 %!assert (-r, -1:-1:-5) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
124 %!assert (1 + r, 2:6) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
125 %!assert (Inf + r, Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
126 %!assert (NaN + r, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
127 %!assert (r + 1, 2:6) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
128 %!assert (r + Inf, Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
129 %!assert (r + NaN, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
130 %!assert (1 - r, 0:-1:-4) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
131 %!assert (Inf - r, Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
132 %!assert (NaN - r, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
133 %!assert (r - 1, 0:4) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
134 %!assert (r - Inf, -Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
135 %!assert (r - NaN, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
136 %!assert (2 * r, 2:2:10) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
137 %!assert (0 * r, zeros (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
138 %!assert (Inf * r, Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
139 %!assert (NaN * r, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
140 %!assert (r * 2, 2:2:10) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
141 %!assert (r * 0, zeros (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
142 %!assert (r * Inf, Inf (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
143 %!assert (r * NaN, NaN (1,5)) |
fc74c8d2a584
Clean up liboctave Range implementation.
Rik <rik@octave.org>
parents:
25808
diff
changeset
|
144 |
20458
ba032e57fd96
range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
145 ## Test sorting of ranges (bug #45739) |
ba032e57fd96
range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
146 %!shared r, rrev |
ba032e57fd96
range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
147 %! r = 1:2:10; |
ba032e57fd96
range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
148 %! rrev = 10:-2:1; |
ba032e57fd96
range.tst: Add tests for bug #45739.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
149 |
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
|
150 %!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
|
151 %!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
|
152 |
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 ## 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
|
154 %!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
|
155 %! 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
|
156 %! 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
|
157 |
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 %!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
|
159 %! 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
|
160 %! 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
|
161 |
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 ## 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
|
163 ## 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
|
164 ## (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
|
165 %!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
|
166 %! 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
|
167 %! 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
|
168 |
715344f405f0
improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
169 ## 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
|
170 |
715344f405f0
improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
171 %!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
|
172 %! 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
|
173 %! 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
|
174 %! 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
|
175 %! 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
|
176 %! 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
|
177 %! 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
|
178 %! 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
|
179 %! 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
|
180 %! epsilon = eps ('double'); |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
181 %!assert <*59229> (nan:-pt3:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
182 %!assert <*59229> (nan:-pt3:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
183 %!assert <*59229> (nan:-pt3:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
184 %!assert <*59229> (nan:-pt3:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
185 %!assert <*59229> (nan:-pt3:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
186 %!assert <*59229> (nan:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
187 %!assert <*59229> (nan:-inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
188 %!assert <*59229> (nan:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
189 %!assert <*59229> (nan:-inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
190 %!assert <*59229> (nan:-inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
191 %!assert <*59229> (nan:-inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
192 %!assert <*59229> (nan:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
193 %!assert <*59229> (nan:zero:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
194 %!assert <*59229> (nan:zero:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
195 %!assert <*59229> (nan:zero:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
196 %!assert <*59229> (nan:zero:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
197 %!assert <*59229> (nan:zero:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
198 %!assert <*59229> (nan:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
199 %!assert <*59229> (nan:pt3:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
200 %!assert <*59229> (nan:pt3:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
201 %!assert <*59229> (nan:pt3:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
202 %!assert <*59229> (nan:pt3:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
203 %!assert <*59229> (nan:pt3:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
204 %!assert <*59229> (nan:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
205 %!assert <*59229> (nan:inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
206 %!assert <*59229> (nan:inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
207 %!assert <*59229> (nan:inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
208 %!assert <*59229> (nan:inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
209 %!assert <*59229> (nan:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
210 %!assert <*59229> (nan:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
211 %!assert <*59229> (nan:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
212 %!assert <*59229> (nan:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
213 %!assert <*59229> (nan:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
214 %!assert <*59229> (nan:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
215 %!assert <*59229> (nan:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
216 %!assert <*59229> (nan:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
217 %!assert <*59229> (-inf:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
218 %!assert <*59229> (-inf:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
219 %!assert <*59229> (-inf:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
220 %!assert <*59229> (-inf:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
221 %!assert <*59229> (-inf:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
222 %!assert <*59229> (zero:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
223 %!assert <*59229> (zero:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
224 %!assert <*59229> (zero:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
225 %!assert <*59229> (zero:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
226 %!assert <*59229> (zero:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
227 %!assert <*59229> (inf:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
228 %!assert <*59229> (inf:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
229 %!assert <*59229> (inf:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
230 %!assert <*59229> (inf:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
231 %!assert <*59229> (inf:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
232 %!assert <*59229> (-inf:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
233 %!assert <*59229> (-inf:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
234 %!assert <*59229> (-inf:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
235 %!assert <*59229> (-inf:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
236 %!assert <*59229> (-inf:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
237 %!assert <*59229> (-inf:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
238 %!assert <*59229> (zero:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
239 %!assert <*59229> (zero:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
240 %!assert <*59229> (zero:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
241 %!assert <*59229> (zero:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
242 %!assert <*59229> (zero:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
243 %!assert <*59229> (zero:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
244 %!assert <*59229> (inf:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
245 %!assert <*59229> (inf:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
246 %!assert <*59229> (inf:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
247 %!assert <*59229> (inf:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
248 %!assert <*59229> (inf:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
249 %!assert <*59229> (inf:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
250 %!assert <*59229> (inf:-pt3:inf, 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:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
255 %!assert <*59229> (zero:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
256 %!assert <*59229> (inf:-inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
257 %!assert <*59229> (inf:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
258 %!assert <*59229> (inf:-inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
259 %!assert <*59229> (inf:-inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
260 %!assert <*59229> (inf:-inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
261 %!assert <*59229> (-inf:inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
262 %!assert <*59229> (-inf:inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
263 %!assert <*59229> (-inf:inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
264 %!assert <*59229> (-inf:inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
265 %!assert <*59229> (-inf:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
266 %!assert <*59229> (zero:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
267 %!assert <*59229> (inf:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
268 %!assert <*59229> (zero:zero:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
269 %!assert <*59229> (zero:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
270 %!assert <*59229> (zero:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
271 %!assert <*59229> (zero:zero:-inf, 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> (-inf:zero:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
274 %!assert <*59229> (-inf:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
275 %!assert <*59229> (-inf:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
276 %!assert <*59229> (-inf:zero:-inf, 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:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
279 %!assert <*59229> (inf:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
280 %!assert <*59229> (inf:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
281 %!assert <*59229> (inf:zero:-inf, 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> (zero:pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
284 %!assert <*59229> (zero:pt3:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
285 %!assert <*59229> (inf:pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
286 %!assert <*59229> (inf:pt3:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
287 %!assert <*59229> (inf:pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
288 %!assert <*59229> (inf:pt3:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
289 %!assert <*59229> (zero:inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
290 %!assert <*59229> (zero:inf:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
291 %!assert <*59229> (inf:inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
292 %!assert <*59229> (inf:inf:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
293 %!assert <*59229> (inf:inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
294 %!assert <*59229> (inf:inf:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
295 %!assert <*59229> (zero:-pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
296 %!assert <*59229> (zero:-pt3:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
297 %!assert <*59229> (-inf:-pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
298 %!assert <*59229> (-inf:-pt3:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
299 %!assert <*59229> (-inf:-pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
300 %!assert <*59229> (-inf:-pt3:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
301 %!assert <*59229> (zero:-inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
302 %!assert <*59229> (zero:-inf:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
303 %!assert <*59229> (-inf:-inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
304 %!assert <*59229> (-inf:-inf:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
305 %!assert <*59229> (-inf:-inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
306 %!assert <*59229> (-inf:-inf:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
307 %!assert <*59229> (zero:-inf:-one, zero) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
308 %!assert <*59229> (zero:-inf:zero, 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:one, zero) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
311 %!assert <*59229> (zero:-pt3:zero, 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:-one, [zero, -pt3, -pt6, -pt9], epsilon) |
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) |
29353
715344f405f0
improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
315 %!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
|
316 %!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
|
317 %!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
|
318 %!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
|
319 %!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
|
320 %!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
|
321 %!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
|
322 %!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
|
323 %!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
|
324 %!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
|
325 |
715344f405f0
improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
326 ## 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
|
327 %!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
|
328 %! 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
|
329 %! 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
|
330 %! 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
|
331 %! 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
|
332 %! 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
|
333 %! 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
|
334 %! 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
|
335 %! 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
|
336 %! epsilon = eps ('single'); |
29493
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
337 %!assert <*59229> (nan:-pt3:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
338 %!assert <*59229> (nan:-pt3:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
339 %!assert <*59229> (nan:-pt3:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
340 %!assert <*59229> (nan:-pt3:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
341 %!assert <*59229> (nan:-pt3:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
342 %!assert <*59229> (nan:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
343 %!assert <*59229> (nan:-inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
344 %!assert <*59229> (nan:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
345 %!assert <*59229> (nan:-inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
346 %!assert <*59229> (nan:-inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
347 %!assert <*59229> (nan:-inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
348 %!assert <*59229> (nan:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
349 %!assert <*59229> (nan:zero:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
350 %!assert <*59229> (nan:zero:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
351 %!assert <*59229> (nan:zero:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
352 %!assert <*59229> (nan:zero:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
353 %!assert <*59229> (nan:zero:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
354 %!assert <*59229> (nan:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
355 %!assert <*59229> (nan:pt3:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
356 %!assert <*59229> (nan:pt3:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
357 %!assert <*59229> (nan:pt3:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
358 %!assert <*59229> (nan:pt3:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
359 %!assert <*59229> (nan:pt3:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
360 %!assert <*59229> (nan:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
361 %!assert <*59229> (nan:inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
362 %!assert <*59229> (nan:inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
363 %!assert <*59229> (nan:inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
364 %!assert <*59229> (nan:inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
365 %!assert <*59229> (nan:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
366 %!assert <*59229> (nan:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
367 %!assert <*59229> (nan:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
368 %!assert <*59229> (nan:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
369 %!assert <*59229> (nan:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
370 %!assert <*59229> (nan:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
371 %!assert <*59229> (nan:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
372 %!assert <*59229> (nan:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
373 %!assert <*59229> (-inf:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
374 %!assert <*59229> (-inf:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
375 %!assert <*59229> (-inf:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
376 %!assert <*59229> (-inf:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
377 %!assert <*59229> (-inf:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
378 %!assert <*59229> (zero:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
379 %!assert <*59229> (zero:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
380 %!assert <*59229> (zero:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
381 %!assert <*59229> (zero:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
382 %!assert <*59229> (zero:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
383 %!assert <*59229> (inf:-pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
384 %!assert <*59229> (inf:-inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
385 %!assert <*59229> (inf:zero:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
386 %!assert <*59229> (inf:pt3:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
387 %!assert <*59229> (inf:inf:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
388 %!assert <*59229> (-inf:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
389 %!assert <*59229> (-inf:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
390 %!assert <*59229> (-inf:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
391 %!assert <*59229> (-inf:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
392 %!assert <*59229> (-inf:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
393 %!assert <*59229> (-inf:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
394 %!assert <*59229> (zero:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
395 %!assert <*59229> (zero:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
396 %!assert <*59229> (zero:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
397 %!assert <*59229> (zero:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
398 %!assert <*59229> (zero:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
399 %!assert <*59229> (zero:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
400 %!assert <*59229> (inf:nan:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
401 %!assert <*59229> (inf:nan:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
402 %!assert <*59229> (inf:nan:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
403 %!assert <*59229> (inf:nan:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
404 %!assert <*59229> (inf:nan:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
405 %!assert <*59229> (inf:nan:nan, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
406 %!assert <*59229> (inf:-pt3:inf, 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:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
411 %!assert <*59229> (zero:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
412 %!assert <*59229> (inf:-inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
413 %!assert <*59229> (inf:-inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
414 %!assert <*59229> (inf:-inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
415 %!assert <*59229> (inf:-inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
416 %!assert <*59229> (inf:-inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
417 %!assert <*59229> (-inf:inf:-one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
418 %!assert <*59229> (-inf:inf:-inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
419 %!assert <*59229> (-inf:inf:zero, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
420 %!assert <*59229> (-inf:inf:one, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
421 %!assert <*59229> (-inf:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
422 %!assert <*59229> (zero:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
423 %!assert <*59229> (inf:inf:inf, nan) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
424 %!assert <*59229> (zero:zero:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
425 %!assert <*59229> (zero:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
426 %!assert <*59229> (zero:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
427 %!assert <*59229> (zero:zero:-inf, 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> (-inf:zero:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
430 %!assert <*59229> (-inf:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
431 %!assert <*59229> (-inf:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
432 %!assert <*59229> (-inf:zero:-inf, 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:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
435 %!assert <*59229> (inf:zero:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
436 %!assert <*59229> (inf:zero:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
437 %!assert <*59229> (inf:zero:-inf, 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> (zero:pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
440 %!assert <*59229> (zero:pt3:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
441 %!assert <*59229> (inf:pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
442 %!assert <*59229> (inf:pt3:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
443 %!assert <*59229> (inf:pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
444 %!assert <*59229> (inf:pt3:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
445 %!assert <*59229> (zero:inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
446 %!assert <*59229> (zero:inf:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
447 %!assert <*59229> (inf:inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
448 %!assert <*59229> (inf:inf:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
449 %!assert <*59229> (inf:inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
450 %!assert <*59229> (inf:inf:-inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
451 %!assert <*59229> (zero:-pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
452 %!assert <*59229> (zero:-pt3:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
453 %!assert <*59229> (-inf:-pt3:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
454 %!assert <*59229> (-inf:-pt3:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
455 %!assert <*59229> (-inf:-pt3:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
456 %!assert <*59229> (-inf:-pt3:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
457 %!assert <*59229> (zero:-inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
458 %!assert <*59229> (zero:-inf:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
459 %!assert <*59229> (-inf:-inf:-one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
460 %!assert <*59229> (-inf:-inf:zero, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
461 %!assert <*59229> (-inf:-inf:one, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
462 %!assert <*59229> (-inf:-inf:inf, mt_row) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
463 %!assert <*59229> (zero:-inf:-one, zero) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
464 %!assert <*59229> (zero:-inf:zero, 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:one, zero) |
de40b395b9c3
update bug status in test suite
John W. Eaton <jwe@octave.org>
parents:
29410
diff
changeset
|
467 %!assert <*59229> (zero:-pt3:zero, 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:-one, [zero, -pt3, -pt6, -pt9], epsilon) |
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) |
29353
715344f405f0
improve handling of nan, infinite value, and empty ranges (bug #59229)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
471 %!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
|
472 %!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
|
473 %!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
|
474 %!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
|
475 %!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
|
476 %!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
|
477 %!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
|
478 %!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
|
479 %!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
|
480 %!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
|
481 |
c75996cbe3ba
Emit more specific error when two different integer types used in range (bug #59899).
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
482 ## 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
|
483 %!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
|
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 <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
|
487 %!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
|
488 |
29410
65979d33f147
Emit error if integer/floating point inputs to colon operator are incompatible (bug #59899).
Rik <rik@octave.org>
parents:
29369
diff
changeset
|
489 ## 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
|
490 %!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
|
491 %!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
|
492 %!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
|
493 %!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
|
494 %!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
|
495 %!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
|
496 %!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
|
497 |
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
498 ## Extreme integer values. |
30418
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
499 %!test <*61132> |
30142
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
500 %! 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
|
501 %! "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
|
502 %! 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
|
503 %! cls = types{i}; |
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
504 %! lo = intmin (cls); |
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
505 %! hi = intmax (cls); |
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
506 %! n = 99; |
a4d1c080e445
fix construction of ranges with extreme integer values (bug #61132)
John W. Eaton <jwe@octave.org>
parents:
29493
diff
changeset
|
507 %! 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
|
508 %! 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
|
509 %! 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
|
510 %! 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
|
511 %! 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
|
512 %! 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
|
513 %! endfor |
30392
5793f0355bfa
Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents:
30142
diff
changeset
|
514 |
5793f0355bfa
Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents:
30142
diff
changeset
|
515 ## 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
|
516 |
30418
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
517 ## 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
|
518 %!test <*61300> |
30418
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
519 %! 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
|
520 %! start = 0:5; |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
521 %! 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
|
522 %! for i_type = 1:numel (types) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
523 %! for i_start = 1:numel(start) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
524 %! 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
|
525 %! [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
|
526 %! endfor |
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 |
5793f0355bfa
Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents:
30142
diff
changeset
|
529 ## Descending ranges, signed |
5793f0355bfa
Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents:
30142
diff
changeset
|
530 %!test <*61300> |
30418
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
531 %! types = {@int8, @int16, @int32, @int64}; |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
532 %! start = 100:-1:95; |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
533 %! finish = start - 6 * floor (start / 6); |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
534 %! for i_type = 1:numel (types) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
535 %! for i_start = 1:numel(start) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
536 %! 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
|
537 %! [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
|
538 %! endfor |
5793f0355bfa
Ensure integer ranges do not exceed limits (bug #61300).
Arun Giridhar <arungiridhar@gmail.com>
parents:
30142
diff
changeset
|
539 %! endfor |
30416
4736bc8e9804
Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30392
diff
changeset
|
540 |
4736bc8e9804
Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30392
diff
changeset
|
541 ## Descending ranges, unsigned |
4736bc8e9804
Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30392
diff
changeset
|
542 %!test <*61132> |
30418
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
543 %! types = {@uint8, @uint16, @uint32, @uint64}; |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
544 %! start = 100:-1:95; |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
545 %! finish = start - 6 * floor (start / 6); |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
546 %! for i_type = 1:numel (types) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
547 %! for i_start = 1:numel(start) |
c32b6a3805e7
test: Consolidate tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30416
diff
changeset
|
548 %! 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
|
549 %! [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
|
550 %! endfor |
4736bc8e9804
Allow descending ranges of all integer types (bug #61132).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30392
diff
changeset
|
551 %! endfor |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
552 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
553 ## Class of range operator output |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
554 %!test |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
555 %! types = {@double, @single, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
556 %! @int8, @int16, @int32, @int64, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
557 %! @uint8, @uint16, @uint32, @uint64}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
558 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
559 %! ## with implicit increment |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
560 %! assert (class (types{i_type} (0) : types{i_type} (10)), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
561 %! func2str (types{i_type})); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
562 %! ## with matching increment |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
563 %! assert (class (types{i_type} (0) : types{i_type} (2) : types{i_type} (10)), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
564 %! func2str (types{i_type})); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
565 %! ## with double increment (ascending) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
566 %! assert (class (types{i_type} (0) : 2 : types{i_type} (10)), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
567 %! func2str (types{i_type})); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
568 %! ## with double increment (descending) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
569 %! assert (class (types{i_type} (10) : -2 : types{i_type} (0)), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
570 %! func2str (types{i_type})); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
571 %! endfor |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
572 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
573 ## Signed integer ranges with large span |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
574 %!test <*61788> # ascending ranges |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
575 %! assert (int8 (-100) : int8 (50) : int8 (100), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
576 %! int8 ([-100, -50, 0, 50, 100])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
577 %! assert (int16 (-3e4) : int16 (1.5e4) : int16 (3e4), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
578 %! int16 ([-3e4, -1.5e4, 0, 1.5e4, 3e4])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
579 %! assert (int32 (-2e9) : int32 (1e9) : int32 (2e9), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
580 %! int32 ([-2e9, -1e9, 0, 1e9, 2e9])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
581 %! assert (int64 (-9e18) : int64 (4.5e18) : int64 (9e18), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
582 %! [int64(-9e18), int64(-4.5e18), 0, int64(4.5e18), int64(9e18)]); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
583 %!test <*61788> # descending ranges |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
584 %! assert (int8 (100) : int8 (-50) : int8 (-100), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
585 %! int8 ([100, 50, 0, -50, -100])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
586 %! assert (int16 (3e4) : int16 (-1.5e4) : int16 (-3e4), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
587 %! int16 ([3e4, 1.5e4, 0, -1.5e4, -3e4])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
588 %! assert (int32 (2e9) : int32 (-1e9) : int32 (-2e9), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
589 %! int32 ([2e9, 1e9, 0, -1e9, -2e9])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
590 %! assert (int64 (9e18) : int64 (-4.5e18) : int64 (-9e18), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
591 %! [int64(9e18), int64(4.5e18), 0, int64(-4.5e18), int64(-9e18)]); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
592 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
593 ## integer ranges with double increments |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
594 %!test # ascending ranges |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
595 %! types = {@int8, @int16, @int32, @int64, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
596 %! @uint8, @uint16, @uint32, @uint64}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
597 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
598 %! assert (types{i_type} (0) : 2 : types{i_type} (10), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
599 %! types{i_type} ([0, 2, 4, 6, 8, 10])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
600 %! endfor |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
601 %!test # descending ranges |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
602 %! types = {@int8, @int16, @int32, @int64, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
603 %! @uint8, @uint16, @uint32, @uint64}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
604 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
605 %! assert (types{i_type} (10) : -2 : types{i_type} (0), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
606 %! types{i_type} ([10, 8, 6, 4, 2, 0])); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
607 %! endfor |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
608 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
609 ## integer range with large double increments |
30859
df26decca96b
Tweak check for maximum possible increment of integer ranges (bug #62212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30857
diff
changeset
|
610 %!test <*62212> # ascending ranges |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
611 %! types = {"int8", "int16", "int32", "int64"}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
612 %! for i_type = 1:numel (types) |
30850
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
613 %! assert (intmin (types{i_type}) : -double (intmin (types{i_type})) : intmax (types{i_type}), ... |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
614 %! [intmin(types{i_type}), 0]); |
30855
aaf689533e7b
Avoid integer division by zero for int64 ranges with double increment.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30850
diff
changeset
|
615 %! assert (intmin (types{i_type}) : -2*double (intmin (types{i_type})) : intmax (types{i_type}), ... |
aaf689533e7b
Avoid integer division by zero for int64 ranges with double increment.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30850
diff
changeset
|
616 %! intmin (types{i_type})); |
30850
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
617 %! if (! strcmp (types, "int64")) |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
618 %! ## The increment cannot be represented in double precision for "int64" |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
619 %! assert (intmin (types{i_type}) : 2*double (intmax (types{i_type})) : intmin (types{i_type}), ... |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
620 %! [intmin(types{i_type}), intmax(types{i_type})-1]); |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
621 %! endif |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
622 %! endfor |
30859
df26decca96b
Tweak check for maximum possible increment of integer ranges (bug #62212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30857
diff
changeset
|
623 %!test <*62212> # descending ranges |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
624 %! types = {"int8", "int16", "int32", "int64"}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
625 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
626 %! assert (intmax (types{i_type}) : double (intmin (types{i_type})) : intmin (types{i_type}), ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
627 %! [intmax(types{i_type}), -1]); |
30855
aaf689533e7b
Avoid integer division by zero for int64 ranges with double increment.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30850
diff
changeset
|
628 %! assert (intmax (types{i_type}) : 2*double (intmin (types{i_type})) : intmin (types{i_type}), ... |
aaf689533e7b
Avoid integer division by zero for int64 ranges with double increment.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30850
diff
changeset
|
629 %! intmax (types{i_type})); |
30850
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
630 %! if (! strcmp (types, "int64")) |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
631 %! ## The increment cannot be represented in double precision for "int64" |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
632 %! assert (intmax (types{i_type}) : -2*double (intmax (types{i_type})) : intmin (types{i_type}), ... |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
633 %! [intmax(types{i_type}), -intmax(types{i_type})]); |
82c1554c4a64
* test/range.tst: Avoid issues with double precision floating point numbers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30848
diff
changeset
|
634 %! endif |
30848
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
635 %! endfor |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
636 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
637 ## integer range near intmax |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
638 %!test |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
639 %! types = {"int8", "int16", "int32", "int64", ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
640 %! "uint8", "uint16", "uint32", "uint64"}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
641 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
642 %! hi = intmax (types{i_type}); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
643 %! lo = hi - 5; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
644 %! ## ascending range |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
645 %! assert (lo:hi, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
646 %! intmax(types{i_type}) - 5 + (0:5)); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
647 %! ## descending range |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
648 %! assert (hi:-1:lo, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
649 %! intmax(types{i_type}) - 5 + (5:-1:0)); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
650 %! endfor |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
651 |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
652 ## integer range near intmin |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
653 %!test |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
654 %! types = {"int8", "int16", "int32", "int64", ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
655 %! "uint8", "uint16", "uint32", "uint64"}; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
656 %! for i_type = 1:numel (types) |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
657 %! lo = intmin (types{i_type}); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
658 %! hi = lo + 5; |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
659 %! ## ascending range |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
660 %! assert (lo:hi, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
661 %! intmin(types{i_type}) + (0:5)); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
662 %! ## descending range |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
663 %! assert (hi:-1:lo, ... |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
664 %! intmin(types{i_type}) + (5:-1:0)); |
cb0a54576eb0
* test/range.tst: Add tests for integer ranges.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30834
diff
changeset
|
665 %! endfor |