1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5//  This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- CLI SHELL MODE -->
9//
10// <-- Non-regression test for bug 7125 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=7125
14//
15// <-- Short Description -->
16// fscanfMat() did not read correctly %inf ,-%inf and %nan values respectively
17// recorded by fprintfMat()
18//
19//==============================================================================
20M = [1 , %nan , 3; -%inf, 2, %inf];
21fprintfMat(TMPDIR + '/bug_7125_1.mat', M);
22r = fscanfMat(TMPDIR + '/bug_7125_1.mat');
23if ~and(size(r) == [2 3]) then bugmes();quit;end
24ref_cmp = [%T %F %T; %T %T %T];
25if ~and((r == M) == ref_cmp) then bugmes();quit;end
26//==============================================================================
27[r, t] = fscanfMat(TMPDIR + '/bug_7125_1.mat');
28if ~and(size(r) == [2 3]) then bugmes();quit;end
29ref_cmp = [%T %F %T; %T %T %T];
30if ~and((r == M) == ref_cmp) then bugmes();quit;end
31if t <> '' then bugmes();quit;end
32//==============================================================================
33text = ['text'; 'from'; 'scilab Mat file'];
34M = [1 , %nan , 3; -%inf, 2, %inf];
35fprintfMat(TMPDIR + '/bug_7125_2.mat', M, "%f", text);
36[r, t] = fscanfMat(TMPDIR + '/bug_7125_2.mat');
37if ~and(t == text) then bugmes();quit;end
38//==============================================================================
39M = eye(50,50);
40fprintfMat(TMPDIR + '/bug_7125_3.mat', M);
41r = fscanfMat(TMPDIR + '/bug_7125_3.mat');
42if ~and(size(r) == [50 50]) then bugmes();quit;end
43if ~and(r == M) then bugmes();quit;end
44//==============================================================================
45