Skip to content
Snippets Groups Projects
Commit c0cebe93 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Merge branch 'master' into old-oop-style

parents 73edfb1f 693acff0
Branches
No related tags found
No related merge requests found
......@@ -17,15 +17,29 @@ function ts = rename(ts,old,new) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if isempty(ts)
error('dseries::rename: Cannot rename variable(s) because the object is empty!')
end
if nargin<3
if isequal(vobs(ts), 1)
new = old;
else
error('dseries::rename: Missing argument!')
end
if ~ischar(new)
error(['dseries::rename: Input argument ''' inputname(2) ''' has to be a string!'])
end
idname = 1;
else
if ~ischar(old) || ~ischar(new)
error(['dseries::rename: Input arguments ''' inputname(2) ''' and ''' inputname(3) ''' have to be strings!'])
end
idname = find(strcmp(old,ts.name));
if isempty(idname)
error(['dseries::rename: Variable ' old ' is unknown in dseries object ' inputname(1) '!'])
end
end
ts.name(idname) = {new};
......@@ -74,3 +88,20 @@ ts.name(idname) = {new};
%$
%$ T = all(t);
%@eof:2
%@test:3
%$ t = zeros(2,1);
%$ ts = dseries(randn(10,1));
%$ try
%$ ts = ts.rename('Dora');
%$ t(1) = 1;
%$ catch
%$ t = 0;
%$ end
%$
%$ if length(t)>1
%$ t(2) = dassert(ts.name,{'Dora'});
%$ end
%$
%$ T = all(t);
%@eof:3
opath = path();
% Check that the m-unit-tests module is available.
install_unit_test_toolbox = false;
try
initialize_unit_tests_toolbox;
catch
......@@ -12,6 +15,7 @@ catch
delete('master.zip')
addpath([pwd() '/../externals/m-unit-tests-master/src'])
initialize_unit_tests_toolbox;
install_unit_test_toolbox = true;
end
% Initialize the dseries module
......@@ -28,5 +32,8 @@ tmp = tmp(1:end-1); % Remove trailing slash.
run_unitary_tests_in_directory(tmp);
delete('*.log');
if install_unit_test_toolbox
rmdir('../externals/m-unit-tests-master','s');
end
path(opath);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment