summaryrefslogtreecommitdiffstats
path: root/scilab/modules/core
diff options
context:
space:
mode:
authorBruno JOFRET <bruno.jofret@scilab.org>2010-04-09 17:53:10 +0200
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-04-12 12:17:14 +0200
commitaa7562c863b369ba7f9546da2cbc065ec2a50ab2 (patch)
treee2d72370372cbcfb352c18ffd3443aac8618580e /scilab/modules/core
parent819413daf86c43cb41a435701ba5a58c4b61f55c (diff)
downloadscilab-aa7562c863b369ba7f9546da2cbc065ec2a50ab2.zip
scilab-aa7562c863b369ba7f9546da2cbc065ec2a50ab2.tar.gz
Enlarge type tests
Change-Id: I5b4e201b6d276d5ceae79fc043830fcaa83f9360
Diffstat (limited to 'scilab/modules/core')
-rw-r--r--scilab/modules/core/tests/unit_tests/type.dia.ref72
-rw-r--r--scilab/modules/core/tests/unit_tests/type.tst92
2 files changed, 160 insertions, 4 deletions
diff --git a/scilab/modules/core/tests/unit_tests/type.dia.ref b/scilab/modules/core/tests/unit_tests/type.dia.ref
index b8b8c03..001bcb3 100644
--- a/scilab/modules/core/tests/unit_tests/type.dia.ref
+++ b/scilab/modules/core/tests/unit_tests/type.dia.ref
@@ -1,9 +1,77 @@
1// ============================================================================= 1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2008 - INRIA 3// Copyright (C) 2008 - INRIA
4// Copyright (C) 2010 - DIGITEO - Bruno JOFRET
4// 5//
5// This file is distributed under the same license as the Scilab package. 6// This file is distributed under the same license as the Scilab package.
6// ============================================================================= 7// =============================================================================
8// <-- ENGLISH IMPOSED -->
7//type 9//type
8if type(1)<>1 then bugmes();quit;end 10// Special cases
9a=%s;if type(a)<>2 then bugmes();quit;end 11if type(%nan) <> 1 then bugmes();quit;end
12if type(%inf) <> 1 then bugmes();quit;end
13// double <-> 1
14if type(1) <> 1 then bugmes();quit;end
15// polynomial <-> 2
16if type(poly(0,"x")) <> 2 then bugmes();quit;end
17// boolean
18if type(%t) <> 4 then bugmes();quit;end
19if type(%f) <> 4 then bugmes();quit;end
20// sparse <-> 5
21if type(sparse([1,2;4,5;3,10],[1,2,3])) <> 5 then bugmes();quit;end
22// boolean sparse <-> 6
23if type(sparse([1,2;4,5;3,10], [%t,%t, %t])) <> 6 then bugmes();quit;end
24// matlab sparse <-> 7
25X=sparse(rand(2,2));
26Y=mtlb_sparse(X);
27if type(Y) <> 7 then bugmes();quit;end
28clear X;
29clear Y;
30// int <-> 8
31if type(int8(0)) <> 8 then bugmes();quit;end
32if type(uint8(0)) <> 8 then bugmes();quit;end
33if type(int16(0)) <> 8 then bugmes();quit;end
34if type(uint16(0)) <> 8 then bugmes();quit;end
35if type(int32(0)) <> 8 then bugmes();quit;end
36if type(uint32(0)) <> 8 then bugmes();quit;end
37// handle <-> 9
38if type(gdf()) <> 9 then bugmes();quit;end
39// string <-> 10
40if type("scilab") <> 10 then bugmes();quit;end
41// Uncompiled function <-> 11 ??????????????????
42deff("__private__()","");
43recompilefunction("__private__","n");
44Warning : redefining function: __private__ . Use funcprot(0) to avoid this message
45
46if type(__private__) <> 11 then bugmes();quit;end
47clear __private__;
48// scilab macro <-> 13
49deff("__private__()","");
50if type(__private__) <> 13 then bugmes();quit;end
51clear __private__;
52// library <-> 14
53if type(corelib) <> 14 then bugmes();quit;end
54// list <-> 15
55if type(list(1,2,3)) <> 15 then bugmes();quit;end
56// tlist <-> 16
57if type(tlist("mytype",2,3)) <> 16 then bugmes();quit;end
58// mlist <-> 17
59if type(mlist("mytype",2,3)) <> 17 then bugmes();quit;end
60// struct <-> 17
61if type(struct()) <> 17 then bugmes();quit;end
62// cell <-> 17
63if type(cell(1,1)) <> 17 then bugmes();quit;end
64// pointer <-> 128
65a=rand(5,5);
66b=rand(5,1);
67A=sparse(a);
68[h,rk]=lufact(A);
69if type(h) <> 128 then bugmes();quit;end
70clear a;
71clear b;
72clear A;
73clear rk;
74ludel(h);
75clear h;
76// GW function
77if type(type) <> 130 then bugmes();quit;end
diff --git a/scilab/modules/core/tests/unit_tests/type.tst b/scilab/modules/core/tests/unit_tests/type.tst
index 8447efd..136aa96 100644
--- a/scilab/modules/core/tests/unit_tests/type.tst
+++ b/scilab/modules/core/tests/unit_tests/type.tst
@@ -1,11 +1,99 @@
1// ============================================================================= 1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2008 - INRIA 3// Copyright (C) 2008 - INRIA
4// Copyright (C) 2010 - DIGITEO - Bruno JOFRET
4// 5//
5// This file is distributed under the same license as the Scilab package. 6// This file is distributed under the same license as the Scilab package.
6// ============================================================================= 7// =============================================================================
7 8
9// <-- ENGLISH IMPOSED -->
10
8//type 11//type
9 12
10if type(1)<>1 then pause,end 13// Special cases
11a=%s;if type(a)<>2 then pause,end 14if type(%nan) <> 1 then pause,end
15if type(%inf) <> 1 then pause,end
16
17
18// double <-> 1
19if type(1) <> 1 then pause,end
20
21// polynomial <-> 2
22if type(poly(0,"x")) <> 2 then pause,end
23
24// boolean
25if type(%t) <> 4 then pause,end
26if type(%f) <> 4 then pause,end
27
28// sparse <-> 5
29if type(sparse([1,2;4,5;3,10],[1,2,3])) <> 5 then pause,end
30
31// boolean sparse <-> 6
32if type(sparse([1,2;4,5;3,10], [%t,%t, %t])) <> 6 then pause,end
33
34// matlab sparse <-> 7
35X=sparse(rand(2,2));
36Y=mtlb_sparse(X);
37if type(Y) <> 7 then pause,end
38clear X;
39clear Y;
40
41// int <-> 8
42if type(int8(0)) <> 8 then pause,end
43if type(uint8(0)) <> 8 then pause,end
44if type(int16(0)) <> 8 then pause,end
45if type(uint16(0)) <> 8 then pause,end
46if type(int32(0)) <> 8 then pause,end
47if type(uint32(0)) <> 8 then pause,end
48
49// handle <-> 9
50if type(gdf()) <> 9 then pause,end
51
52// string <-> 10
53if type("scilab") <> 10 then pause,end
54
55// Uncompiled function <-> 11 ??????????????????
56deff("__private__()","");
57recompilefunction("__private__","n");
58if type(__private__) <> 11 then pause,end
59clear __private__;
60
61// scilab macro <-> 13
62deff("__private__()","");
63if type(__private__) <> 13 then pause,end
64clear __private__;
65
66// library <-> 14
67if type(corelib) <> 14 then pause,end
68
69// list <-> 15
70if type(list(1,2,3)) <> 15 then pause,end
71
72// tlist <-> 16
73if type(tlist("mytype",2,3)) <> 16 then pause,end
74
75// mlist <-> 17
76if type(mlist("mytype",2,3)) <> 17 then pause,end
77
78// struct <-> 17
79if type(struct()) <> 17 then pause,end
80
81// cell <-> 17
82if type(cell(1,1)) <> 17 then pause,end
83
84// pointer <-> 128
85a=rand(5,5);
86b=rand(5,1);
87A=sparse(a);
88[h,rk]=lufact(A);
89if type(h) <> 128 then pause,end
90clear a;
91clear b;
92clear A;
93clear rk;
94ludel(h);
95clear h;
96
97// GW function
98if type(type) <> 130 then pause,end
99