class: RegressionTests::CharacterTests
authorClaus Gittinger <cg@exept.de>
Fri, 21 Feb 2014 12:55:30 +0100
changeset 1050 c199e5675276
parent 1049 c5c7858fe11e
child 1051 761d399df9b0
class: RegressionTests::CharacterTests added: #test01_CaseTesting #test02_Concatenation removed: #test01CaseTesting
RegressionTests__CharacterTests.st
--- a/RegressionTests__CharacterTests.st	Wed Feb 12 15:40:21 2014 +0100
+++ b/RegressionTests__CharacterTests.st	Fri Feb 21 12:55:30 2014 +0100
@@ -12,7 +12,7 @@
 
 !CharacterTests methodsFor:'tests'!
 
-test01CaseTesting
+test01_CaseTesting
     "test lower/uppercase return value for all unicode characters up to 16r1C6FF (i.e. Unicode 3.2)"
 
     |unicodeDataFile|
@@ -70,6 +70,47 @@
     "
 
     "Modified (comment): / 05-08-2011 / 18:59:24 / cg"
+!
+
+test02_Concatenation
+    "test , operator on characters (to test against possible inlining or compiler optimizations, use variables, not constants)"
+
+    |a b r s s2|
+
+    s := ($a to: $z) asString.  
+    s2 :=($b to: $z) asString.  
+
+    "/ char , string
+    a := $a. b := ''.     self assert:(r := a,b) = 'a'.
+    a := $a. b := 'b'.    self assert:(r := a,b) = 'ab'.
+    a := $a. b := 'bc'.   self assert:(r := a,b) = 'abc'.
+    a := $a. b := 'bcd'.  self assert:(r := a,b) = 'abcd'.
+    a := $a. b := 'bcde'. self assert:(r := a,b) = 'abcde'.
+    "/ just in case there is some wordlength related problem...
+    1 to:20 do:[:n |                   
+        self assert:($a,(s2 copyTo:n)) = (s copyTo:n+1)
+    ].
+
+    "/ char , char
+    a := $a. b := $b.     self assert:(r := a,b) = 'ab'.
+
+    s2 :=($a to: $y) asString.  
+    "/ string, char
+    a := $a. b := ''.     self assert:(r := b,a) = 'a'.
+    a := $a. b := 'b'.    self assert:(r := b,a) = 'ba'.
+    a := $a. b := 'bc'.   self assert:(r := b,a) = 'bca'.
+    a := $a. b := 'bcd'.  self assert:(r := b,a) = 'bcda'.
+    a := $a. b := 'bcde'. self assert:(r := b,a) = 'bcdea'.
+    "/ just in case there is some wordlength related problem...
+    1 to:20 do:[:n |                   
+        self assert:((s2 copyLast:n),$z) = (s copyLast:n+1)
+    ].
+
+    "
+     self new test02_Concatenation
+    "
+
+    "Modified (comment): / 05-08-2011 / 18:59:24 / cg"
 ! !
 
 !CharacterTests class methodsFor:'documentation'!
@@ -81,3 +122,4 @@
 version_CVS
     ^ '$Header$'
 ! !
+