9ad93c31175eb2add248b1a8761fa61c2f977b08
[scilab.git] / scilab / modules / core / tests / nonreg_tests / bug_1304.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2010 - DIGITEO - Vincent COUVERT
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- Non-regression test for bug 1304 -->
8 //
9 // <-- Bugzilla URL -->
10 // http://bugzilla.scilab.org/show_bug.cgi?id=1304
11 //
12 // <-- Short Description -->
13 // macr2tree(expression) doesn't work
14 //
15 // TESTS WITH A 'SIMPLE' FUNCTION
16 //
17 function bug_1304()
18 disp("bug_1304")
19 endfunction
20 // Reference tree generated using sci2exp
21 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"bug_1304",list(),..
22         list(),..
23         list(list("EOL"),..
24         tlist(["equal","expression","lhs","endsymbol"],..
25         tlist(["funcall","rhs","name","lhsnb"],list(tlist(["cste","value"],"bug_1304")),"disp",1),..
26         list(tlist(["variable","name"],"ans")),""),list("EOL"),list("EOL"),..
27         tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),5);
28 if ~and(macr2tree(bug_1304)==reftree) then bugmes();quit;end
29 // Test with input which is not a variable reference
30 reftree.name = "ans";
31 if ~and(macr2tree(evstr("bug_1304"))==reftree) then bugmes();quit;end
32 clear bug_1304
33 //
34 // TESTS WITH A FUNCTION DEFINING AN OTHER FUNCTION
35 //
36 function f = bug_1304()
37 function internal_bug_1304()
38 disp("internal_bug_1304()")
39 endfunction
40 f = internal_bug_1304
41 endfunction
42 // Reference tree generated using sci2exp
43 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"bug_1304",..
44         list(tlist(["variable","name"],"f")),list(),..
45         list(list("EOL"),..
46         tlist(["inline","prototype","definition"],"internal_bug_1304()",..
47         ["";"disp(""internal_bug_1304()"")";" "]),list("EOL"),..
48         tlist(["equal","expression","lhs","endsymbol"],..
49         tlist(["variable","name"],"internal_bug_1304"),list(tlist(["variable","name"],"f")),""),..
50         list("EOL"),list("EOL"),tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),..
51         6);
52 if ~and(macr2tree(bug_1304)==reftree) then bugmes();quit;end
53 // Test with input which is not a variable reference
54 reftree.name = "ans";
55 if ~and(macr2tree(evstr("bug_1304"))==reftree) then bugmes();quit;end
56 // Reference tree generated using sci2exp
57 reftree = tlist(["program","name","outputs","inputs","statements","nblines"],"ans",..
58         list(),list(),..
59         list(list("EOL"),..
60         tlist(["equal","expression","lhs","endsymbol"],..
61         tlist(["funcall","rhs","name","lhsnb"],list(tlist(["cste","value"],"internal_bug_1304()")),..
62         "disp",1),list(tlist(["variable","name"],"ans")),""),list("EOL"),list("EOL"),..
63         tlist(["funcall","rhs","name","lhsnb"],[],"return",0),list("EOL")),5);
64 if ~and(macr2tree(bug_1304())==reftree) then bugmes();quit;end