1//<-- CLI SHELL MODE -->
2// =============================================================================
3// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4// Copyright (C) ????-2008 - INRIA
5//
6//  This file is distributed under the same license as the Scilab package.
7// =============================================================================
8// <-- ENGLISH IMPOSED -->
9//tests on functions pointer usage
10funcprot(0);
11f=exp
12 f  =
13if type(f)<>130 then bugmes();quit;end
14if f(1)<>exp(1) then bugmes();quit;end
15l=list(exp,f,3);
16f=l(1);
17if type(f)<>130 then bugmes();quit;end
18if f(1)<>exp(1) then bugmes();quit;end
19f=l(2);
20if type(f)<>130 then bugmes();quit;end
21if f(1)<>exp(1) then bugmes();quit;end
22l=tlist(['foo','fun'],exp);
23f=l.fun;
24if type(f)<>130 then bugmes();quit;end
25if f(1)<>exp(1) then bugmes();quit;end
26if l.fun(1)<>exp(1) then bugmes();quit;end
27function y=myf(x),y=exp(x),endfunction
28l=tlist(['foo','fun'],myf);
29if l.fun(1)<> exp(1) then bugmes();quit;end
30function y=foo(fun,x),y=fun(x),endfunction
31if foo(exp,1)<>exp(1) then bugmes();quit;end
32function y=foo(fun,x,y),y=fun(x,y),endfunction
33if foo(atan,1,0)<>atan(1,0) then bugmes();quit;end
34function y=foo(fun),y=[],for x=1:3,y=[y,fun(x)],end,endfunction
35if foo(exp)<>exp(1:3) then bugmes();quit;end
36l=tlist(['foo','funs'],list(exp,sin,cos));
37function y=foo(l),y=[],for k=1:3,y=[y,l.funs(k)(1)],end,endfunction
38if or(foo(l)<>[exp(1),sin(1),cos(1)]) then bugmes();quit;end
39