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 xmlSetValues("//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 tlist: [myTlist] tlist with fields:
51 txt = ["This","is","a","test"]
55 mlist: [myMlist] mlist with fields:
56 spb: [3x4 boolean sparse]
57 fun: cosd(x) => [x] (19 lines)
58 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]
59 txt = ["Scilab","6.1"]
60 estruct: [0x0 struct] with no field
61 withVoid: struct with fields:
65 struct: struct with fields:
66 a = [0.9488184,0.3435337,0.3760119]
72 // ----------------------------------------------------------------
75 s.L = list(2,"bonjour", list(%i, list(%z,3)));
78 s.t.tl = tlist(["myTlist" "a" "b" "c"], rand(2,3), %t, list("abc", 123));
81 s.t.L2 = list("Hello", list(1-%z+%z^2, list(-4,%t)));
82 s.t.b.s.a = "Level 3";
84 xmlSetValues("//general/body/environment", ["container_disp_max_depth";"0"]);
88 L: list with 3 elements.
89 t: struct with fields:
90 ["a", "r", "tl", "b", "L2"]
91 xmlSetValues("//general/body/environment", ["container_disp_max_depth";"1"]);
98 (3) : list with 2 elements.
99 t: struct with fields:
102 tl: [myTlist] tlist with fields:
104 b: struct with fields:
106 L2: list with 2 elements.
107 xmlSetValues("//general/body/environment", ["container_disp_max_depth";"2"]);
116 (2) : list with 2 elements.
117 t: struct with fields:
120 tl: [myTlist] tlist with fields:
123 c: list with 2 elements.
124 b: struct with fields:
127 s: struct with fields:
131 (2) : list with 2 elements.
132 xmlSetValues("//general/body/environment", ["container_disp_max_depth";"3"]);
144 t: struct with fields:
147 tl: [myTlist] tlist with fields:
153 b: struct with fields:
156 s: struct with fields:
158 p = 1-3*%z+3*%z^2-%z^3
163 (2) : list with 2 elements.
164 // ----------------------------------------------------------------
165 xmlSetValues("//general/body/environment", ["container_disp_max_depth"; oldDepth]);