RegressionTests__CharacterTests.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jan 2011 17:31:15 +0100
changeset 573 bf047b9a42ec
parent 274 14bd9bd8c7f2
child 612 12959005a2fd
permissions -rw-r--r--
category

"{ Package: 'exept:regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#CharacterTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression'
!


!CharacterTests methodsFor:'tests'!

test01CaseTesting
    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|

		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$'
!

version_CVS
    ^ '$Header$'
! !