tclsci fixed after 33ce445f981d
[scilab.git] / scilab / modules / tclsci / tests / unit_tests / TCL_SetGet.tst
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) ????-2008 - INRIA - Allan CORNET <allan.cornet@inria.fr>
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- NO CHECK REF -->
8 //-----------------------------------------------------------------------------------------
9 // Tests Interface TCL
10 //-----------------------------------------------------------------------------------------
11 assert_checktrue(TCL_SetVar("ScalarA",1.1112));
12 assert_checkequal(TCL_GetVar("ScalarA"), "1.1112000000");
13
14 //-----------------------------------------------------------------------------------------
15 assert_checktrue(TCL_SetVar("StringB","Test"));
16 assert_checkequal(TCL_GetVar("StringB"), "Test");
17
18 //-----------------------------------------------------------------------------------------
19 b=[6.1,4.1,1.1;2.1,3.1,5.1];
20 stringb=["6.1000000000","4.1000000000","1.1000000000";"2.1000000000","3.1000000000","5.1000000000"];
21
22 assert_checktrue(TCL_SetVar("B",b));
23 assert_checkequal(TCL_GetVar('B(1,1)'), stringb(1,1));
24 assert_checkequal(TCL_GetVar('B(1,2)'), stringb(1,2));
25 assert_checkequal(TCL_GetVar('B(1,3)'), stringb(1,3));
26 assert_checkequal(TCL_GetVar('B(2,1)'), stringb(2,1));
27 assert_checkequal(TCL_GetVar('B(2,2)'), stringb(2,2));
28 assert_checkequal(TCL_GetVar('B(2,3)'), stringb(2,3));
29 assert_checkequal(TCL_GetVar("B"), stringb);
30
31 //-----------------------------------------------------------------------------------------
32 a=['A','B','C';'D','E','F']
33
34 assert_checktrue(TCL_SetVar("A",a));
35 assert_checkequal(TCL_GetVar('A(1,1)'), a(1,1));
36 assert_checkequal(TCL_GetVar('A(1,2)'), a(1,2));
37 assert_checkequal(TCL_GetVar('A(1,3)'), a(1,3));
38 assert_checkequal(TCL_GetVar('A(2,1)'), a(2,1));
39 assert_checkequal(TCL_GetVar('A(2,2)'), a(2,2));
40 assert_checkequal(TCL_GetVar('A(2,3)'), a(2,3));
41 assert_checkequal(TCL_GetVar("A"), a);
42 //-----------------------------------------------------------------------------------------
43