source: Roms_tools/mexcdf/mexnc/tests/test_mexnc.m @ 1

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

import Roms_Agrif

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