7017
|
1 ## Copyright (C) 2006, 2007 John W. Eaton |
7016
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
|
18 |
5590
|
19 %% Automatically generated from DejaGNU files |
|
20 |
|
21 %% test/octave.test/struct/fieldnames-1.m |
|
22 %!test |
|
23 %! s.a = 1; |
|
24 %! c = fieldnames (s); |
|
25 %! assert(iscell (c) && strcmp (c{1}, "a")); |
|
26 |
|
27 %% test/octave.test/struct/fieldnames-2.m |
|
28 %!test |
|
29 %! s.a.b = 1; |
|
30 %! c = fieldnames (s.a); |
|
31 %! assert(iscell (c) && strcmp (c{1}, "b")); |
|
32 |
|
33 %% test/octave.test/struct/fieldnames-3.m |
5751
|
34 %!error <Invalid call to fieldnames.*> fieldnames (); |
5590
|
35 |
|
36 %% test/octave.test/struct/fieldnames-4.m |
|
37 %!test |
|
38 %! s.a = 1; |
5751
|
39 %! fail("fieldnames (s, 1)","Invalid call to fieldnames.*"); |
5590
|
40 |
|
41 %% test/octave.test/struct/fieldnames-5.m |
|
42 %!error fieldnames (1); |
|
43 |
|
44 %% test/octave.test/struct/isfield-1.m |
|
45 %!test |
|
46 %! s.aaa = 1; |
|
47 %! s.a = 2; |
|
48 %! assert(isfield (s, "a")); |
|
49 |
|
50 %% test/octave.test/struct/isfield-2.m |
|
51 %!test |
|
52 %! s.aaa = 1; |
|
53 %! s.a = 2; |
|
54 %! assert(!(isfield (s, "b"))); |
|
55 |
|
56 %% test/octave.test/struct/isfield-3.m |
5751
|
57 %!error <Invalid call to isfield.*> isfield (); |
5590
|
58 |
|
59 %% test/octave.test/struct/isfield-4.m |
|
60 %!test |
|
61 %! s.aaa = 1; |
|
62 %! s.a = 2; |
5751
|
63 %! fail("isfield (s, 'a', 3);","Invalid call to isfield.*"); |
5590
|
64 |
|
65 %% test/octave.test/struct/isfield-5.m |
|
66 %!assert(isfield (1, "m") == 0); |
|
67 |
|
68 %% test/octave.test/struct/isfield-6.m |
|
69 %!test |
|
70 %! s.a = 2; |
|
71 %! assert(isfield (s, 2) == 0); |
|
72 |
|
73 %% test/octave.test/struct/isstruct-1.m |
|
74 %!assert(!(isstruct (1))); |
|
75 |
|
76 %% test/octave.test/struct/isstruct-2.m |
|
77 %!assert(!(isstruct ([1, 2]))); |
|
78 |
|
79 %% test/octave.test/struct/isstruct-3.m |
|
80 %!assert(!(isstruct ([]))); |
|
81 |
|
82 %% test/octave.test/struct/isstruct-4.m |
|
83 %!assert(!(isstruct ([1, 2; 3, 4]))); |
|
84 |
|
85 %% test/octave.test/struct/isstruct-5.m |
|
86 %!assert(!(isstruct ("t"))); |
|
87 |
|
88 %% test/octave.test/struct/isstruct-6.m |
|
89 %!assert(!(isstruct ("test"))); |
|
90 |
|
91 %% test/octave.test/struct/isstruct-7.m |
|
92 %!assert(!(isstruct (["test"; "ing"]))); |
|
93 |
|
94 %% test/octave.test/struct/isstruct-8.m |
|
95 %!test |
|
96 %! s.a = 1; |
|
97 %! assert(isstruct (s)); |
|
98 |
|
99 %% test/octave.test/struct/isstruct-9.m |
|
100 %!test |
|
101 %! s.a.b = 1; |
|
102 %! assert(isstruct (s.a)); |
|
103 |
|
104 %% test/octave.test/struct/isstruct-10.m |
5751
|
105 %!error <Invalid call to isstruct.*> isstruct (); |
5590
|
106 |
|
107 %% test/octave.test/struct/isstruct-11.m |
|
108 %!test |
|
109 %! s.a = 1; |
5751
|
110 %! fail("isstruct (s, 1)","Invalid call to isstruct.*"); |
5590
|
111 |