summaryrefslogtreecommitdiffstats
path: root/scilab/modules/intersci/tests/nonreg_tests/bug_1957.tst
blob: 4abe1cb98707808b7c9cd35af6338d483914fd12 (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
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2006-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================

// <-- Non-regression test for bug 1957 -->
//
// <-- Bugzilla URL -->
// http://bugzilla.scilab.org/show_bug.cgi?id=1957
//
// <-- Short Description -->
//    Non fonctionnement de intersci pour les variables optionnelles (au 
//    moins scalaires)

tab  = ascii(9);
path = TMPDIR;

desc=['foo'+tab+'x'+tab+'y'+tab+'[ITMAX 2000]'+tab+'[eps 0.001]'
		'x'+tab+'scalar'
		'y'+tab+'scalar'
		'ITMAX'+tab+'scalar'
		'eps '+tab+'scalar'
		'r'+tab+'vector 4'
		''
		'foo'+tab+'x'+tab+'y'+tab+' ITMAX'+tab+'eps'+tab+'r'
		'x'+tab+'double'
		'y'+tab+'double'
		'ITMAX'+tab+'integer'
		'eps'+tab+'double'
		'r'+tab+'double'
		''
		'out sequence'+tab+'r'
		'*******************'];

mputl(desc,path+'/intsfoo.desc')

foo_code=['#include ""stack-c.h""'
		'void C2F(foo)(double *x,double *y,int *ITMAX,double *eps,double *r)'
		'  {'
		'    r[0]=*x; r[1]=*y; r[2]=*ITMAX; r[3]=*eps;'
		'  }'];

mputl(foo_code,path+'/foo.c')

intersci=getshortpathname(SCI+'/modules/intersci/bin/intersci-n')

curpath=pwd();
chdir(path);

try
	unix_s(intersci+' intsfoo')
	ilib_build('buglib',['bug1957','intsfoo'],['foo.o','intsfoo.o'],[])
	exec loader.sce
catch
	if %T then pause,end
	return
end

chdir(curpath);

res=bug1957(1.2,-2.3);
VAL = 2000;
if norm(res-[1.2,-2.3,VAL,0.001])-VAL  >= 2d-1 then pause,end

ITMAX=33;
res=bug1957(1.2,-2.3);
if norm(res-[1.2,-2.3,33,0.001])-ITMAX    >= 2d-1 then pause,end

eps=1d-7;
res=bug1957(1.2,-2.3);
VAL = 2000;
if norm(res-[1.2,-2.3,VAL,1d-7])-VAL   >= 2d-1 then pause,end

ITMAX=33;
res=bug1957(1.2,-2.3);
if norm(res-[1.2,-2.3,ITMAX,1d-7])-ITMAX    >= 2d-1 then pause,end