function test_dimdef ( ncfile )
% TEST_DIMRENAME
%


[ncid, status] = mexnc ( 'create', ncfile, nc_clobber_mode );
if ( status < 0 )
	ncerr = mexnc ( 'strerror', status );
	err_msg = sprintf ( '%s:  ''%s''\n', mfilename, ncerr );
	error ( err_msg );
end


%
% DIMDEF
[xdimid, status] = mexnc ( 'dimdef', ncid, 'x', 20 );
if ( status < 0 )
	ncerr = mexnc ( 'strerror', status );
	err_msg = sprintf ( '%s:  ''%s''\n', mfilename, ncerr );
	error ( err_msg );
end

status = mexnc ( 'DIMRENAME', ncid, xdimid, 'x2' );
if ( status < 0 )
	ncerr = mexnc ( 'strerror', status );
	err_msg = sprintf ( '%s:  ''%s''\n', mfilename, ncerr );
	error ( err_msg );
end


%
% Try a bad ncid
status = mexnc ( 'DIMRENAME', -5, xdimid, 'x2' );
if ( status >= 0 )
	err_msg = sprintf ( '%s:  DIMRENAME succeeded on a bad ncid\n', mfilename, ncerr );
	error ( err_msg );
end

%
% Try a bad dimid
status = mexnc ( 'DIMRENAME', ncid, -5, 'x2' );
if ( status >= 0 )
	err_msg = sprintf ( '%s:  DIMRENAME succeeded on a bad dimid\n', mfilename, ncerr );
	error ( err_msg );
end



%
% ENDEF
[status] = mexnc ( 'end_def', ncid );
if ( status < 0 )
	ncerr = mexnc ( 'strerror', status );
	err_msg = sprintf ( '%s:  ''%s''\n', mfilename, ncerr );
	error ( err_msg );
end


fprintf ( 1, 'DIMRENAME succeeded.\n' );


return














