Mercurial > octave
annotate test/fcn-handle-derived-resolution/fcn-handle-derived-resolution.tst @ 26376:00f796120a6d stable
maint: Update copyright dates in all source files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 02 Jan 2019 16:32:43 -0500 |
parents | 6652d3823428 |
children |
rev | line source |
---|---|
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
1 ## Copyright (C) 2012-2019 John W. Eaton |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
5 ## Octave is free software: you can redistribute it and/or modify it |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## 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
|
7 ## 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
|
8 ## (at your option) any later version. |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## GNU General Public License for more details. |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## 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
|
17 ## <https://www.gnu.org/licenses/>. |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 %% Test script for legacy OOP. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 %% Requires the path to contain the directory ctor-vs-method. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %% |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 %% Note: This script and all classes are also intended to run |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 %% in Matlab to test compatibility. Don't break that! |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
25 %% FIXME: Can't use 'clear -classes' because it also clears all functions in the |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
26 %% namespace of test.m (bug #35881). This is a problem only if Octave would |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
27 %% re-use a class definition that was defined somewhere else. Unfortunately, |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
28 %% that is exactly the case when running 'make check' since the ctor-vs-method |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
29 %% test also uses an @parent, @derived, and @other class. |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
30 %% Until the bug is fixed, it suffices to make the class names unique so that |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
31 %% there is no re-use. Using the prefix fhdr (fcn-handle-derived-resolution) |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 %% for this directory. |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
33 %%!shared |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
34 %%! #clear -classes |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
37 %! p = fhdr_parent (7); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
38 %! assert (numel (p), 7); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 %! d = fhdr_derived (13); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
42 %! assert (numel (d), 13); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
45 %! p = fhdr_parent (11); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 %! f = @numel; |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
47 %! assert (f (p), 11); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 %! d = fhdr_parent (21); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 %! f = @numel; |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
52 %! assert (f (d), 21); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 %! o(2) = fhdr_other (42); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
57 %! assert (getsize_loop (o), [13, 42]); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 %! o(2) = fhdr_other (42); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
62 %! assert (getsize_cellfun (o), [13, 42]); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 %!test |
18414
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 %! o(2) = fhdr_other (42); |
21580
ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
67 %! assert (getsize_arrayfun (o), [13, 42]); |