function test_open ( ncfile )
% Tests run are
%    open with clobber mode
%

%
% ok, first create this baby.
[ncid, status] = mexnc ( 'create', ncfile, nc_clobber_mode );
if ( status ~= 0 )
	ncerr_msg = mexnc ( 'strerror', status );
	msg = sprintf ( '%s:  ''create'' failed on %s, error message '' %s ''\n', mfilename, ncfile, ncerr_msg );
	error ( msg );
end
status = mexnc ( 'close', ncid );
if ( status < 0 )
	error ( 'CLOSE failed with nc_clobber_mode' );
end


%
% Test write mode
[ncid, status] = mexnc ( 'open', ncfile, nc_write_mode );
if ( status < 0 )
	error ( 'OPEN failed with nc_write_mode' );
end
status = mexnc ( 'close', ncid );
if ( status < 0 )
	error ( 'CLOSE failed with nc_write_mode' );
end
fprintf ( 1, 'OPEN succeeded with nc_write_mode\n' );

%
% Test share mode
[ncid, status] = mexnc ( 'open', ncfile, nc_share_mode );
if ( status < 0 )
	error ( 'OPEN failed with nc_write_mode' );
end
status = mexnc ( 'close', ncid );
if ( status < 0 )
	error ( 'CLOSE failed with nc_write_mode' );
end
fprintf ( 1, 'OPEN succeeded with nc_share_mode\n' );

%
% Test bitwise or mode
[ncid, status] = mexnc ( 'open', ncfile, bitor ( nc_write_mode, nc_share_mode ) );
if ( status < 0 )
	error ( 'OPEN failed with nc_write_mode | nc_share_mode' );
end
status = mexnc ( 'close', ncid );
if ( status < 0 )
	error ( 'CLOSE failed with nc_write_mode' );
end
fprintf ( 1, 'OPEN succeeded with nc_write_mode | nc_share_mode\n' );







return
