1 | function test_nc_isunlimitedvar ( ) |
---|
2 | % TEST_NC_ISUNLIMITEDVAR: |
---|
3 | % |
---|
4 | % Depends upon nc_add_dimension, nc_addvar |
---|
5 | % |
---|
6 | % 1st set of tests, routine should fail |
---|
7 | % test 1: no input arguments |
---|
8 | % test 2: 1 input |
---|
9 | % test 3: too many inputs |
---|
10 | % test 4: both inputs are not character |
---|
11 | % test 5: not a netcdf file |
---|
12 | % test 6: no such var |
---|
13 | % |
---|
14 | % 2nd set of tests, routine should succeed |
---|
15 | % test 9: given variable is not an unlimited variable |
---|
16 | % test 10: given 1D variable is an unlimited variable |
---|
17 | % test 11: given 2D variable is an unlimited variable |
---|
18 | |
---|
19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
20 | % |
---|
21 | % $Id: test_nc_isunlimitedvar.m 2416 2007-11-10 13:09:55Z johnevans007 $ |
---|
22 | % $LastChangedDate: 2007-11-10 08:09:55 -0500 (Sat, 10 Nov 2007) $ |
---|
23 | % $LastChangedRevision: 2416 $ |
---|
24 | % $LastChangedBy: johnevans007 $ |
---|
25 | % |
---|
26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
27 | |
---|
28 | fprintf ( 1, 'NC_ISUNLIMITEDVAR: starting test suite...\n' ); |
---|
29 | |
---|
30 | test_001 ( 'testdata/full.nc' ); |
---|
31 | test_002 ( 'testdata/full.nc' ); |
---|
32 | test_003 ( 'testdata/full.nc' ); |
---|
33 | test_004 ( 'testdata/full.nc' ); |
---|
34 | test_005 ( 'testdata/full.nc' ); |
---|
35 | test_006 ( 'testdata/full.nc' ); |
---|
36 | test_009 ( 'testdata/full.nc' ); |
---|
37 | test_010 ( 'testdata/full.nc' ); |
---|
38 | test_011 ( 'testdata/full.nc' ); |
---|
39 | |
---|
40 | |
---|
41 | return |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | function test_001 ( ncfile ) |
---|
51 | |
---|
52 | try |
---|
53 | nc = nc_isunlimitedvar; |
---|
54 | msg = sprintf ( '%s: succeeded when it should have failed.\n', mfilename ); |
---|
55 | error ( msg ); |
---|
56 | end |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | function test_002 ( ncfile ) |
---|
68 | |
---|
69 | try |
---|
70 | nc = nc_isunlimitedvar ( ncfile ); |
---|
71 | msg = sprintf ( '%s: succeeded when it should have failed.\n', mfilename ); |
---|
72 | error ( msg ); |
---|
73 | end |
---|
74 | return |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | function test_003 ( ncfile ) |
---|
87 | |
---|
88 | try |
---|
89 | nc = nc_isunlimitedvar ( ncfile, 'blah', 'blah2' ); |
---|
90 | msg = sprintf ( '%s: succeeded when it should have failed.\n', mfilename ); |
---|
91 | error ( msg ); |
---|
92 | end |
---|
93 | |
---|
94 | return |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | function test_004 ( ncfile ) |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | try |
---|
109 | nc = nc_isunlimitedvar ( ncfile, 5 ); |
---|
110 | msg = sprintf ( '%s: succeeded when it should have failed.\n', mfilename ); |
---|
111 | error ( msg ); |
---|
112 | end |
---|
113 | return |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | function test_005 ( ncfile ) |
---|
122 | |
---|
123 | try |
---|
124 | nc = nc_isunlimitedvar ( 'test_nc_isunlimitedvar.m', 't' ); |
---|
125 | msg = sprintf ( '%s: %s succeeded when it should have failed.\n', mfilename, testid ); |
---|
126 | error ( msg ); |
---|
127 | end |
---|
128 | return |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | function test_006 ( ncfile ) |
---|
141 | |
---|
142 | b = nc_isunlimitedvar ( ncfile, 'tt' ); |
---|
143 | if b |
---|
144 | error ( 'succeeded when it should have failed.\n' ); |
---|
145 | end |
---|
146 | return |
---|
147 | |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | |
---|
156 | |
---|
157 | |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | function test_009 ( ncfile ) |
---|
165 | |
---|
166 | b = nc_isunlimitedvar ( ncfile, 's' ); |
---|
167 | if b |
---|
168 | msg = sprintf ( '%s: incorrect result.\n', mfilename ); |
---|
169 | error ( msg ); |
---|
170 | end |
---|
171 | return |
---|
172 | |
---|
173 | |
---|
174 | |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | |
---|
179 | |
---|
180 | function test_010 ( ncfile ) |
---|
181 | |
---|
182 | b = nc_isunlimitedvar ( ncfile, 't2' ); |
---|
183 | if ~b |
---|
184 | msg = sprintf ( '%s: incorrect result.\n', mfilename ); |
---|
185 | error ( msg ); |
---|
186 | end |
---|
187 | return |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | |
---|
195 | |
---|
196 | |
---|
197 | function test_011 ( ncfile ) |
---|
198 | |
---|
199 | b = nc_isunlimitedvar ( ncfile, 't3' ); |
---|
200 | if ( ~b ) |
---|
201 | msg = sprintf ( '%s: incorrect result.\n', mfilename ); |
---|
202 | error ( msg ); |
---|
203 | end |
---|
204 | |
---|
205 | return |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | |
---|