# HG changeset patch # User Carlo de Falco # Date 1387800442 -3600 # Mon Dec 23 13:07:22 2013 +0100 # Branch stable # Node ID 7d5ea1bcde1c621e0a2a75a70f72e2fa951552e0 # Parent fd571d2a18d803ef9652619a7ff0fc3fc4f70af3 Save files to P_tmpdir in tests * test/io.tst: save temporary files to P_tmpdir. diff --git a/test/io.tst b/test/io.tst --- a/test/io.tst +++ b/test/io.tst @@ -74,7 +74,9 @@ %! %! ret = 0; %! -%! files = {"text.mat", "binary.mat", "mat5.mat", "mat7.mat"}; +%! files = cellfun (@fullfile, {P_tmpdir}, +%! {"text.mat", "binary.mat", "mat5.mat", "mat7.mat"}, +%! "UniformOutput", false); %! opts = {"-z -text", "-z -binary", "-z -mat", "-v7"}; %! tols = {2*eps, 0, 0, 0}; %! @@ -196,9 +198,10 @@ %! STR.string_fld = "Octave"; %! STR.struct_fld.x = 0; %! STR.struct_fld.y = 1; -%! -%! save struct.dat -struct STR; -%! STR = load ("struct.dat"); +%! +%! struct_dat = fullfile (P_tmpdir, "struct.dat"); +%! save (struct_dat, "-struct", "STR"); +%! STR = load (struct_dat); %! %! assert (STR.scalar_fld == 1 && ... %! STR.matrix_fld == [1.1,2;3,4] && ... @@ -206,9 +209,10 @@ %! STR.struct_fld.x == 0 && ... %! STR.struct_fld.y == 1 ); %! -%! -%! save -binary struct.dat -struct STR matrix_fld str*_fld; -%! STR = load ("struct.dat"); +%! +%! save ("-binary", struct_dat, +%! "-struct", "STR", "matrix_fld", "str*_fld"); +%! STR = load (struct_dat); %! %! assert (!isfield (STR,"scalar_fld") && ... %! STR.matrix_fld == [1.1,2;3,4] && ... @@ -216,15 +220,16 @@ %! STR.struct_fld.x == 0 && ... %! STR.struct_fld.y == 1); %! -%! delete struct.dat; +%! delete (struct_dat); %!test %! matrix1 = rand (100, 2); -%! save -ascii matrix.ascii matrix1 -%! matrix2 = load ("matrix.ascii"); +%! matrix_ascii = fullfile (P_tmpdir, "matrix.ascii"); +%! save ("-ascii", matrix_ascii, "matrix1") +%! matrix2 = load (matrix_ascii); %! assert (matrix1, matrix2, 1e-9); %! -%! delete matrix.ascii; +%! delete (matrix_ascii); %!error load ("")