summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre Marechal <pierre.marechal@scilab.org>2007-11-22 15:57:29 +0000
committerPierre Marechal <pierre.marechal@scilab.org>2007-11-22 15:57:29 +0000
commit5eb4eecf7e30232877aa75365ca1a3cacc9bb246 (patch)
treedc648ee9931d1c11ccadc7e7702f96adebc9ff26 /tests
parente869e49a4a3a9c1c632d5ba161d264e495a430c8 (diff)
downloadscilab-5eb4eecf7e30232877aa75365ca1a3cacc9bb246.zip
scilab-5eb4eecf7e30232877aa75365ca1a3cacc9bb246.tar.gz
Incoporate m2sci non-regression tests in the scilab source tree
Diffstat (limited to 'tests')
-rw-r--r--tests/nonRegression/bug1262.sci86
-rw-r--r--tests/nonRegression/bug1468.sci43
-rw-r--r--tests/nonRegression/bug1629.sci93
-rw-r--r--tests/nonRegression/bug1812.sci80
-rw-r--r--tests/nonRegression/bug1971.sci48
-rw-r--r--tests/nonRegression/bug2137.sci59
-rw-r--r--tests/nonRegression/bug2341.sci105
-rw-r--r--tests/nonRegression/bug682.sci42
-rw-r--r--tests/nonRegression/bug683.sci67
-rw-r--r--tests/nonRegression/bug750.sci45
-rw-r--r--tests/nonRegression/bug800.sci46
-rw-r--r--tests/nonRegression/bug857.sci111
-rw-r--r--tests/nonRegression/bug859.sci50
-rw-r--r--tests/nonRegression/bug862.sci51
-rw-r--r--tests/nonRegression/bug924.sci72
-rw-r--r--tests/nonRegression/bug925.sci57
-rw-r--r--tests/nonRegression/bug942.sci51
-rw-r--r--tests/nonRegression/bug943.sci66
-rw-r--r--tests/nonRegression/bug945.sci46
-rw-r--r--tests/nonRegression/bug946.sci42
-rw-r--r--tests/nonRegression/bug979.sci40
21 files changed, 0 insertions, 1300 deletions
diff --git a/tests/nonRegression/bug1262.sci b/tests/nonRegression/bug1262.sci
deleted file mode 100644
index 7e9d83e..0000000
--- a/tests/nonRegression/bug1262.sci
+++ /dev/null
@@ -1,86 +0,0 @@
1// <-- Non-regression test for bug 1262 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1262
5//
6// <-- Short Description -->
7// Four errors of mfile2sci are reported
8// (scilab-3.0-u-20050309) Linux+Windows+Solaris.
9//
10// Briefly:
11// 1) end; end -> endend
12// 2) Initialization to empty matrix at wrong place
13// 3) Problem with useless [ or ]
14// 4) -(A-B) -> -A-B
15//
16// Apply mfile2sci to the Matlab script given below.
17
18// Copyright INRIA
19// Scilab Project - F.Belahcene
20
21// Modified by Pierre MARECHAL
22// Scilab Project
23// 20 mai 2005
24
25MFILECONTENTS=["A = rand(3,3);"
26 ""
27 "for ii=1:3; for jj=1:3; disp(A(ii,jj)); end; end"
28 ""
29 "k=0;"
30 "for ii=1:3;"
31 " for jj=1:3;"
32 " if k>2 then"
33 " B(ii,jj) = A(ii,jj);"
34 " k = 0;"
35 " else"
36 " k = k+1;"
37 " end;"
38 " end;"
39 "end;"
40 ""
41 "C = [A [A [1;2;3]]];"
42 ""
43 "B = -(A-A)"]
44
45MFILE=TMPDIR+"/bug1262.m"
46SCIFILE=TMPDIR+"/bug1262.sci"
47
48mputl(MFILECONTENTS,MFILE);
49
50mfile2sci(MFILE,TMPDIR);
51SCIFILECONTENTS=mgetl(SCIFILE);
52
53
54SCIFILECONTENTSREF=["";
55 "// Display mode";
56 "mode(0);";
57 "";
58 "// Display warning for floating point exception";
59 "ieee(1);";
60 "";
61 "A = rand(3,3);"
62 ""
63 "for ii = 1:3 for jj = 1:3 disp(A(ii,jj));end;end;"
64 ""
65 "k = 0;"
66 "for ii = 1:3"
67 " for jj = 1:3"
68 " if k>2 then"
69 " B(ii,jj) = A(ii,jj);"
70 " k = 0;"
71 " else"
72 " k = k+1;"
73 " end;"
74 " end;"
75 "end;"
76 ""
77 "C = [A,A,[1;2;3]];"
78 ""
79 "B = -(A-A)"]
80
81correct=%T
82if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
83 correct=%F
84end
85
86affich_result(correct,1262);
diff --git a/tests/nonRegression/bug1468.sci b/tests/nonRegression/bug1468.sci
deleted file mode 100644
index 568e67a..0000000
--- a/tests/nonRegression/bug1468.sci
+++ /dev/null
@@ -1,43 +0,0 @@
1// <-- Non-regression test for bug 1468 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1468
5//
6// <-- Short Description -->
7// 1) 'macr2tree' function doesn't work correctly with the following script
8
9
10 // Non-regression test file for bug 1468
11// Copyright INRIA
12// Scilab Project - F. Belahcene
13
14MFILECONTENTS=["beep";
15 "beep on";
16 "beep off";
17 "s = beep()"]
18
19MFILE=TMPDIR+"/bug1468.m"
20SCIFILE=TMPDIR+"/bug1468.sci"
21
22mputl(MFILECONTENTS,MFILE);
23mfile2sci(MFILE,TMPDIR,%f,%t);
24SCIFILECONTENTS=mgetl(SCIFILE);
25
26SCIFILECONTENTSREF=["";
27 "// Display mode";
28 "mode(0);"
29 "";
30 "// Display warning for floating point exception";
31 "ieee(1);";
32 "";
33 "beep";
34 "beep(""on"")";
35 "beep(""off"")";
36 "s = beep()"]
37
38
39if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
40 affich_result(%F,924);
41else
42 affich_result(%T,924);
43end
diff --git a/tests/nonRegression/bug1629.sci b/tests/nonRegression/bug1629.sci
deleted file mode 100644
index 03f8610..0000000
--- a/tests/nonRegression/bug1629.sci
+++ /dev/null
@@ -1,93 +0,0 @@
1// <-- Non-regression test for bug 1629 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1629
5//
6// <-- Short Description -->
7// Scila freezes when trying to convert the following m-file:
8// ----------------------------
9// function out=bug_test(par)
10// if (nargin<2)
11// par.a = 2;
12// par.p = 24;
13// par.v = 12;
14// par.m = 75;
15// par.n = 800;
16// par.q = 5;
17// par.r = 20;
18// par.i = 0.05;
19// par.z = 3.5;
20// par.l = -40;
21// par.d = 1000;
22// par.o = 8;
23// par.u = 0;
24// end
25// ---------------------
26// Note: without the nargin test surrounding the structure field assignments, the
27// ...
28
29// Copyright INRIA
30// Scilab Project - F. Belahcene
31
32MFILECONTENTS=["function out=bug1629(par)";
33 "if (nargin<2)";
34 " par.a = 2;";
35 " par.p = 24;";
36 " par.v = 12;";
37 " par.m = 75;";
38 " par.n = 800;";
39 " par.q = 5;";
40 " par.r = 20;";
41 " par.i = 0.05;";
42 " par.z = 3.5;";
43 " par.l = -40;";
44 " par.d = 1000;";
45 " par.o = 8;";
46 " par.u = 0;";
47 "end"]
48
49MFILE=TMPDIR+"/bug1629.m"
50SCIFILE=TMPDIR+"/bug1629.sci"
51
52mputl(MFILECONTENTS,MFILE);
53mfile2sci(MFILE,TMPDIR,%f,%t);
54SCIFILECONTENTS=mgetl(SCIFILE);
55
56SCIFILECONTENTSREF=["function [out] = bug1629(par)";
57 "";
58 "// Ouput variables initialisation (not found in input variables)";
59 "out=[];";
60 "";
61 "// Number of arguments in function call";
62 "[%nargout,%nargin] = argn(0)";
63 "";
64 "// Display mode";
65 "mode(0);";
66 "";
67 "// Display warning for floating point exception";
68 "ieee(1);";
69 "";
70 "if %nargin<2 then";
71 " par.a = 2;";
72 " par.p = 24;";
73 " par.v = 12;";
74 " par.m = 75;";
75 " par.n = 800;";
76 " par.q = 5;";
77 " par.r = 20;";
78 " par.i = 0.05;";
79 " par.z = 3.5;";
80 " par.l = -40;";
81 " par.d = 1000;";
82 " par.o = 8;";
83 " par.u = 0;";
84 "end;";
85 "endfunction"]
86
87
88
89if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
90 affich_result(%F,1629);
91else
92 affich_result(%T,1629);
93end
diff --git a/tests/nonRegression/bug1812.sci b/tests/nonRegression/bug1812.sci
deleted file mode 100644
index 800dd60..0000000
--- a/tests/nonRegression/bug1812.sci
+++ /dev/null
@@ -1,80 +0,0 @@
1// <-- Non-regression test for bug 1812 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1812
5//
6// <-- Short Description -->
7// error in converting matlab || as && and other translator doubts
8
9// Copyright INRIA
10// Scilab Project - F. Belahcene
11
12MFILECONTENTS=[
13"m=3; a=5; b=2; c=3; d=6";
14" ";
15"if a==0 && b==2";
16"m=2";
17"end";
18" ";
19"if a==0 && b==2 && c==3 && d==4";
20"m=2";
21"end";
22" ";
23"if a==0 && b==2";
24"m=2";
25"end";
26" ";
27"if a==0 || b==2 || c==3 || d==4";
28"m=2";
29"end"
30]
31
32MFILE=TMPDIR+"/bug1812.m"
33SCIFILE=TMPDIR+"/bug1812.sci"
34
35fd=mopen(MFILE,"w");
36mputl(MFILECONTENTS,fd);
37mclose(fd);
38
39mfile2sci(MFILE,TMPDIR);
40
41fd=mopen(SCIFILE,"r");
42SCIFILECONTENTS=mgetl(fd,-1);
43mclose(fd);
44
45SCIFILECONTENTSREF=["";
46"// Display mode";
47"mode(0);";
48"";
49"// Display warning for floating point exception";
50"ieee(1);";
51"";
52"m = 3;a = 5;b = 2;c = 3;d = 6";
53"";
54"%v02 = bool2s(%f);if bool2s(a==0) then %v02 = bool2s(b==2);end;";
55"if %v02 then";
56" m = 2";
57"end;";
58"";
59"%v02 = bool2s(%f);if bool2s(a==0) then %v02 = bool2s(b==2);end;%v12 = bool2s(%f);if %v02 then %v12 = bool2s(c==3);end;";
60"if %v12&bool2s(d==4) then";
61" m = 2";
62"end;";
63"";
64"%v02 = bool2s(%f);if bool2s(a==0) then %v02 = bool2s(b==2);end;";
65"if %v02 then";
66" m = 2";
67"end;";
68"";
69"%v02 = bool2s(%t);if ~bool2s(a==0) then %v02 = bool2s(b==2);end;%v12 = bool2s(%t);if ~%v02 then %v12 = bool2s(c==3);end;";
70"if %v12|bool2s(d==4) then";
71" m = 2";
72"end;";
73]
74
75correct=%T
76if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
77 correct=%F
78end
79
80affich_result(correct,1812);
diff --git a/tests/nonRegression/bug1971.sci b/tests/nonRegression/bug1971.sci
deleted file mode 100644
index b5a640b..0000000
--- a/tests/nonRegression/bug1971.sci
+++ /dev/null
@@ -1,48 +0,0 @@
1// <-- Non-regression test for bug 1971 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=1971
5//
6// <-- Short Description -->
7// the mtlb_fprintf does not work. It should be re-written to follow the Matlab doc
8// of fprintf
9
10// Copyright INRIA
11// Scilab Project - F. Belahcene
12
13MFILECONTENTS=[
14"fprintf(''qsdfsdcvwqghcv'')";
15]
16
17MFILE=TMPDIR+"/bug1971.m"
18SCIFILE=TMPDIR+"/bug1971.sci"
19
20fd=mopen(MFILE,"w");
21mputl(MFILECONTENTS,fd);
22mclose(fd);
23
24mfile2sci(MFILE,TMPDIR);
25
26fd=mopen(SCIFILE,"r");
27SCIFILECONTENTS=mgetl(fd,-1);
28mclose(fd);
29
30SCIFILECONTENTSREF=["";
31"// Display mode";
32"mode(0);";
33"";
34"// Display warning for floating point exception";
35"ieee(1);";
36"";
37"// L.1: No simple equivalent, so mtlb_fprintf() is called";
38"mtlb_fprintf(""qsdfsdcvwqghcv"")";
39]
40
41correct=%T
42if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
43 correct=%F
44end
45instr='mtlb_fprintf(""qsdfsdcvwqghcv"")';
46ierr=execstr(instr,'errcatch')
47if ierr<>0 then correct=%F, end
48affich_result(correct,1971);
diff --git a/tests/nonRegression/bug2137.sci b/tests/nonRegression/bug2137.sci
deleted file mode 100644
index ff444a0..0000000
--- a/tests/nonRegression/bug2137.sci
+++ /dev/null
@@ -1,59 +0,0 @@
1// <-- Non-regression test for bug 2137 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=2137
5//
6// <-- Short Description -->
7// wrong translation of Matlab function randn
8//
9//
10// Put this single line in an m-file:
11//
12// R = randn
13//
14// and try to convert using mfile2sci.
15//
16// Output is:
17//
18// R = randn(1,1,"normal")
19//
20// which is wrong (no such function in Scilab).
21//
22// Francois
23
24// Copyright INRIA
25// Scilab Project - F. Belahcene
26
27MFILECONTENTS=[
28"R = randn;";
29]
30
31MFILE=TMPDIR+"/bug2137.m"
32SCIFILE=TMPDIR+"/bug2137.sci"
33
34fd=mopen(MFILE,"w");
35mputl(MFILECONTENTS,fd);
36mclose(fd);
37
38mfile2sci(MFILE,TMPDIR);
39
40fd=mopen(SCIFILE,"r");
41SCIFILECONTENTS=mgetl(fd,-1);
42mclose(fd);
43
44SCIFILECONTENTSREF=["";
45"// Display mode";
46"mode(0);";
47"";
48"// Display warning for floating point exception";
49"ieee(1);";
50"";
51"R = rand(1,1,""normal"");";
52]
53
54correct=%T
55if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
56 correct=%F
57end
58
59affich_result(correct,2137);
diff --git a/tests/nonRegression/bug2341.sci b/tests/nonRegression/bug2341.sci
deleted file mode 100644
index fb18e88..0000000
--- a/tests/nonRegression/bug2341.sci
+++ /dev/null
@@ -1,105 +0,0 @@
1// <-- Non-regression test for bug 2341 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=2341
5//
6// <-- Short Description -->
7// unhandled matlab syntax for lhs (Matlab accepts lhs calling sequence without commas
8
9// Copyright INRIA
10// Scilab Project - Vincent COUVERT
11
12MFILE=TMPDIR+"/bug2341.m"
13SCIFILE=TMPDIR+"/bug2341.sci"
14
15correct=%T;
16
17// TEST1: no commas
18MFILECONTENTS=["function [a b c d]=bug2341";
19"a=1;b=2;c=3;d=4"]
20
21fd=mopen(MFILE,"w");
22mputl(MFILECONTENTS,fd);
23mclose(fd);
24
25ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
26correct=correct&ierr==0;
27
28// TEST2: commas OK without spaces
29MFILECONTENTS=["function [a,b,c,d]=bug2341";
30"a=1;b=2;c=3;d=4"]
31
32fd=mopen(MFILE,"w");
33mputl(MFILECONTENTS,fd);
34mclose(fd);
35
36ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
37correct=correct&ierr==0;
38
39// TEST3: commas OK with spaces before
40MFILECONTENTS=["function [a ,b ,c ,d]=bug2341";
41"a=1;b=2;c=3;d=4"]
42
43fd=mopen(MFILE,"w");
44mputl(MFILECONTENTS,fd);
45mclose(fd);
46
47ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
48correct=correct&ierr==0;
49
50// TEST4: commas OK with spaces after
51MFILECONTENTS=["function [a, b, c, d]=bug2341";
52"a=1;b=2;c=3;d=4"]
53
54fd=mopen(MFILE,"w");
55mputl(MFILECONTENTS,fd);
56mclose(fd);
57
58ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
59correct=correct&ierr==0;
60
61// TEST5: commas OK with spaces after and before
62MFILECONTENTS=["function [a , b, c ,d]=bug2341";
63"a=1;b=2;c=3;d=4"]
64
65fd=mopen(MFILE,"w");
66mputl(MFILECONTENTS,fd);
67mclose(fd);
68
69ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
70correct=correct&ierr==0;
71
72// TEST6: commas OK or KO
73MFILECONTENTS=["function [a b, c d]=bug2341";
74"a=1;b=2;c=3;d=4"]
75
76fd=mopen(MFILE,"w");
77mputl(MFILECONTENTS,fd);
78mclose(fd);
79
80ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
81correct=correct&ierr==0;
82
83// TEST7: one output
84MFILECONTENTS=["function [a]=bug2341";
85"a=1;"]
86
87fd=mopen(MFILE,"w");
88mputl(MFILECONTENTS,fd);
89mclose(fd);
90
91ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
92correct=correct&ierr==0;
93
94// TEST8: one output with blanks
95MFILECONTENTS=["function [ a ]=bug2341";
96"a=1;"]
97
98fd=mopen(MFILE,"w");
99mputl(MFILECONTENTS,fd);
100mclose(fd);
101
102ierr=execstr("mfile2sci("""+MFILE+""","""+TMPDIR+""")","errcatch")
103correct=correct&ierr==0;
104
105affich_result(correct,2341);
diff --git a/tests/nonRegression/bug682.sci b/tests/nonRegression/bug682.sci
deleted file mode 100644
index e562a53..0000000
--- a/tests/nonRegression/bug682.sci
+++ /dev/null
@@ -1,42 +0,0 @@
1// <-- Non-regression test for bug 682 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=682
5//
6// <-- Short Description -->
7// probleme with the logical or in tests.
8
9// Copyright INRIA
10// Scilab Project - V. Couvert
11
12// Modified by Pierre MARECHAL
13// Copyright INRIA
14// Date : 22 Mar 2005
15
16MFILECONTENTS=["b=1;";"if b==0 | b(2)>0";" a = 1;";" else a = 0;";"end"]
17
18MFILE=TMPDIR+"/bug682.m"
19SCIFILE=TMPDIR+"/bug682.sci"
20
21mputl(MFILECONTENTS,MFILE);
22mfile2sci(MFILE,TMPDIR);
23SCIFILECONTENTS=mgetl(SCIFILE);
24
25SCIFILECONTENTSREF=["";
26 "// Display mode";
27 "mode(0);";
28 "";
29 "// Display warning for floating point exception";
30 "ieee(1);";
31 "";
32 "b = 1;";
33 "if bool2s(b==0)|bool2s(b(2)>0) then";
34 " a = 1;";
35 "else a = 0;";
36 "end;"]
37
38if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
39 affich_result(%F,682);
40else
41 affich_result(%T,682);
42end
diff --git a/tests/nonRegression/bug683.sci b/tests/nonRegression/bug683.sci
deleted file mode 100644
index c5a7aa8..0000000
--- a/tests/nonRegression/bug683.sci
+++ /dev/null
@@ -1,67 +0,0 @@
1// <-- Non-regression test for bug 683 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=683
5//
6// <-- Short Description -->
7// problem with makecell : when a makecell input is an input of
8// the main function, makecell doesn't give this input value to
9// the created cell. Strange behavior...
10
11// Copyright INRIA
12// Scilab Project - V. Couvert
13
14// Create 2 M-files
15MFUN1TXT=["function [a,c] = test_cell1(b)";
16"a = {1,b,''c''};";
17"c = {1,2,''c''};"]
18
19MFUN2TXT=["function a = test_cell2()";
20"e = ''we'';";
21"a = {1,2,e};"]
22
23MFILE1=TMPDIR+"/test_cell1.m";
24MFILE2=TMPDIR+"/test_cell2.m";
25
26fd=mopen(MFILE1,"w");
27mputl(MFUN1TXT,fd);
28mclose(fd);
29
30fd=mopen(MFILE2,"w");
31mputl(MFUN2TXT,fd);
32mclose(fd);
33
34// Convert M-files to Scilab
35mfile2sci(MFILE1,TMPDIR);
36mfile2sci(MFILE2,TMPDIR);
37
38// Load functions into Scilab
39SCIFILE1=TMPDIR+"/test_cell1.sci";
40SCIFILE2=TMPDIR+"/test_cell2.sci";
41
42getf(SCIFILE1);
43getf(SCIFILE2);
44
45// Exec functions
46[ce1,ce2] = test_cell1(23);
47[ce3,ce4] = test_cell1([1 2]);
48ce5=test_cell2();
49
50// Verify results
51correct1=and(ce1==mlist(["ce","dims","entries"],int32([1 3]),list(1,23,"c")))
52affich_result(correct1,681.1);
53
54correct2=and(ce2==mlist(["ce","dims","entries"],int32([1 3]),list(1,2,"c")))
55affich_result(correct2,681.2);
56
57correct3=and(ce3==mlist(["ce","dims","entries"],int32([1 3]),list(1,[1 2],"c")))
58affich_result(correct3,681.3);
59
60correct4=and(ce4==mlist(["ce","dims","entries"],int32([1 3]),list(1,2,"c")))
61affich_result(correct4,681.4);
62
63correct5=and(ce5==mlist(["ce","dims","entries"],int32([1 3]),list(1,2,"we")))
64affich_result(correct5,681.5);
65
66correct=correct1&correct2&correct3&correct4&correct5
67affich_result(correct,681);
diff --git a/tests/nonRegression/bug750.sci b/tests/nonRegression/bug750.sci
deleted file mode 100644
index bc4ecd3..0000000
--- a/tests/nonRegression/bug750.sci
+++ /dev/null
@@ -1,45 +0,0 @@
1// <-- Non-regression test for bug 750 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=750
5//
6// <-- Short Description -->
7// I try to translate to Scilab the benchmark m-file of matlab.
8// This should give a comparison of scilab and matlab execution
9// times.
10//
11// It does not translate. Too bad...
12
13// Copyright INRIA
14// Scilab Project - V. Couvert
15
16// Modified by Pierre MARECHAL
17// Copyright INRIA
18// Date : 22 Mar 2005
19
20MFILECONTENTS=["t=[];";"cputime;";"t(10)=cputime;"]
21
22MFILE=TMPDIR+"/bug750.m"
23SCIFILE=TMPDIR+"/bug750.sci"
24
25mputl(MFILECONTENTS,MFILE);
26mfile2sci(MFILE,TMPDIR);
27SCIFILECONTENTS=mgetl(SCIFILE);
28
29SCIFILECONTENTSREF=["";
30 "// Display mode";
31 "mode(0);";
32 "";
33 "// Display warning for floating point exception";
34 "ieee(1);";
35 "";
36 "t = [];";
37 "timer;";
38 "t(1,10) = timer();"]
39
40
41if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
42 affich_result(%F,750);
43else
44 affich_result(%T,750);
45end
diff --git a/tests/nonRegression/bug800.sci b/tests/nonRegression/bug800.sci
deleted file mode 100644
index 3a7e0e0..0000000
--- a/tests/nonRegression/bug800.sci
+++ /dev/null
@@ -1,46 +0,0 @@
1// <-- Non-regression test for bug 800 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=800
5//
6// <-- Short Description -->
7// mfile2sci can not convert expressions such as
8// x=1/ -2;
9// (Blank space between / and - is important, it works if no
10// blank space)
11
12// Copyright INRIA
13// Scilab Project - V. Couvert
14
15// Modified by Pierre MARECHAL
16// Copyright INRIA
17// Date : 18 Mar 2005
18
19MFILECONTENTS=["a=1/-2;";"b=1/-23;";"c=1/-25;";"d=1/ -c;";"e=1 / -36;x=1/-2";"f=1 / (-36);"]
20
21MFILE=TMPDIR+"/bug800.m"
22SCIFILE=TMPDIR+"/bug800.sci"
23
24mputl(MFILECONTENTS,MFILE);
25mfile2sci(MFILE,TMPDIR);
26SCIFILECONTENTS=mgetl(SCIFILE);
27
28SCIFILECONTENTSREF=["";
29 "// Display mode";
30 "mode(0);";
31 "";
32 "// Display warning for floating point exception";
33 "ieee(1);";
34 "";
35 "a = 1/(-2);";
36 "b = 1/(-23);";
37 "c = 1/(-25);";
38 "d = 1/(-c);";
39 "e = 1/(-36);x = 1/(-2)";
40 "f = 1/(-36);"]
41
42if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
43 affich_result(%F,800);
44else
45 affich_result(%T,800);
46end
diff --git a/tests/nonRegression/bug857.sci b/tests/nonRegression/bug857.sci
deleted file mode 100644
index aa4d5a6..0000000
--- a/tests/nonRegression/bug857.sci
+++ /dev/null
@@ -1,111 +0,0 @@
1// <-- Non-regression test for bug 857 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=857
5//
6// <-- Short Description -->
7// Imaginary unit i and index loop i in an M-file are both
8// converted to %i in Scilab...
9//
10// for i=1:10
11// disp(i)
12// end
13//
14// is converted as follows :
15//
16// for i=1:10
17// disp(%i)
18// end
19//
20// TOO BAD !
21
22// Copyright INRIA
23// Scilab Project - V. Couvert
24
25// Modified by Pierre MARECHAL
26// Copyright INRIA
27// Date : 18 Mar 2005
28
29MFILECONTENTS=["% i and j do not exist as variables -> Imaginary unit";
30 "a=1+2*i";
31 "b=1+2*j";
32 "% Two complex values";
33 "icplxnumber=1+2i;";
34 "jcplxnumber=1+2j;";
35 "chgt_rampe=[];";
36 "for k=1:10";
37 " for i=1:10";
38 " for j=1:10";
39 " chgt_rampe(k)=2*i-j+1;";
40 " end;";
41 " end;";
42 "end;";
43 "% Two complex values";
44 "icplxnumber2=1+3i;";
45 "jcplxnumber2=1+3j;";
46 "% Two real values";
47 "irealnumber=1+4*i;";
48 "jrealnumber=1+4*j;";
49 "nbrserie=30";
50 "for i=1:nbrserie";
51 " if nbrserie==24";
52 " switch i";
53 " case 1";
54 " disp(i)";
55 " else";
56 " disp(''abcd'')";
57 " end;";
58 " end;";
59 "end;"]
60
61MFILE=TMPDIR+"/bug857.m"
62SCIFILE=TMPDIR+"/bug857.sci"
63
64mputl(MFILECONTENTS,MFILE);
65mfile2sci(MFILE,TMPDIR);
66SCIFILECONTENTS=mgetl(SCIFILE);
67
68SCIFILECONTENTSREF=["";
69 "// Display mode";
70 "mode(0);";
71 "";
72 "// Display warning for floating point exception";
73 "ieee(1);";
74 "";
75 "// i and j do not exist as variables -> Imaginary unit";
76 "a = 1+2*%i";
77 "b = 1+2*%i";
78 "// Two complex values";
79 "icplxnumber = 1+2*%i;";
80 "jcplxnumber = 1+2*%i;";
81 "chgt_rampe = [];";
82 "for k = 1:10";
83 " for i = 1:10";
84 " for j = 1:10";
85 " chgt_rampe(1,k) = 2*i-j+1;";
86 " end;";
87 " end;";
88 "end;";
89 "// Two complex values";
90 "icplxnumber2 = 1+3*%i;";
91 "jcplxnumber2 = 1+3*%i;";
92 "// Two real values";
93 "irealnumber = 1+4*i;";
94 "jrealnumber = 1+4*j;";
95 "nbrserie = 30";
96 "for i = 1:nbrserie";
97 " if nbrserie==24 then";
98 " select i";
99 " case 1 then";
100 " disp(i)";
101 " else";
102 " disp(""abcd"")";
103 " end;";
104 " end;";
105 "end;"]
106
107if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
108 affich_result(%F,857);
109else
110 affich_result(%T,857);
111end
diff --git a/tests/nonRegression/bug859.sci b/tests/nonRegression/bug859.sci
deleted file mode 100644
index 567347f..0000000
--- a/tests/nonRegression/bug859.sci
+++ /dev/null
@@ -1,50 +0,0 @@
1// <-- Non-regression test for bug 859 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=859
5//
6// <-- Short Description -->
7// M2SCI convert Matlab expression such as a(n,:)=b(m,:) (with
8// a==[])by a(n,:)=b(m,:) but execution crashes.
9
10// Copyright INRIA
11// Scilab Project - V. Couvert
12
13// Modified by Pierre MARECHAL
14// Copyright INRIA
15// Date : 18 Mar 2005
16
17MFILECONTENTS=["result=ones(10,10);";
18 "m=1;";
19 "for h=1:10";
20 " result_bis(m,:) = result(h,:);";
21 " m = m + 1;";
22 "end"]
23
24MFILE=TMPDIR+"/bug859.m"
25SCIFILE=TMPDIR+"/bug859.sci"
26
27mputl(MFILECONTENTS,MFILE);
28mfile2sci(MFILE,TMPDIR);
29SCIFILECONTENTS=mgetl(SCIFILE);
30
31SCIFILECONTENTSREF=["";
32 "// Display mode";
33 "mode(0);";
34 "";
35 "// Display warning for floating point exception";
36 "ieee(1);";
37 "";
38 "result = ones(10,10);";
39 "m = 1;";
40 "for h = 1:10";
41 " result_bis(m,1:length(result(h,:))) = result(h,:);";
42 " m = m+1;";
43 "end;"]
44
45if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
46 affich_result(%F,859);
47else
48 affich_result(%T,859);
49end
50
diff --git a/tests/nonRegression/bug862.sci b/tests/nonRegression/bug862.sci
deleted file mode 100644
index e29a790..0000000
--- a/tests/nonRegression/bug862.sci
+++ /dev/null
@@ -1,51 +0,0 @@
1// <-- Non-regression test for bug 862 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=862
5//
6// <-- Short Description -->
7// Conversion si bad for instructions such as:
8// ->Matlab:
9// a(1)=0;
10// with a not initialised
11// ->Scilab conversion:
12// a = mtlb_i(a,1,0);
13//
14// Execution crashes
15// a = mtlb_i(a,1,0)
16// !--error 4
17// undefined variable : a
18
19// Copyright INRIA
20// Scilab Project - V. Couvert
21
22MFILECONTENTS="a(1)=0;"
23
24MFILE=TMPDIR+"/bug862.m"
25SCIFILE=TMPDIR+"/bug862.sci"
26
27fd=mopen(MFILE,"w");
28mputl(MFILECONTENTS,fd);
29mclose(fd);
30
31mfile2sci(MFILE,TMPDIR);
32
33fd=mopen(SCIFILE,"r");
34SCIFILECONTENTS=mgetl(fd,-1);
35mclose(fd);
36
37SCIFILECONTENTSREF=["";
38"// Display mode";
39"mode(0);";
40"";
41"// Display warning for floating point exception";
42"ieee(1);";
43"";
44"a(1,1) = 0;"]
45
46correct=%T
47if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
48 correct=%F
49end
50
51affich_result(correct,862);
diff --git a/tests/nonRegression/bug924.sci b/tests/nonRegression/bug924.sci
deleted file mode 100644
index ead4443..0000000
--- a/tests/nonRegression/bug924.sci
+++ /dev/null
@@ -1,72 +0,0 @@
1// <-- Non-regression test for bug 924 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=924
5//
6// <-- Short Description -->
7// Bad handling of variable display in functions.
8// Following Matlab code :
9// function test
10// a='milou'
11// a
12// sould be converted to Scilab code :
13// function test
14// a='milou'
15// disp(a)
16// but it is not....
17
18// Copyright INRIA
19// Scilab Project - V. Couvert
20
21// Modified by Pierre MARECHAL
22// Copyright INRIA
23// Date : 18 Mar 2005
24
25MFILECONTENTS=["function bug924";
26 "a=''milou'';";
27 "a=''milou'',";
28 "a=''milou''";
29 "a;";
30 "a,";
31 "a";
32 "[c,d]=svd(1);";
33 "[c,d]=svd(1),";
34 "[c,d]=svd(1)";
35 "b=a;";
36 "b=a,";
37 "b=a"]
38
39MFILE=TMPDIR+"/bug924.m"
40SCIFILE=TMPDIR+"/bug924.sci"
41
42mputl(MFILECONTENTS,MFILE);
43mfile2sci(MFILE,TMPDIR);
44SCIFILECONTENTS=mgetl(SCIFILE);
45
46SCIFILECONTENTSREF=["function [] = bug924()";
47 "";
48 "// Display mode";
49 "mode(0);";
50 "";
51 "// Display warning for floating point exception";
52 "ieee(1);";
53 "";
54 "a = ""milou"";";
55 "a = ""milou"",";
56 "a = ""milou""";
57 "a;";
58 "a,";
59 "a";
60 "[c,d] = svd(1);";
61 "[c,d] = svd(1),";
62 "[c,d] = svd(1)";
63 "b = a;";
64 "b = a,";
65 "b = a";
66 "endfunction"]
67
68if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
69 affich_result(%F,924);
70else
71 affich_result(%T,924);
72end
diff --git a/tests/nonRegression/bug925.sci b/tests/nonRegression/bug925.sci
deleted file mode 100644
index 5ea7d97..0000000
--- a/tests/nonRegression/bug925.sci
+++ /dev/null
@@ -1,57 +0,0 @@
1// <-- Non-regression test for bug 925 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=925
5//
6// <-- Short Description -->
7// Bad insertion conversion
8//
9// Following Matlab code:
10// function test(A,B)
11// A(3)=B(4);
12//
13// is converted to Scilab code :
14// function [] = test(A,B)
15//
16// // Display warning for floating point exception
17// ieee(1)
18//
19// A = mtlb_i(A,1,mtlb_e(B,3));
20// endfunction
21//
22// what is obviously wrong !
23// 4 has become 1 ....
24
25// Copyright INRIA
26// Scilab Project - V. Couvert
27
28// Modified by Pierre MARECHAL
29// Copyright INRIA
30// Date : 18 Mar 2005
31
32MFILECONTENTS=["function bug925(A,B)";"A(4)=B(3)"]
33
34MFILE=TMPDIR+"/bug925.m"
35SCIFILE=TMPDIR+"/bug925.sci"
36
37mputl(MFILECONTENTS,MFILE);
38mfile2sci(MFILE,TMPDIR);
39SCIFILECONTENTS=mgetl(SCIFILE);
40
41SCIFILECONTENTSREF=["function [] = bug925(A,B)";
42 "";
43 "// Display mode";
44 "mode(0);";
45 "";
46 "// Display warning for floating point exception";
47 "ieee(1);";
48 "";
49 "A = mtlb_i(A,4,mtlb_e(B,3));";
50 "endfunction"]
51
52
53if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
54 affich_result(%F,925);
55else
56 affich_result(%T,925);
57end
diff --git a/tests/nonRegression/bug942.sci b/tests/nonRegression/bug942.sci
deleted file mode 100644
index 05afa8f..0000000
--- a/tests/nonRegression/bug942.sci
+++ /dev/null
@@ -1,51 +0,0 @@
1// <-- Non-regression test for bug 942 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=942
5//
6// <-- Short Description -->
7// Adding a comment character '%' at the end of a function
8// prototype makes the conversion fail.
9//
10// File Test.m :
11//
12// function [a] = Test (x) % test
13// a = x;
14
15// Copyright INRIA
16// Scilab Project - V. Couvert
17
18// Modified by Pierre MARECHAL
19// Copyright INRIA
20// Date : 18 Mar 2005
21
22MFILECONTENTS=["function [a] = bug942 (x) % bug942";"% help line";"% help line";"a = x;"]
23
24MFILE=TMPDIR+"/bug942.m"
25SCIFILE=TMPDIR+"/bug942.sci"
26
27mputl(MFILECONTENTS,MFILE);
28mfile2sci(MFILE,TMPDIR);
29SCIFILECONTENTS=mgetl(SCIFILE);
30
31SCIFILECONTENTSREF=["function [a] = bug942(x) // bug942";
32 "";
33 "// Ouput variables initialisation (not found in input variables)";
34 "a=[];";
35 "";
36 "// Display mode";
37 "mode(0);";
38 "";
39 "// Display warning for floating point exception";
40 "ieee(1);";
41 "";
42 "// help line";
43 "// help line";
44 "a = x;";
45 "endfunction"]
46
47if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
48 affich_result(%F,942);
49else
50 affich_result(%T,942);
51end
diff --git a/tests/nonRegression/bug943.sci b/tests/nonRegression/bug943.sci
deleted file mode 100644
index 0c8bbe8..0000000
--- a/tests/nonRegression/bug943.sci
+++ /dev/null
@@ -1,66 +0,0 @@
1// <-- Non-regression test for bug 943 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=943
5//
6// <-- Short Description -->
7// Conversion of (if, elseif, else) structure leads to
8// mfile2sci failure in some particular indentation scheme.
9//
10// Cyl_.m
11//
12// function [v,G,J] = Cyl_(a,p1,p2,r)
13// v = (r^2)*abs(p2-p1)*pi;
14// l = p1-p2 ; d = 0.5*(p1+p2) ;
15// j1 = (r^2)/2. ; j2 = (r^2)/4. + (l^2)/12. + d^2 ;
16// if (a==1), J = [j1,0.,0. ; 0.,j2,0. ; 0.,0.,j2] ; G =
17// [0.5*(p1+p2);0.;0.] ;
18// elseif (a==2), J = [j2,0.,0. ; 0.,j1,0. ; 0.,0.,j2] ; G =
19// [0.;0.5*(p1+p2);0.] ;
20// elseif (a==3), J = [j2,0.,0. ; 0.,j2,0. ; 0.,0.,j1] ; G =
21// [0.;0.;0.5*(p1+p2)] ;
22// else, J = [0.,0.,0. ; 0.,0.,0. ; 0.,0.,0.] ; G =
23// [0.;0.;0.] ; end,
24//
25// Cyl2_.m
26//
27// ...
28
29// Copyright INRIA
30// Scilab Project - V. Couvert
31
32// Modified by Pierre MARECHAL
33// Copyright INRIA
34// Date : 18 Mar 2005
35
36MFILECONTENTS=["a=10;";
37 "if (a==1), J = [1 ; 2 ; 3] ; G = [4 ; 5 ; 6] ;";
38 "elseif (a==2), J = [1 ; 2 ; 3] ; G = [4 ; 5 ; 6] ;";
39 "elseif (a==3), J = [1 ; 2 ; 3] ; G = [4 ; 5 ; 6] ;";
40 "else, J = [1 ; 2 ; 3] ; G = [4 ; 5 ; 6] ; end,"]
41
42MFILE=TMPDIR+"/bug943.m"
43SCIFILE=TMPDIR+"/bug943.sci"
44
45mputl(MFILECONTENTS,MFILE);
46mfile2sci(MFILE,TMPDIR);
47SCIFILECONTENTS=mgetl(SCIFILE);
48
49SCIFILECONTENTSREF=["";
50 "// Display mode";
51 "mode(0);";
52 "";
53 "// Display warning for floating point exception";
54 "ieee(1);";
55 "";
56 "a = 10;";
57 "if a==1 then J = [1;2;3]; G = [4;5;6];";
58 "elseif a==2 then J = [1;2;3]; G = [4;5;6];";
59 "elseif a==3 then J = [1;2;3]; G = [4;5;6];";
60 "else J = [1;2;3]; G = [4;5;6];end;"]
61
62if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
63 affich_result(%F,943);
64else
65 affich_result(%T,943);
66end
diff --git a/tests/nonRegression/bug945.sci b/tests/nonRegression/bug945.sci
deleted file mode 100644
index 769b216..0000000
--- a/tests/nonRegression/bug945.sci
+++ /dev/null
@@ -1,46 +0,0 @@
1// <-- Non-regression test for bug 945 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=945
5//
6// <-- Short Description -->
7// mfile2sci fails in case of non pre-sized vectors (all
8// assignments are done for the first component).
9//
10// Test.m leads to Test.sci (obviously wrong)
11// Test2.m leads to Test2.sci
12
13// Copyright INRIA
14// Scilab Project - V. Couvert
15
16// Modified by Pierre MARECHAL
17// Copyright INRIA
18// Date : 18 Mar 2005
19
20MFILECONTENTS=["x(1) = 0.;";"x(2) = 0.;";"y = zeros (2,1);";"y(1) = 0.;";"y(2) = 0.;"]
21
22MFILE=TMPDIR+"/bug945.m"
23SCIFILE=TMPDIR+"/bug945.sci"
24
25mputl(MFILECONTENTS,MFILE);
26mfile2sci(MFILE,TMPDIR);
27SCIFILECONTENTS=mgetl(SCIFILE);
28
29SCIFILECONTENTSREF=["";
30 "// Display mode";
31 "mode(0);";
32 "";
33 "// Display warning for floating point exception";
34 "ieee(1);";
35 "";
36 "x(1,1) = 0;";
37 "x(1,2) = 0;";
38 "y = zeros(2,1);";
39 "y(1) = 0;";
40 "y = mtlb_i(y,2,0);"]
41
42if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
43 affich_result(%F,945);
44else
45 affich_result(%T,945);
46end
diff --git a/tests/nonRegression/bug946.sci b/tests/nonRegression/bug946.sci
deleted file mode 100644
index 2511970..0000000
--- a/tests/nonRegression/bug946.sci
+++ /dev/null
@@ -1,42 +0,0 @@
1// <-- Non-regression test for bug 946 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=946
5//
6// <-- Short Description -->
7// Code badly converted by mfile2sci when using particular
8// column vector initialization / assignment (see attachments).
9
10// Copyright INRIA
11// Scilab Project - V. Couvert
12
13// Modified by Pierre MARECHAL
14// Copyright INRIA
15// Date : 18 Mar 2005
16
17MFILECONTENTS=["x=zeros(3,2);";"y=zeros(3,1);";"x=[1 0;0 0;0 0];";"y(1:3)=x(:,1);"]
18
19MFILE=TMPDIR+"/bug946.m"
20SCIFILE=TMPDIR+"/bug946.sci"
21
22mputl(MFILECONTENTS,MFILE);
23mfile2sci(MFILE,TMPDIR);
24SCIFILECONTENTS=mgetl(SCIFILE);
25
26SCIFILECONTENTSREF=["";
27 "// Display mode";
28 "mode(0);";
29 "";
30 "// Display warning for floating point exception";
31 "ieee(1);";
32 "";
33 "x = zeros(3,2);";
34 "y = zeros(3,1);";
35 "x = [1,0;0,0;0,0];";
36 "y(1:3) = x(:,1);"]
37
38if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
39 affich_result(%F,946);
40else
41 affich_result(%T,946);
42end
diff --git a/tests/nonRegression/bug979.sci b/tests/nonRegression/bug979.sci
deleted file mode 100644
index 09f35cb..0000000
--- a/tests/nonRegression/bug979.sci
+++ /dev/null
@@ -1,40 +0,0 @@
1// <-- Non-regression test for bug 979 -->
2//
3// <-- Bugzilla URL -->
4// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=979
5//
6// <-- Short Description -->
7// Matlab comments like %blabla are translated to
8// part(comment,"blabla") [!?]
9
10// Copyright INRIA
11// Scilab Project - V. Couvert
12
13// Modified by Pierre MARECHAL
14// Copyright INRIA
15// Date : 18 Mar 2005
16
17MFILECONTENTS=["comment=1;";"%This line is a comment line"]
18
19MFILE=TMPDIR+"/bug979.m"
20SCIFILE=TMPDIR+"/bug979.sci"
21
22mputl(MFILECONTENTS,MFILE);
23mfile2sci(MFILE,TMPDIR);
24SCIFILECONTENTS=mgetl(SCIFILE);
25
26SCIFILECONTENTSREF=["";
27 "// Display mode";
28 "mode(0);";
29 "";
30 "// Display warning for floating point exception";
31 "ieee(1);";
32 "";
33 "comment = 1;";
34 "//This line is a comment line"]
35
36if or(SCIFILECONTENTSREF<>SCIFILECONTENTS) then
37 affich_result(%F,979);
38else
39 affich_result(%T,979);
40end