source: Roms_tools/mexcdf/snctools/tests/test_nc_isunlimitedvar.m @ 1

Last change on this file since 1 was 1, checked in by cholod, 13 years ago

import Roms_Agrif

File size: 2.8 KB
Line 
1function 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
28fprintf ( 1, 'NC_ISUNLIMITEDVAR:  starting test suite...\n' );
29
30test_001 ( 'testdata/full.nc' );
31test_002 ( 'testdata/full.nc' );
32test_003 ( 'testdata/full.nc' );
33test_004 ( 'testdata/full.nc' );
34test_005 ( 'testdata/full.nc' );
35test_006 ( 'testdata/full.nc' );
36test_009 ( 'testdata/full.nc' );
37test_010 ( 'testdata/full.nc' );
38test_011 ( 'testdata/full.nc' );
39
40
41return
42
43
44
45
46
47
48
49
50function test_001 ( ncfile )
51
52try
53        nc = nc_isunlimitedvar;
54        msg = sprintf ( '%s:  succeeded when it should have failed.\n', mfilename );
55        error ( msg );
56end
57
58
59
60
61
62
63
64
65
66
67function test_002 ( ncfile )
68
69try
70        nc = nc_isunlimitedvar ( ncfile );
71        msg = sprintf ( '%s:  succeeded when it should have failed.\n', mfilename );
72        error ( msg );
73end
74return
75
76
77
78
79
80
81
82
83
84
85
86function test_003 ( ncfile )
87
88try
89        nc = nc_isunlimitedvar ( ncfile, 'blah', 'blah2' );
90        msg = sprintf ( '%s:  succeeded when it should have failed.\n', mfilename );
91        error ( msg );
92end
93
94return
95
96
97
98
99
100
101
102
103
104function test_004 ( ncfile )
105
106
107
108try
109        nc = nc_isunlimitedvar ( ncfile, 5 );
110        msg = sprintf ( '%s:  succeeded when it should have failed.\n', mfilename );
111        error ( msg );
112end
113return
114
115
116
117
118
119
120
121function test_005  ( ncfile )
122
123try
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 );
127end
128return
129
130
131
132
133
134
135
136
137
138
139
140function test_006 ( ncfile )
141
142b = nc_isunlimitedvar ( ncfile, 'tt' );
143if b
144    error ( 'succeeded when it should have failed.\n' );
145end
146return
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164function test_009 ( ncfile )
165
166b = nc_isunlimitedvar ( ncfile, 's' );
167if b
168        msg = sprintf ( '%s:  incorrect result.\n', mfilename );
169        error ( msg );
170end
171return
172
173
174
175
176
177
178
179
180function test_010 ( ncfile )
181
182b = nc_isunlimitedvar ( ncfile, 't2' );
183if ~b
184        msg = sprintf ( '%s:  incorrect result.\n', mfilename );
185        error ( msg );
186end
187return
188
189
190
191
192
193
194
195
196
197function test_011 ( ncfile )
198
199b = nc_isunlimitedvar ( ncfile, 't3' );
200if ( ~b  )
201        msg = sprintf ( '%s: incorrect result.\n', mfilename );
202        error ( msg );
203end
204
205return
206
207
208
209
Note: See TracBrowser for help on using the repository browser.