RegressionTests__CharacterTests.st
author Claus Gittinger <cg@exept.de>
Mon, 01 Mar 2004 21:55:43 +0100
changeset 235 9ed54aa16693
child 236 2b2f2423c4ab
permissions -rw-r--r--
initial checkin

"{ Package: 'exept:regression' }"

TestCase subclass:#CharacterTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Text-Encodings'
!


!CharacterTests methodsFor:'tests'!

test01CaseTesting
    CharacterEncoderCodeGenerator new
        readingUnicodeDataFrom:'/phys/exept/home/documentation/standards/unicode/UnicodeData-3.1.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|

                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).

                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
    "
! !

!CharacterTests class methodsFor:'documentation'!

version
    ^ '$Header$'
! !