summaryrefslogtreecommitdiff
path: root/modules/functions/tests/unit_tests/exec.dia.ref
blob: c13770120181745892cf6b13f9909b66857beb9d (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
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2009 - DIGITEO - Allan CORNET
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
tab_ref = [
"世界您好",
"азеазея",
"ハロー・ワールド",
"เฮลโลเวิลด์",
"حريات وحقوق",
"תוכנית"];
str_exec = 'disp(''OK'');';
for i = 1 : size(tab_ref,'*')
  mkdir(TMPDIR + filesep() + tab_ref(i));
  fd = mopen(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + '.sce','wt');
  mputl(str_exec,fd);
  mclose(fd);
  exec(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + '.sce');
  mdelete(TMPDIR + filesep() + tab_ref(i) + filesep() + tab_ref(i) + '.sce');
  rmdir(TMPDIR + filesep() + tab_ref(i));
end  
 
 OK   
 
 OK   
 
 OK   
 
 OK   
 
 OK   
 
 OK   
// create a script file
mputl('a=1;b=2',TMPDIR+'/myscript')
 ans  =
 
  T  
// execute it
exec(TMPDIR+'/myscript')
 
a=1;b=2
 b  =
 
    2.  
 
if isdef('a')<> %t then bugmes();quit;end
if isdef('b')<> %t then bugmes();quit;end
if a <> 1 then bugmes();quit;end
if b <> 2 then bugmes();quit;end
// create a function
deff('y=foo(x)','a=x+1;y=a^2');
clear a b
// call the function
k = foo(1);
if isdef('k')<> %t then bugmes();quit;end
if isdef('a')<> %f then bugmes();quit;end
if k <> 4 then bugmes();quit;end
x=4; //create x to make it known by the script foo
clear k y
exec(foo);
 y  =
 
    25.  
if isdef('y')<> %t then bugmes();quit;end
if y <> 25 then bugmes();quit;end