annotate test/classes/classes.tst @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
1 ## Copyright (C) 2009-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27097
diff changeset
2 ##
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27097
diff changeset
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27097
diff changeset
4 ## or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27097
diff changeset
5 ##
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
6 ##
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
7 ## This file is part of Octave.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23692
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
10 ## 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: 23692
diff changeset
11 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22377
diff changeset
12 ## (at your option) any later version.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
13 ##
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22377
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22377
diff changeset
17 ## GNU General Public License for more details.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
18 ##
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
19 ## You should have received a copy of the GNU General Public License
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
20 ## 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: 23692
diff changeset
21 ## <https://www.gnu.org/licenses/>.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
22
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
23 %% Test script for legacy OOP.
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
24 %% Requires the path to contain the test classes.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
25 %%
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
26 %% Note: This script and all classes are also intended to run
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
27 %% in MATLAB to test compatibility. Don't break that!
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
28 %%
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
29 %% Note(JBect, 2013/01/27) : in order to ease to process of testing
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
30 %% Matlab compatibility, the syntax assert(observed, expected) should
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
31 %% be avoided. I use assert(isequal(observed, expected) instead.
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
32 %%
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
33 %% To Do: This script tests to ensure that things done correctly work
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
34 %% corrrectly. It should also check that things done incorrectly
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
35 %% error properly.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
36 %%
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
37 %% The classes used for the tests reside in the test directory.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
38 %%
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
39 %% The classes provide the ability to test most of the major features
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
40 %% of the legacy OOP facilities. There are a number of classes, mostly
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
41 %% kind of the same, that create a hierarchy.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
42
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
43 %% Test the Snork class. The Snork class has a number of the standard
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
44 %% methods that the others don't so we can test indexing and other
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
45 %% features.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
46 %!shared snk, snk1, snk2
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
47 %!test snk = Snork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
48 %! assert (isequal (gick (snk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
49 %! assert (isequal (snk.gick, 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
50 %! assert (isequal (snk(2), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
51 %! assert (isequal (snk{end}, 3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
52 %!test snk = gick (snk, 2);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
53 %! assert (isequal (gick (snk), 2));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
54 %!test snk = set (snk, 'gick', 7);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
55 %! assert (isequal (get (snk, 'gick'), 7));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
56 %!test snk.gick = 4;
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
57 %! assert (isequal (gick (snk),4));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
58 %! snk(1) = 3;
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
59 %!test snk{end} = 9;
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
60 %! assert (isequal (cack (snk), [3 1 2 9]));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
61 %! assert (isequal (getStash (snk), 1)); % Check private functions.
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
62 %! assert (isobject (snk));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
63 %! assert (isequal (class (snk), 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
64 %! assert (isa (snk, 'Snork'));
17307
4448cc742880 Use '!' not operator rather than '~' in core m-files.
Rik <rik@octave.org>
parents: 16213
diff changeset
65 %! assert (!isa (snk, 'Sneetch'));
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
66 %! assert (ismethod (snk, 'gick'));
17307
4448cc742880 Use '!' not operator rather than '~' in core m-files.
Rik <rik@octave.org>
parents: 16213
diff changeset
67 %! assert (!ismethod (snk, 'bletch'));
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
68 %! assert (exist ('snk') == 1);
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
69 %! assert (exist ('blink') == 0);
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
70 %!test snk1 = Snork (snk);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
71 %! assert (isequal (class (snk1), 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
72 %! assert (isequal (gick (snk1), 4));
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
73 %!test snk2 = Snork (-3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
74 %! assert (isequal (class (snk2), 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
75 %! assert (isequal (gick (snk2), -3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
76 %!test x = [1 2 3 4];
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
77 %! assert (isequal (x(snk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
78
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
79 %% x = methods ('Snork'); % Need to test the methods function.
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
80 %% save temp snk;
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
81 %% load temp % This load causes a segfault.
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
82 %% assert (isequal (cack(snk), [-1 -2 -3 -4])); % This is a major bug!
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
83
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
84 %% The Spork class is a near clone of Snork but without as many standard
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
85 %% methods. We are testing no new octave features, but this is makes
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
86 %% sure that we haven't bollixed up the Spork class if we should make
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
87 %% changes. We use Spork in the class hierarchy.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
88 %!shared sprk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
89 %!test sprk = Spork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
90 %! assert (isequal (geek (sprk), 1));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
91 %!test sprk = geek (sprk, 3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
92 %! assert (isequal (geek (sprk), 3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
93 %!test sprk = set (sprk,'geek',7);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
94 %! assert (isequal (get (sprk, 'geek'), 7));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
95 %! assert (isequal (class (sprk), 'Spork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
96 %! assert (isa (sprk, 'Spork'));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
97
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
98 %% The Blork class is a near clone of Snork but without as many standard
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
99 %% methods. We are testing no new octave features, but this is makes
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
100 %% sure that we haven't bollixed up the Blork class if we should make
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
101 %% changes. We use Blork in the class hierarchy.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
102 %!shared blrk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
103 %!test blrk = Blork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
104 %! assert (isequal (bleek(blrk), 1));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
105 %!test blrk = bleek (blrk, 3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
106 %! assert (isequal (bleek (blrk), 3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
107 %!test blrk = set (blrk, 'bleek', 13);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
108 %! assert (isequal (get (blrk, 'bleek'), 13));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
109 %! assert (isequal (class (blrk), 'Blork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
110 %! assert (isa (blrk, 'Blork'));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
111
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
112 %% The Cork class is a near clone of Snork but without as many standard
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
113 %% methods. We are testing no new octave features, but this is makes
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
114 %% sure that we haven't bollixed up the Cork class if we should make
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
115 %% changes. We use Cork in the class hierarchy.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
116 %!shared crk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
117 %!test crk = Cork (23);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
118 %! assert (isequal (click(crk), 23));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
119 %!test crk = click(crk,3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
120 %! assert (isequal (click(crk), 3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
121 %!test crk = set (crk, 'click', 13);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
122 %! assert (isequal (get (crk, 'click'), 13));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
123 %! assert (isequal (class (crk), 'Cork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
124 %! assert (isa (crk, 'Cork'));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
125
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
126 %% The Dork class tests single inheritance.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
127 %!shared drk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
128 %!test drk = Dork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
129 %! assert (isequal (gack (drk),0));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
130 %!test drk = gack (drk,-2);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
131 %! assert (isequal (gack (drk),-2));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
132 %!test drk = gick (drk,2);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
133 %! assert (isequal (gick (drk),2));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
134 %!test drk = set (drk, 'gick',3, 'gack',-3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
135 %! assert (isequal (get (drk, 'gick'), 3));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
136 %! assert (isequal (get (drk, 'gack'), -3));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
137 %! assert (isequal (class (drk), 'Dork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
138 %! assert (isa (drk, 'Dork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
139 %! assert (isa (drk, 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
140 %! assert (isequal (getStash (drk), 2));
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
141 %!test drk1 = Dork (drk);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
142 %! assert (isequal (class (drk1), 'Dork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
143 %! assert (isa (drk1, 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
144 %! assert (isequal (gick (drk1), 3));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
145 %! assert (isequal (gack (drk1), -3));
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
146 %!test drk2 = Dork (-4, 4);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
147 %! assert (isequal (class (drk2), 'Dork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
148 %! assert (isa (drk2, 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
149 %! assert (isequal (gick (drk2), -4));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
150 %! assert (isequal (gack (drk2), 4));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
151
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
152 %% The Pork class is essentially a clone of Dork. It is used as part
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
153 %% of the multiple inheritance test.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
154 %!shared prk, drk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
155 %!test prk = Pork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
156 %! assert (isequal (geek (prk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
157 %! assert (isequal (gurk (prk), 0));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
158 %!test prk = gurk (prk,-3);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
159 %! assert (isequal (gurk (prk), -3));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
160 %!test prk = geek (prk,9);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
161 %! assert (isequal (geek (prk), 9));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
162 %! assert (isequal (class (prk), 'Pork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
163 %! assert (isa (prk, 'Pork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
164 %! assert (isa (prk, 'Spork'));
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
165 %!test drk = Dork (); % Precedence.
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
166 %! assert (isequal (bling (drk, prk), 2));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
167 %! assert (isequal (bling (prk, drk), 2));
16030
1af8d21608b7 rename all test files in the test directory from test_X.m to X.tst
John W. Eaton <jwe@octave.org>
parents: 16014
diff changeset
168
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
169 %% The Gork class tests aggregation and multiple inheritance.
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
170 %!shared grk
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
171 %!test grk = Gork ();
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
172 %! assert (isequal (gick (grk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
173 %! assert (isequal (geek (grk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
174 %! assert (isequal (gack (grk), 0));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
175 %! assert (isequal (gurk (grk), 0));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
176 %! assert (isequal (bleek (grk), 1));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
177 %! assert (isequal (gark(grk), -2));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
178 %! assert (isequal (click (cork (grk)), 17));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
179 %! assert (isequal (class (cork (grk)), 'Cork'));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
180 %!test grk = gick (grk, 3);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
181 %!test grk = geek (grk, 4);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
182 %!test grk = gack (grk, -9);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
183 %!test grk = gurk (grk, -8);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
184 %!test grk = bleek (grk, -7);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
185 %!test grk = gark (grk, -6);
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
186 %!test grk = cork (grk, click (cork (grk), 23));
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
187 %! assert (isequal (gick (grk), 3));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
188 %! assert (isequal (geek (grk), 4));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
189 %! assert (isequal (gack (grk), -9));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
190 %! assert (isequal (gurk (grk), -8));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
191 %! assert (isequal (bleek (grk), -7));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
192 %! assert (isequal (gark (grk), -6));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
193 %! assert (isequal (click (cork (grk)), 23));
9381
f9ab19428cd8 * run-octave.in: Exclude @-files from path. Remove CVS exclusions.
Robert T. Short <octave@phaselockedsystems.com>
parents:
diff changeset
194 %!test
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
195 %! cork1 = Cork (13);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
196 %! grk = set (grk, 'gick', -5, 'gack', -6, 'gark', -7, 'cork', cork1);
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
197 %! assert (isequal (get (grk, 'gick'), -5));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
198 %! assert (isequal (get (grk, 'gack'), -6));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
199 %! assert (isequal (get (grk, 'gark'), -7));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
200 %! assert (isequal (click(get (grk, 'cork')), 13));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
201 %!test grk = set (grk, 'cork', 12);
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
202 %! assert (isequal (click(get (grk, 'cork')),12));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
203 %! assert (isequal (class (cork(grk)), 'Cork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
204 %! assert (isequal (class (grk), 'Gork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
205 %! assert (isa (grk, 'Gork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
206 %! assert (isa (grk, 'Dork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
207 %! assert (isa (grk, 'Pork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
208 %! assert (isa (grk, 'Blork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
209 %! assert (isa (grk, 'Snork'));
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
210 %! assert (isa (grk, 'Spork'));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
211
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
213 %% Testing (some) overloaded operators %%
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
215
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
216 %% Common variables for testing overloaded operators
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
217 %!shared x1, x2, x3, s1, s2, s3
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
218 %! x1 = 1 + rand (3); s1 = Snork (x1);
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
219 %! x2 = 1 + rand (3); s2 = Snork (x2);
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
220 %! x3 = diag ([1 2 3]); s3 = Snork (x3);
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
221
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
222 %% Test overloaded plus (+) and uplus (unitary +) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
223 %!test s = s1 + s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 + x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
224 %!test s = s1 + x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 + x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
225 %!test s = x1 + s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 + x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
226 %!test s = +s1; assert (isequal (s, s1));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
227
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
228 %% Test overloaded minus (-) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
229 %!test s = s1 - s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 - x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
230 %!test s = s1 - x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 - x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
231 %!test s = x1 - s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 - x2));
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
232 %!test s = -s1; assert (isequal (s, Snork (-x1)));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
233
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
234 %% Test overloaded mtimes (*) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
235 %!test s = s1 * s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 * x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
236 %!test s = s1 * x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 * x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
237 %!test s = x1 * s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 * x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
238
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
239 %% Test overloaded times (.*) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
240 %!test s = s1 .* s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .* x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
241 %!test s = s1 .* x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .* x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
242 %!test s = x1 .* s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .* x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
243
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
244 %% Test overloaded mpower (^) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
245 %!test s = s1 ^ 3; assert (isa (s, 'Snork') && isequal (s.gick, x1 ^ 3));
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
246 %!error <mpower Snork!!!> s = s1 ^ s1
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
247 %!error <mpower Snork!!!> s = 20 ^ s1
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
248
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
249 %% Test overloaded power (.^) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
250 %!test s = s1 .^ 2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .^ 2));
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
251 %!error <power Snork!!!> s = s1 .^ s1
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
252 %!error <power Snork!!!> s = 20 .^ s1
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
253
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
254 %% Test overloaded rdivide (./) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
255 %!test s = s1 ./ s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 ./ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
256 %!test s = s1 ./ x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 ./ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
257 %!test s = x1 ./ s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 ./ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
258
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
259 %% Test overloaded ldivide (.\) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
260 %!test s = s1 .\ s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .\ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
261 %!test s = s1 .\ x2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .\ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
262 %!test s = x1 .\ s2; assert (isa (s, 'Snork') && isequal (s.gick, x1 .\ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
263
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
264 %% Test overloaded mrdivide (/) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
265 %!test s = s1 / s3; assert (isa (s, 'Snork') && isequal (s.gick, x1 / x3));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
266 %!test s = s1 / x3; assert (isa (s, 'Snork') && isequal (s.gick, x1 / x3));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
267 %!test s = x1 / s3; assert (isa (s, 'Snork') && isequal (s.gick, x1 / x3));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
268
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
269 %% Test overloaded mldivide (\) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
270 %!test s = s3 \ s2; assert (isa (s, 'Snork') && isequal (s.gick, x3 \ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
271 %!test s = s3 \ x2; assert (isa (s, 'Snork') && isequal (s.gick, x3 \ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
272 %!test s = x3 \ s2; assert (isa (s, 'Snork') && isequal (s.gick, x3 \ x2));
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
273
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
274 %% Test overloaded eq (==) for the Snork class
16014
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
275 %!assert (s1 == s1)
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
276 %!assert (s1 == x1)
980f79a7bb55 test_classes.m: Use Octave coding conventions.
Rik <rik@octave.org>
parents: 15985
diff changeset
277 %!assert (x1 == s1)
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
278 %!assert (~(s1 == (s1 + 1)))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
279 %!assert (~(s1 == (x1 + 1)))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
280 %!assert (~(x1 == (s1 + 1)))
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
281
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
282 %% Test overloaded ne (~=) for the Snork class
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
283 %!assert (~(s1 ~= s1))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
284 %!assert (~(s1 ~= x1))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
285 %!assert (~(x1 ~= s1))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
286 %!assert (s1 ~= (s1 + 1))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
287 %!assert (x1 ~= (s1 + 1))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
288 %!assert (s1 ~= (x1 + 1))
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
289
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
290 %% Test overloaded lt (<) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
291 %!assert (s1 < (s1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
292 %!assert (s1 < (x1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
293 %!assert (x1 < (s1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
294
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
295 %% Test overloaded gt (>) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
296 %!assert (s1 > (s1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
297 %!assert (s1 > (x1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
298 %!assert (x1 > (s1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
299
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
300 %% Test overloaded lt (<=) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
301 %!assert (s1 <= (s1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
302 %!assert (s1 <= (x1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
303 %!assert (x1 <= (s1 + 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
304
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
305 %% Test overloaded gt (>=) for the Snork class
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
306 %!assert (s1 >= (s1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
307 %!assert (s1 >= (x1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
308 %!assert (x1 >= (s1 - 1))
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
309
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
311 %% Testing concatenation and transposition %%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
313
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
314 %% Test overloaded (c)transpose for the Snork class
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
315 %!assert (isequal (s1', Snork (double (s1)' + 4))) % +4 is intentional
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
316 %!assert (isequal (s1.', Snork (double (s1).' + 2))) % +2 is intentional
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
317
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
318 %% Test overloaded vertcat() for the Snork class
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
319 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
320 %! s = [s1; s2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1; x2]));
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
321 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
322 %! s = [s1; x2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1; x2]));
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
323 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
324 %! s = [x1; s2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1; x2]));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
325
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
326 %% Test overloaded horzcat() for the Snork class
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
327 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
328 %! s = [s1 s2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1 x2]));
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
329 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
330 %! s = [s1 x2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1 x2]));
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
331 %!test <*38128>
22377
c0f446d657bf * bug-38236.tst, classes.tst: Tag some known failures with bug IDs.
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
332 %! s = [x1 s2]; assert (isa (s, 'Snork') && isequal (s.gick, [x1 x2]));
15985
f75ffcc82acb Added tests for the legacy class system.
Julien Bect <julien.bect@supelec.fr>
parents: 14138
diff changeset
333
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
334 %% Test with the Blork class, where neither ctranspose(), transpose(),
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
335 %% vertcat() nor horzcat() is overloaded
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
336 %!shared x1, x2, x3
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
337 %!test x1 = Blork ();
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
338 %!test x2 = [x1 x1];
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 20890
diff changeset
339 %!assert (isa (x2, 'Blork') && isequal (size (x2), [1 2]))
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
340 %!test x2 = [x1 51];
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 20890
diff changeset
341 %!assert (isa (x2, 'Blork') && isequal (size (x2), [1 2]))
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
342 %!test x3 = [x2; x2];
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 20890
diff changeset
343 %!assert (isa (x3, 'Blork') && isequal (size (x3), [2 2]))
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
344 %!test x3 = [x2; [51 x1]];
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 20890
diff changeset
345 %!assert (isa (x3, 'Blork') && isequal (size (x3), [2 2]))
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
346 %!error <dimension mismatch> x4 = [x1, x3]
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
347 %!error <dimension mismatch> x4 = [x1; x3]
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
348 %!test x2 = [x1 x1];
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
349 %!assert (isequal (x2', [x1; x1]) && isequal (size (x2'), [2 1]))
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
350 %!assert (isequal (x2.', [x1; x1]) && isequal (size (x2.'), [2 1]))
16140
797ac81586d1 Modify pt-mat.cc to solve a problem related to vertcat/horzcat overloading.
Julien Bect <julien.bect@supelec.fr>
parents: 16070
diff changeset
351
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
352 %%%%%%%%%%%%%%%%%%%%%%%%
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
353 %% Testing precedence %%
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
354 %%%%%%%%%%%%%%%%%%%%%%%%
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
355
25911
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
356 %% default: leftmost or superior class (bug #42735) object wins
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
357 %!shared A, B
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
358 %!test A = Snork (rand (2));
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
359 %!test B = CPrecedenceTester1 (); % no call to inferiorto/superiorto
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
360 %!assert (isequal (tattack (A, B), 'Snork'))
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
361 %!assert (isequal (tattack (B, A), 'CPrecedenceTester1')) % idem
25911
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
362 %!assert <*42735> (isequal (class (A + B), 'Snork'))
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
363 %!assert <*42735> (isequal (B + A, 'CPrecedenceTester1')) % idem
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
364
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
365 %!shared A, B
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
366 %!test A = Snork (rand (2));
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
367 %!test B = CPrecedenceTester2 (1); % CPrecedenceTester2 > Snork
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
368 %!assert (isequal (tattack (A, B), 'CPrecedenceTester2'))
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
369 %!assert (isequal (tattack (B, A), 'CPrecedenceTester2'))
25911
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
370 %!assert <*42735> (isequal (A + B, 'CPrecedenceTester2'))
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
371 %!assert <*42735> (isequal (B + A, 'CPrecedenceTester2'))
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
372 %% Trying to change to CPrecendenceTester < Snork
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
373 %!error D = CPrecedenceTester2 (2)
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
374
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
375 %!shared A, B
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
376 %!test A = Snork (rand (2));
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
377 %!test B = CPrecedenceTester3 (2); % CPrecedenceTester3 < Snork
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
378 %!assert (isequal (tattack (A, B), 'Snork'))
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
379 %!assert (isequal (tattack (B, A), 'Snork'))
25911
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
380 %!assert <*42735> (isequal (class (A + B), 'Snork'))
868830474750 Regard the precedence of binary operators for old style classes (bug #42735).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 25054
diff changeset
381 %!assert <*42735> (isequal (class (B + A), 'Snork'))
16070
e603ce23f20c Fix and improve functions related to class precedence (bug #38290)
Julien Bect <julien.bect@supelec.fr>
parents: 16030
diff changeset
382 %% Trying to change to CPrecendenceTester3 > Snork
21581
6fab85c1538f maint: Follow Octave conventions for use of semicolon in BIST tests.
Rik <rik@octave.org>
parents: 21580
diff changeset
383 %!error D = CPrecedenceTester3 (1)
16213
b1283d4c06c2 test: Use Octave coding standards for scripts in test/ directory.
Rik <rik@octave.org>
parents: 16159
diff changeset
384
27096
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
386 %% Testing overridden size+numel method %%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
387 %% (builtin size method and similar methods %%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
388 %% use the size of the struct container) %%
deb0273199a2 maint: Make old style class tests Matlab compatible.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26376
diff changeset
389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
390
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
391 %!shared st
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
392 %!test st = SizeTester ([1 1]);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
393 %! assert (isequal (size (st), [1 1]));
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
394 %! assert (isequal (numel (st), 1));
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
395 %!assert (isequal (ndims (st), 2))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
396 %!assert (isequal (rows (st), 1))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
397 %!assert (isequal (columns (st), 1))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
398 %!assert (isequal (st, st))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
399 %!assert (isscalar (st))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
400 %!assert (isvector (st))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
401
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
402 %!test st = SizeTester ([1 2]);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
403 %! assert (isequal (size (st), [1 2]));
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
404 %! assert (isequal (numel (st), 2));
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
405 %!assert (isequal (ndims (st), 2))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
406 %!assert (isequal (rows (st), 1))
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
407 %!assert <*51308> (isequal (columns (st), 2))
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
408 %!assert <*44334> (isequal (st, st))
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
409 %!assert <*44498> (not (isscalar (st)))
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
410 %!assert (isvector (st))
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
411
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
412 %!test st = SizeTester ([2 3]);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
413 %! assert (isequal (size (st), [2 3]));
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
414 %! assert (isequal (numel (st), 6));
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
415 %!assert (isequal (ndims (st), 2))
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
416 %!assert <*51308> (isequal (rows (st), 2))
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
417 %!assert <*51308> (isequal (columns (st), 3))
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
418 %!assert <*44334> (isequal (st, st))
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
419 %!assert <*44498> (not (isscalar (st)))
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
420 %!assert <*44498> (not (isvector (st)))
20890
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
421
ef9b2a88fbb5 Fixed isequal for comparison of objects with overridden size (bug #44334)
Oliver Heimlich <oheim@posteo.de>
parents: 19697
diff changeset
422 %!test st = SizeTester ([2 3 4]);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
423 %! assert (isequal (size (st), [2 3 4]));
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21562
diff changeset
424 %! assert (isequal (numel (st), 24));
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
425 %!assert <*51308> (isequal (ndims (st), 3))
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
426 %!assert <*51308> (isequal (rows (st), 2))
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
427 %!assert <*51308> (isequal (columns (st), 3))
23573
1b4f4ec53b4a use new script to tag fixed bugs in tests
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
428 %!assert <*44334> (isequal (st, st))
26946
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
429 %!assert <*44498> (not (isscalar (st)))
04e5cb5e2cb3 update bug status in tests
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
430 %!assert <*44498> (not (isvector (st)))