% TEST_SNCTOOLS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Id: test_snctools.m 1975 2006-11-01 19:48:28Z johnevans007 $
% $LastChangedDate: 2006-11-01 14:48:28 -0500 (Wed, 01 Nov 2006) $
% $LastChangedRevision: 1975 $
% $LastChangedBy: johnevans007 $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mver = ver ( 'matlab' );
mver = str2num ( mver.Version(1:3) );

if mver <= 6.0
    fprintf ( 'I see that you are running R12 or below.  Some m-files\n' );
    fprintf ( 'in SNCTOOLS (not all) will not run with R12 or below.\n' );
    fprintf ( 'Please see the README for further details.\n' );
    input ( '\nPress Enter to continue.\n' );
end

test_nc_dump             ( 'test.nc' );
test_nc_add_dimension    ( 'test.nc' );
test_nc_addhist          ( 'test.nc' );
test_nc_addvar           ( 'test.nc' );
test_nc_attget_attput    ( 'test.nc' );
test_nc_create_empty     ( 'test.nc' );
test_nc_datatype_string;
test_nc_iscoordvar       ( 'test.nc' );
test_nc_isunlimitedvar   ( 'test.nc' );
test_nc_isvar            ( 'test.nc' );
test_nc_varget_varput    ( 'test.nc' );
test_nc_varrename        ( 'test.nc' );
test_nc_varsize          ( 'test.nc' );


if mver > 6.0
    fprintf ( 'Starting tests for m-files that require R13 or higher...\n' );
    test_nc_addnewrecs       ( 'test.nc' );
    test_nc_diff             ( 'test1.nc', 'test2.nc' );
    test_nc_add_recs         ( 'test.nc' );
    test_nc_archive_buffer   ( 'test.nc' );
    test_nc_cat_a;
    test_nc_getall           ( 'test.nc' );
    test_nc_getbuffer        ( 'test.nc' );
    test_snc2mat             ( 'test.nc' );

    %
    % These m-files do not explicitly require R13 or higher, but their
    % test suites do.
    test_nc_getdiminfo       ( 'test.nc' );
    test_nc_getlast          ( 'test.nc' );
    test_nc_getvarinfo       ( 'test.nc' );
    test_nc_info             ( 'test.nc' );
end

fprintf ( 1, '\nAll SNCTOOLS tests succeeded.\n' );

fprintf ( 1, '\n' );
answer = input ( 'Do you wish to remove all test NetCDF and *.mat files that were created? [y/n]\n', 's' );
if strcmp ( lower(answer), 'y' )
    delete ( '*.nc' );
    delete ( '*.mat' );
end
fprintf ( 1, 'We''re done.\n' );



