RegressionTests__CharacterTests.st
changeset 612 12959005a2fd
parent 573 bf047b9a42ec
child 613 572fbd9909a8
--- a/RegressionTests__CharacterTests.st	Fri Aug 05 18:40:08 2011 +0200
+++ b/RegressionTests__CharacterTests.st	Fri Aug 05 18:58:54 2011 +0200
@@ -13,51 +13,61 @@
 !CharacterTests methodsFor:'tests'!
 
 test01CaseTesting
+    |unicodeDataFile|
+
+    unicodeDataFile := self class packageDirectory construct:'testData/UnicodeData-4.0.0.txt'.
+
+    CharacterEncoderCodeGenerator isNil ifTrue:[
+        Smalltalk fileInClass:'CharacterEncoderCodeGenerator' package:'stx:goodies'
+    ].
+
     CharacterEncoderCodeGenerator new
-	readingUnicodeDataFrom:
-	    "/ '/phys/exept/home/documentation/standards/unicode/UnicodeData-3.1.0.txt'
-	    '/phys/exept/home/documentation/standards/unicode/UnicodeData-4.0.0.txt'
-		asFilename readStream
-	do:[:codePoint :name :category :canOrd :bidiCat :decMap
-	    :decDigitValue :digitValue :numValue
-	    :mirrored :unicodeName :comment :ucValue :lcValue :tcValue |
-		|ch ucCh lcCh tcCh isUppercase isLowercase isTitlecase isLetter dToUc dToLc|
+        readingUnicodeDataFrom:(unicodeDataFile readStream)
+        do:[:codePoint :name :category :canOrd :bidiCat :decMap
+            :decDigitValue :digitValue :numValue
+            :mirrored :unicodeName :comment :ucValue :lcValue :tcValue |
+                |ch ucCh lcCh tcCh isUppercase isLowercase isTitlecase isLetter dToUc dToLc|
 
-		isUppercase := category = 'Lu'.
-		isLowercase := category = 'Ll'.
-		isTitlecase := category = 'Lt'.
-		isLetter := isUppercase | isLowercase | isTitlecase
-			    or:[(category = 'Lm') or:[(category = 'Lo')]].
+                "/ for now, do not check above 1C6FF (i.e. only Uniode 3.2)
+                codePoint <= 16r1C6FF ifTrue:[
+                    isUppercase := category = 'Lu'.
+                    isLowercase := category = 'Ll'.
+                    isTitlecase := category = 'Lt'.
+                    isLetter := isUppercase | isLowercase | isTitlecase
+                                or:[(category = 'Lm') or:[(category = 'Lo')]].
 
-		ch := Character value:codePoint.
-		self assert:(ch isUppercase == isUppercase).
-		self assert:(ch isLowercase == isLowercase).
-		"/ self assert:(ch isTitlecase == isTitlecase).
-		self assert:(ch isNationalLetter == isLetter).
+                    ch := Character value:codePoint.
+                    self assert:(ch isUppercase == isUppercase).
+                    self assert:(ch isLowercase == isLowercase).
+                    "/ self assert:(ch isTitlecase == isTitlecase).
+                    self assert:(ch isNationalLetter == isLetter).
 
-		ucValue notNil ifTrue:[
-		    ucCh := Character value:ucValue.
-		    self assert:(ch asUppercase = ucCh).
-		] ifFalse:[
-		    self assert:(ch asUppercase = ch).
-		].
-		lcValue notNil ifTrue:[
-		    lcCh := Character value:lcValue.
-		    self assert:(ch asLowercase = lcCh).
-		] ifFalse:[
-		    self assert:(ch asLowercase = ch).
-		].
-		tcValue notNil ifTrue:[
-		    tcCh := Character value:tcValue.
-		    self assert:(ch asTitlecase = tcCh).
-		] ifFalse:[
-		    self assert:(ch asTitlecase = ch).
-		].
-	].
+                    ucValue notNil ifTrue:[
+                        ucCh := Character value:ucValue.
+                        self assert:(ch asUppercase = ucCh).
+                    ] ifFalse:[
+                        self assert:(ch asUppercase = ch).
+                    ].
+                    lcValue notNil ifTrue:[
+                        lcCh := Character value:lcValue.
+                        self assert:(ch asLowercase = lcCh).
+                    ] ifFalse:[
+                        self assert:(ch asLowercase = ch).
+                    ].
+                    tcValue notNil ifTrue:[
+                        tcCh := Character value:tcValue.
+                        self assert:(ch asTitlecase = tcCh).
+                    ] ifFalse:[
+                        self assert:(ch asTitlecase = ch).
+                    ].
+                ].
+        ].
 
     "
      self new test01CaseTesting
     "
+
+    "Modified: / 05-08-2011 / 18:58:47 / cg"
 ! !
 
 !CharacterTests class methodsFor:'documentation'!