1 | function test_mexnc() |
---|
2 | % TEST_MEXNC: Wrapper routine that invokes all tests for MEXNC |
---|
3 | % |
---|
4 | % USAGE: test_mexnc; |
---|
5 | |
---|
6 | p = which ( 'mexnc', '-all' ); |
---|
7 | if isempty(p) |
---|
8 | fprintf ( 1, 'Could not find mexnc on the matlab path. Read the README!!\n' ); |
---|
9 | fprintf ( 1, 'Bye\n' ); |
---|
10 | return |
---|
11 | end |
---|
12 | |
---|
13 | fprintf ( 1, 'Your path for mexnc is listed below. Before continuing on, make sure\n' ); |
---|
14 | fprintf ( 1, 'that any old versions of mexnc are either NOT present or are shadowed.\n' ); |
---|
15 | disp ( p ); |
---|
16 | answer = input ( 'Does the above path for mexnc look right? [y/n]\n', 's' ); |
---|
17 | if strcmp ( lower(answer), 'n' ) |
---|
18 | fprintf ( 1, 'Bye\n' ); |
---|
19 | return |
---|
20 | end |
---|
21 | |
---|
22 | fprintf ( 1, '\n\n\nDo you wish to remove all test NetCDF files in this directory prior to running the tests?\n' ); |
---|
23 | fprintf ( 1, 'It''s a good idea to say yes if you are in the test suite directory.\n' ); |
---|
24 | fprintf ( 1, 'It''s a bad idea if you are running the test from somewhere else, \n' ); |
---|
25 | fprintf ( 1, 'e.g. your PhD thesis results directory.\n' ); |
---|
26 | answer = input ( '[y | n]\n', 's' ); |
---|
27 | if strcmp ( lower(answer(1)), 'y' ) |
---|
28 | delete ( '*.nc' ); |
---|
29 | end |
---|
30 | |
---|
31 | ncver = mexnc ( 'inq_libvers' ); |
---|
32 | if ncver(1) == '4' |
---|
33 | %test_def_grp ( 'foo.nc' ); |
---|
34 | end |
---|
35 | |
---|
36 | |
---|
37 | test_copy_att ( 'foo_copy_att1.nc', 'foo_copy_att2.nc' ); |
---|
38 | test__create ( 'foo__create.nc' ); |
---|
39 | test_create ( 'foo_create.nc' ); |
---|
40 | test_def_dim ( 'foo_def_dim.nc' ); |
---|
41 | test_def_var ( 'foo_def_var.nc' ); |
---|
42 | test_del_att ( 'foo_del_att.nc' ); |
---|
43 | test__enddef ( 'foo__enddef.nc' ); |
---|
44 | test_inq ( 'foo_inq.nc' ); |
---|
45 | test_inq_dim ( 'foo_inq_dim.nc' ); |
---|
46 | test_inq_dimid ( 'foo_inq_dimid.nc' ); |
---|
47 | test_inq_libvers; |
---|
48 | test_inq_var ( 'foo_inq_var.nc' ); |
---|
49 | test_inq_varid ( 'foo_inq_varid.nc' ); |
---|
50 | test__open ( 'foo__open.nc' ); |
---|
51 | test_open ( 'foo_open.nc' ); |
---|
52 | %test_redef_def_dim ( 'foo_redef.nc' ); |
---|
53 | test_rename_dim ( 'foo_rename_dim.nc' ); |
---|
54 | test_rename_var ( 'foo_rename.nc' ); |
---|
55 | |
---|
56 | test_inq_att ( 'foo_inq_att.nc' ); |
---|
57 | test_inq_attid ( 'foo_inq_attid.nc' ); |
---|
58 | test_inq_atttype ( 'foo_inq_atttype.nc' ); |
---|
59 | test_inq_attlen ( 'foo_inq_attlen.nc' ); |
---|
60 | test_inq_unlimdim ( 'foo_unlimdic.nc' ); |
---|
61 | |
---|
62 | test_put_get_att ( 'foo_put_get_att.nc' ); |
---|
63 | test_get_var_bad_param_datatype ( 'foo_get_var_bad_param.nc' ); |
---|
64 | test_put_get_var_double ( 'foo_put_get_var_double.nc' ); |
---|
65 | test_put_get_var_float ( 'foo_put_get_var_float.nc' ); |
---|
66 | test_put_get_var_int ( 'foo_put_get_var_int.nc' ); |
---|
67 | test_put_get_var_short ( 'foo_put_get_var_short.nc' ); |
---|
68 | test_put_get_var_schar ( 'foo_put_get_var_schar.nc' ); |
---|
69 | test_put_get_var_uchar ( 'foo_put_get_var_uchar.nc' ); |
---|
70 | test_put_get_var_text ( 'foo_put_get_var_text.nc' ); |
---|
71 | |
---|
72 | test_put_var_bad_param_datatype ( 'foo_put_var_bad_param.nc' ); |
---|
73 | test_rename_att ( 'foo_rename_att.nc' ); |
---|
74 | |
---|
75 | test_set_fill ( 'foo_fill.nc' ); |
---|
76 | test_strerror; |
---|
77 | test_sync ( 'foo_sync.nc' ); |
---|
78 | |
---|
79 | test_lfs ( 'foo_lfs_64.nc' ); |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | % Deprecated functions |
---|
85 | fprintf ( 1, '\n' ); |
---|
86 | fprintf ( 1, 'Testing NetCDF-2 functions.\n' ); |
---|
87 | fprintf ( 1, '\n' ); |
---|
88 | mexnc ( 'setopts', 0 ); |
---|
89 | test_attcopy ( 'foo_attcopy.nc', 'foo_attcopy2.nc' ); |
---|
90 | test_attdel ( 'foo_attdel.nc' ); |
---|
91 | test_attinq ( 'foo_attinq.nc' ); |
---|
92 | test_attname ( 'foo_attname.nc' ); |
---|
93 | test_attput ( 'foo_attput.nc' ); |
---|
94 | test_attrename ( 'foo_attrename.nc' ); |
---|
95 | test_dimdef ( 'foo_dimdef.nc' ); |
---|
96 | test_dimid ( 'foo_dimid.nc' ); |
---|
97 | test_diminq ( 'foo_diminq.nc' ); |
---|
98 | test_dimrename ( 'foo_dimrename.nc' ); |
---|
99 | test_endef ( 'foo_endef.nc' ); |
---|
100 | test_inquire ( 'foo_inquire.nc' ); |
---|
101 | test_typelen; |
---|
102 | test_vardef ( 'foo_vardef.nc' ); |
---|
103 | test_varid ( 'foo_varid.nc' ); |
---|
104 | test_varinq ( 'foo_varinq.nc' ); |
---|
105 | test_varrename ( 'foo_varrename.nc' ); |
---|
106 | test_varput ( 'foo_varput.nc' ); |
---|
107 | test_varput1 ( 'foo_varput1.nc' ); |
---|
108 | test_varputg ( 'foo_varputg.nc' ); |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | fprintf ( 1, 'All tests succeeded.\n' ); |
---|
113 | fprintf ( 1, '\n' ); |
---|
114 | answer = input ( 'Do you wish to remove all test NetCDF files that were created? [y/n]\n', 's' ); |
---|
115 | if strcmp ( lower(answer), 'y' ) |
---|
116 | delete ( '*.nc' ); |
---|
117 | end |
---|
118 | fprintf ( 1, 'We''re done.\n' ); |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | return |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | function test_inq_libvers () |
---|
127 | lib_version = mexnc ( 'inq_libvers' ); |
---|
128 | |
---|
129 | fprintf ( 1, 'MEXNC says it was built with version %s.\n', lib_version ); |
---|
130 | fprintf ( 1, 'INQ_LIBVERS succeeded\n' ); |
---|
131 | return |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | |
---|
136 | |
---|
137 | |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | |
---|