function oettestsettings(varargin)
%OETTESTSETTINGS  add all relevant paths to run OpenEarthTools tests
%
% oettestsettings adds all relevant paths in the test directory of the
% openearthtools repository.
%
% In order to suppress this information, run the function with input argument quiet:
%	"oetsettings('quiet');" or "oetsettings quiet"
%
%See also: path, restoredefaultpath, addpathfast,
%          OpenEarthTools: general, applications, io, tutorials
%              highlights: convertcoordinates, googleplot

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) <2004-2008> <Deltares>
%
%          <Pieter.vanGeer@deltares.nl>
%
%       Deltares
%       P.O. Box 177
%       2600 MH Delft
%       The Netherlands
%
%   This library is free software: you can redistribute it and/or
%   modify it under the terms of the GNU Lesser General Public
%   License as published by the Free Software Foundation, either
%   version 2.1 of the License, or (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Lesser General Public License for more details.
%
%   You should have received a copy of the GNU Lesser General Public
%   License along with this library. If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tools is part of <a href="http://OpenEarth.Deltares.nl">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and 
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute 
% your own tools.

%% Version <http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html>
% $Id$
% $Date$
% $Author$
% $Revision$
% $HeadURL$
% $Keywords: $

%% Check whether OpenEarthTools is already initiated
   S      = [fileparts(which('oetsettings'))  filesep];
   if isempty(S)
       error('OetTestSettings:NoOetsettings','Adding OpenEarthTools tests cannot be loaded prior to adding the openearthtools themselves. Please run oetsettings before oettestsettings.');
   end

%% Retrieve verbose state from input 
   OPT = struct('quiet',false);
   nextarg   = 1;
   
   if mod(nargin,2)==1 % odd # arguments
       if strcmp(varargin{1},'quiet')
           OPT.quiet = true;
       else
           error(['unknown argument:',varargin{1}])
       end
       nextarg   = 2;
   end
   
   OPT = setproperty(OPT,varargin{nextarg:end});
   
%% Acknowledge user we started adding the tests

   if ~(OPT.quiet)
       disp('Adding OpenEarthToolsTests, please wait ...')
       disp(' ')
   end
      
%% Collect warning and directory state

   state = struct(...
       'warning',warning,...
       'pwd',cd);

%% Add paths

   basepath = fileparts(mfilename('fullpath'));
   warning off
   addpathfast(basepath,'append',false); % excludes *.svn directories!

%% Restore warning and directory state

   warning(state.warning)
        cd(state.pwd)

%% Report

   if ~(OPT.quiet)
       disp('Finished adding tests');
       disp(' ');
   end
   
%% EOF