1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2019, 2020 - Samuel GOUGEON
5 // This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // Unitary tests of default display of scalar (nested) structures
8 // =============================================================================
9 // <-- CLI SHELL MODE -->
10 // <-- ENGLISH IMPOSED -->
11 oldDepth = xmlGetValues("//general/body/environment","container_disp_max_depth");
12 setPreferencesValue("//general/body/environment", ["container_disp_max_depth"; "3"]);
13 // ----------------------------------------------------------------
15 s.f = [%i/%s, %s/(1-%s), 1/(1-%s)^2];
16 s.c = {1 3 ; "abc" %z};
21 s.L = list(rand(2,3),{},(1-%z)^3,,%pi, %t, "abcd");
23 s.tlist = tlist(["myTlist" "bool" "int" "num" "txt" "list"],..
24 rand(3,4,2)<0.5, int8((rand(3,5)-0.5)*200), ..
25 grand(3,4,"uin",-100,100), ["This" "is" "a" "test"], list(%pi,"number"));
26 s.mlist = mlist(["myMlist" "spb" "fun" "pol" "txt"],..
27 sparse(rand(3,4)<0.5), cosd, (1-%z).^(0:4),["Scilab" "6.1"]);
29 s.withVoid = struct("num",%pi,"v",,"t","text");
30 s.struct = struct("a",rand(1,3),"L",list(%e,,"ABC"),"c",{{"GHI",1234}});
33 f: [1x3 complex rational] of s
42 (3) = 1-3*%z+3*%z^2-%z^3
47 lib: corelib library with 16 functions @ SCI\modules\core\macros\
48 tlist: [myTlist] tlist with fields:
52 txt = ["This","is","a","test"]
56 mlist: [myMlist] mlist with fields:
57 spb: [3x4 boolean sparse]
58 fun: cosd(x) => [x] (19 lines)
59 pol = [1,1-%z,1-2*%z+%z^2,1-3*%z+3*%z^2-%z^3,1-4*%z+6*%z^2-4*%z^3+%z^4]
60 txt = ["Scilab","6.1"]
61 estruct: [0x0 struct] with no field
62 withVoid: struct with fields:
66 struct: struct with fields:
67 a = [0.9488184,0.3435337,0.3760119]
73 // ----------------------------------------------------------------
76 s.L = list(2,"bonjour", list(%i, list(%z,3)));
79 s.t.tl = tlist(["myTlist" "a" "b" "c"], rand(2,3), %t, list("abc", 123));
82 s.t.L2 = list("Hello", list(1-%z+%z^2, list(-4,%t)));
83 s.t.b.s.a = "Level 3";
85 setPreferencesValue("//general/body/environment", ["container_disp_max_depth";"0"]);
89 L: list with 3 elements.
90 t: struct with fields:
92 setPreferencesValue("//general/body/environment", ["container_disp_max_depth";"1"]);
99 (3) : list with 2 elements.
100 t: struct with fields:
103 tl: [myTlist] tlist with fields:
105 b: struct with fields:
107 L2: list with 2 elements.
108 setPreferencesValue("//general/body/environment", ["container_disp_max_depth";"2"]);
117 (2) : list with 2 elements.
118 t: struct with fields:
121 tl: [myTlist] tlist with fields:
124 c: list with 2 elements.
125 b: struct with fields:
128 s: struct with fields:
132 (2) : list with 2 elements.
133 setPreferencesValue("//general/body/environment", ["container_disp_max_depth";"3"]);
145 t: struct with fields:
148 tl: [myTlist] tlist with fields:
154 b: struct with fields:
157 s: struct with fields:
159 p = 1-3*%z+3*%z^2-%z^3
164 (2) : list with 2 elements.
165 // ----------------------------------------------------------------
166 setPreferencesValue("//general/body/environment", ["container_disp_max_depth"; oldDepth]);