summaryrefslogtreecommitdiffstats
path: root/tests/nonRegression/bug2149.sci
blob: c96487d98a39c9d40364485551e1288ff82c4253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// <-- Non-regression test for bug 2149 -->
//
// <-- Bugzilla URL -->
// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=2149
//
// <-- Short Description -->
//    Missing error message in fprintfMat
//
//
//    help fprintfMat states that the matrix to save must be a matrix of real 
//    numbers. Therefore:
//
//    -->M=[1+%i;1-%i];
//
//    -->fprintfMat("mymatrix.txt",M,"%f")
//
//    -->
//    should spit an error. It does not but it silently saves the real part 
//    of M instead.
//
//    Another (better) option: extend fprintfMat/scanfMat so that they work 
//    with complex matrices (or matrices of integers, booleans, etc).
//
//    Francois

// Copyright INRIA
// Scilab Project - Allan CORNET
// Copyright INRIA 2006

correctItem=0;

M=[1+%i;2+3*%i] ;
try
	fprintfMat(TMPDIR+'/pipo.txt',M,'%f',['comment un';'comment 2'])
	correct=%T;
catch
  correctItem=correctItem+1;
end

M=[1.2,2.3];
try
	fprintfMat(TMPDIR+'/pipo.txt',M,'%f',['comment un';'comment 2'])
catch
  correctItem=correctItem+1;
end

try
	fprintfMat(TMPDIR+'/pipo.txt','M','%f',['comment un';'comment 2'])
	correct=%T;
catch
  correctItem=correctItem+1;
end

if (correctItem == 2) then
  affich_result(%T,2149);
else
	affich_result(%F,2149);
end