summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Delamarre <cedric.delamarre@scilab-enterprises.com>2015-08-28 10:23:46 +0200
committerCedric Delamarre <cedric.delamarre@scilab-enterprises.com>2015-08-28 10:23:53 +0200
commit044c2cf8a25e74c04c70f8d7330bcfc99db25b9f (patch)
tree9fd339dffd30001d632466521d2c0d1653fb688e
parente5afbbeb1b4a3ea7a7c0bf39c63232b6303a67c3 (diff)
downloadscilab-044c2cf8a25e74c04c70f8d7330bcfc99db25b9f.zip
scilab-044c2cf8a25e74c04c70f8d7330bcfc99db25b9f.tar.gz
boolean display fixed
test_run core display Change-Id: Ife9027011bae4e5f5957a6b6172aaa27cb78a3ab
-rw-r--r--scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp8
-rw-r--r--scilab/modules/ast/src/cpp/types/bool.cpp4
-rw-r--r--scilab/modules/core/tests/unit_tests/display.dia.ref79
-rw-r--r--scilab/modules/core/tests/unit_tests/display.tst10
4 files changed, 73 insertions, 28 deletions
diff --git a/scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp b/scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp
index 189bb95..e275e8d 100644
--- a/scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp
+++ b/scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp
@@ -115,7 +115,7 @@ namespace ast {
115 { 115 {
116 std::wstring wstrName = pVar->getSymbol().getName(); 116 std::wstring wstrName = pVar->getSymbol().getName();
117 std::wostringstream ostr; 117 std::wostringstream ostr;
118 ostr << wstrName << L" = " << std::endl << std::endl; 118 ostr << L" " << wstrName << L" = " << std::endl << std::endl;
119 scilabWriteW(ostr.str().c_str()); 119 scilabWriteW(ostr.str().c_str());
120 std::wostringstream ostrName; 120 std::wostringstream ostrName;
121 ostrName << wstrName; 121 ostrName << wstrName;
@@ -195,7 +195,7 @@ namespace ast {
195 if (e.isVerbose() && ConfigVariable::isPromptShow()) 195 if (e.isVerbose() && ConfigVariable::isPromptShow())
196 { 196 {
197 std::wostringstream ostr; 197 std::wostringstream ostr;
198 ostr << *getStructNameFromExp(pCell) << L" = " << std::endl; 198 ostr << L" " << *getStructNameFromExp(pCell) << L" = " << std::endl;
199 ostr << std::endl; 199 ostr << std::endl;
200 scilabWriteW(ostr.str().c_str()); 200 scilabWriteW(ostr.str().c_str());
201 201
@@ -356,7 +356,7 @@ namespace ast {
356 if (e.isVerbose() && ConfigVariable::isPromptShow()) 356 if (e.isVerbose() && ConfigVariable::isPromptShow())
357 { 357 {
358 std::wostringstream ostr; 358 std::wostringstream ostr;
359 ostr << *getStructNameFromExp(&pCall->getName()) << L" = " << std::endl; 359 ostr << L" " << *getStructNameFromExp(&pCall->getName()) << L" = " << std::endl;
360 ostr << std::endl; 360 ostr << std::endl;
361 scilabWriteW(ostr.str().c_str()); 361 scilabWriteW(ostr.str().c_str());
362 362
@@ -496,7 +496,7 @@ namespace ast {
496 496
497 types::InternalType* pPrint = ctx->get(symbol::Symbol(*pstName)); 497 types::InternalType* pPrint = ctx->get(symbol::Symbol(*pstName));
498 std::wostringstream ostr; 498 std::wostringstream ostr;
499 ostr << *pstName << L" = " << std::endl << std::endl; 499 ostr << L" " << *pstName << L" = " << std::endl << std::endl;
500 scilabWriteW(ostr.str().c_str()); 500 scilabWriteW(ostr.str().c_str());
501 501
502 std::wostringstream ostrName; 502 std::wostringstream ostrName;
diff --git a/scilab/modules/ast/src/cpp/types/bool.cpp b/scilab/modules/ast/src/cpp/types/bool.cpp
index 2bb4e89..5f00321 100644
--- a/scilab/modules/ast/src/cpp/types/bool.cpp
+++ b/scilab/modules/ast/src/cpp/types/bool.cpp
@@ -136,7 +136,7 @@ bool Bool::subMatrixToString(std::wostringstream& ostr, int* _piDims, int /*_iDi
136 _piDims[1] = 0; 136 _piDims[1] = 0;
137 _piDims[0] = i; 137 _piDims[0] = i;
138 int iPos = getIndex(_piDims); 138 int iPos = getIndex(_piDims);
139 ostr << (get(iPos) ? L" T" : L" F"); 139 ostr << (get(iPos) ? L" T" : L" F");
140 ostr << std::endl; 140 ostr << std::endl;
141 } 141 }
142 } 142 }
@@ -266,7 +266,7 @@ bool Bool::subMatrixToString(std::wostringstream& ostr, int* _piDims, int /*_iDi
266 { 266 {
267 ostr << std::endl << L" column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl; 267 ostr << std::endl << L" column " << iLastCol + 1 << L" to " << getCols() << std::endl << std::endl;
268 } 268 }
269 ostr << ostemp.str(); 269 ostr << L" " << ostemp.str();
270 } 270 }
271 271
272 return true; 272 return true;
diff --git a/scilab/modules/core/tests/unit_tests/display.dia.ref b/scilab/modules/core/tests/unit_tests/display.dia.ref
index f835317..2e897fd 100644
--- a/scilab/modules/core/tests/unit_tests/display.dia.ref
+++ b/scilab/modules/core/tests/unit_tests/display.dia.ref
@@ -7,21 +7,21 @@
7format("v",10) 7format("v",10)
8//display of numbers 8//display of numbers
9x=2.6533333 9x=2.6533333
10x = 10 x =
11 2.6533333 11 2.6533333
12x=[2.6533333 -0.0002] 12x=[2.6533333 -0.0002]
13x = 13 x =
14 2.6533333 - 0.0002 14 2.6533333 - 0.0002
15x' 15x'
16 ans = 16 ans =
17 2.6533333 17 2.6533333
18 - 0.0002 18 - 0.0002
19x=[] 19x=[]
20x = 20 x =
21 [] 21 []
22//display of polynomials 22//display of polynomials
23z=poly(0,"z") 23z=poly(0,"z")
24z = 24 z =
25 25
26 z 26 z
27num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ... 27num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
@@ -30,7 +30,7 @@ z-0.0243497
30z-0.0243497 30z-0.0243497
31(((1)*z )*z )*z+1 31(((1)*z )*z )*z+1
320] 320]
33num = 33 num =
34 2 3 4 34 2 3 4
35 - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z 35 - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z
36 5 36 5
@@ -47,7 +47,7 @@ den = [ ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
47((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508 47((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
48((1)*z )*z 48((1)*z )*z
491] 491]
50den = 50 den =
51 2 3 4 51 2 3 4
52 0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z 52 0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z
53 2 3 4 53 2 3 4
@@ -127,7 +127,7 @@ num',den'
127 1 127 1
128//display of polynomials 128//display of polynomials
129z=poly(0,"z") 129z=poly(0,"z")
130z = 130 z =
131 131
132 z 132 z
133n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1]; 133n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1];
@@ -137,7 +137,7 @@ p1=[p,0.1+2.35*z-5.05*z**3];q1=[q,2.56+0.03*z-10.01*z*z+z**5];
137d3=[1+z**10 z**15]; 137d3=[1+z**10 z**15];
138//display of rationals 138//display of rationals
139r=num./den 139r=num./den
140r = 140 r =
141 141
142 1 1 142 1 1
143 -- -- 143 -- --
@@ -321,16 +321,16 @@ column 4
321 1 + 4z + 6z + 4z + z 321 1 + 4z + 6z + 4z + z
322//display of strings 322//display of strings
323digits="abcdefghijklmnopqrstuvwxyz" 323digits="abcdefghijklmnopqrstuvwxyz"
324digits = 324 digits =
325 abcdefghijklmnopqrstuvwxyz 325 abcdefghijklmnopqrstuvwxyz
326numbers="1234567890" 326numbers="1234567890"
327numbers = 327 numbers =
328 1234567890 328 1234567890
329majuscules="ABCDEFGHIJKLMNOPQRSTUVWXYZ" 329majuscules="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
330majuscules = 330 majuscules =
331 ABCDEFGHIJKLMNOPQRSTUVWXYZ 331 ABCDEFGHIJKLMNOPQRSTUVWXYZ
332symbols=",./;''[] \ =-!\$%^&*()_+~:""[]| @" 332symbols=",./;''[] \ =-!\$%^&*()_+~:""[]| @"
333symbols = 333 symbols =
334 ,./;'[] \ =-!\$%^&*()_+~:"[]| @ 334 ,./;'[] \ =-!\$%^&*()_+~:"[]| @
335[numbers;digits] 335[numbers;digits]
336 ans = 336 ans =
@@ -643,9 +643,9 @@ list(1,2,3)
643list(list(1,list()),2) 643list(list(1,list()),2)
644 ans = 644 ans =
645 ans(1) 645 ans(1)
646 ans(1)(1) 646 ans(1)(1)
647 1. 647 1.
648 ans(1)(2) 648 ans(1)(2)
649 () 649 ()
650 ans(2) 650 ans(2)
651 2. 651 2.
@@ -674,21 +674,21 @@ list(1,1:$)
674list(list(1:$)) 674list(list(1:$))
675 ans = 675 ans =
676 ans(1) 676 ans(1)
677 ans(1)(1) 677 ans(1)(1)
678 1:1:$ 678 1:1:$
679list(list(1,$),list()) 679list(list(1,$),list())
680 ans = 680 ans =
681 ans(1) 681 ans(1)
682 ans(1)(1) 682 ans(1)(1)
683 1. 683 1.
684 ans(1)(2) 684 ans(1)(2)
685 685
686 $ 686 $
687 ans(2) 687 ans(2)
688 () 688 ()
689// Tlist overloaded display 689// Tlist overloaded display
690TL=tlist("x",1,2) 690TL=tlist("x",1,2)
691TL = 691 TL =
692 TL(1) 692 TL(1)
693 x 693 x
694 TL(2) 694 TL(2)
@@ -710,12 +710,12 @@ list(TL)
710list(list(TL)) 710list(list(TL))
711 ans = 711 ans =
712 ans(1) 712 ans(1)
713 ans(1)(1) 713 ans(1)(1)
714 Mydisplay 714 Mydisplay
715 1. 715 1.
716 2. 716 2.
717TL=tlist("x",1:$,2) 717TL=tlist("x",1:$,2)
718TL = 718 TL =
719 Mydisplay 719 Mydisplay
720 1:1:$ 720 1:1:$
721 2. 721 2.
@@ -728,14 +728,49 @@ list(TL)
728list(list(TL)) 728list(list(TL))
729 ans = 729 ans =
730 ans(1) 730 ans(1)
731 ans(1)(1) 731 ans(1)(1)
732 Mydisplay 732 Mydisplay
733 1:1:$ 733 1:1:$
734 2. 734 2.
735TL(2)=TL 735TL(2)=TL
736TL = 736 TL =
737 Mydisplay 737 Mydisplay
738 Mydisplay 738 Mydisplay
739 1:1:$ 739 1:1:$
740 2. 740 2.
741 2. 741 2.
742// boolean
743%t
744 ans =
745 T
746%f
747 ans =
748 F
749b=[%t %t %t]
750 b =
751 T T T
752~b
753 ans =
754 F F F
755bp=b'
756 bp =
757 T
758 T
759 T
760~bp
761 ans =
762 F
763 F
764 F
765bb=[b; b; b]
766 bb =
767 T T T
768 T T T
769 T T T
770
771~bb
772 ans =
773 F F F
774 F F F
775 F F F
776
diff --git a/scilab/modules/core/tests/unit_tests/display.tst b/scilab/modules/core/tests/unit_tests/display.tst
index ccef39c..446f5a2 100644
--- a/scilab/modules/core/tests/unit_tests/display.tst
+++ b/scilab/modules/core/tests/unit_tests/display.tst
@@ -133,3 +133,13 @@ TL=tlist("x",1:$,2)
133list(TL) 133list(TL)
134list(list(TL)) 134list(list(TL))
135TL(2)=TL 135TL(2)=TL
136
137// boolean
138%t
139%f
140b=[%t %t %t]
141~b
142bp=b'
143~bp
144bb=[b; b; b]
145~bb