summaryrefslogtreecommitdiffstats
path: root/tests/nonRegression/bug1629.sci
blob: 03f8610aa59301e1a3bb346c219c762857b104e6 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// <-- Non-regression test for bug 1629 -->
//
// <-- Bugzilla URL -->
// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1629
//
// <-- Short Description -->
//    Scila freezes when trying to convert the following m-file:
//    ----------------------------
//    function out=bug_test(par)
//    if (nargin<2)
//        par.a = 2;
//        par.p = 24;
//        par.v = 12;
//        par.m = 75;
//        par.n = 800;
//        par.q = 5;
//        par.r = 20;
//        par.i = 0.05;
//        par.z = 3.5;
//        par.l = -40;
//        par.d = 1000;
//        par.o = 8;
//        par.u = 0;
//    end
//    ---------------------
//    Note: without the nargin test surrounding the structure field assignments, the
// ...

// Copyright INRIA
// Scilab Project - F. Belahcene

MFILECONTENTS=["function out=bug1629(par)";
		"if (nargin<2)";
		"    par.a = 2;";
		"    par.p = 24;";
		"    par.v = 12;";
		"    par.m = 75;";
		"    par.n = 800;";
		"    par.q = 5;";
		"    par.r = 20;";
		"    par.i = 0.05;";
		"    par.z = 3.5;";
		"    par.l = -40;";
		"    par.d = 1000;";
		"    par.o = 8;";
		"    par.u = 0;";
		"end"]

MFILE=TMPDIR+"/bug1629.m"
SCIFILE=TMPDIR+"/bug1629.sci"

mputl(MFILECONTENTS,MFILE);
mfile2sci(MFILE,TMPDIR,%f,%t);
SCIFILECONTENTS=mgetl(SCIFILE);

SCIFILECONTENTSREF=["function [out] = bug1629(par)";
		"";
		"// Ouput variables initialisation (not found in input variables)";
		"out=[];";
		"";
		"// Number of arguments in function call";
		"[%nargout,%nargin] = argn(0)";
		"";
		"// Display mode";
		"mode(0);";
		"";
		"// Display warning for floating point exception";
		"ieee(1);";
		"";
		"if %nargin<2 then";
		"  par.a = 2;";
		"  par.p = 24;";
		"  par.v = 12;";
		"  par.m = 75;";
		"  par.n = 800;";
		"  par.q = 5;";
		"  par.r = 20;";
		"  par.i = 0.05;";
		"  par.z = 3.5;";
		"  par.l = -40;";
		"  par.d = 1000;";
		"  par.o = 8;";
		"  par.u = 0;";
		"end;";
		"endfunction"]



if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
	affich_result(%F,1629);
else
	affich_result(%T,1629);
end