RegressionTests__CRCTests.st
author Claus Gittinger <cg@exept.de>
Sat, 16 Mar 2019 23:26:47 +0100
changeset 2098 8cf7cbaf99fb
child 2106 288fa2469be2
permissions -rw-r--r--
initial checkin

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

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

!CRCTests class methodsFor:'documentation'!

documentation
"
    documentation to be added.

    [author:]
        Claus Gittinger

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!CRCTests methodsFor:'tests'!

test01_crc32
    "the default ccitt crc32"
    
    self assert:(CRC32Stream new hashValueOf:'') = 0.
    self assert:(CRC32Stream new hashValueOf:'resume') = 16r60C1D0A0.
    self assert:(CRC32Stream new hashValueOf:#[1 2 3 4 5 6 7]) = 16r70E46888.
    self assert:(CRC32Stream new hashValueOf:(ByteArray new:40 withAll:16rFF)) = 16r8CD04C73.
    self assert:(CRC32Stream new hashValueOf:'123456789') = 16rCBF43926.

    "Created: / 16-03-2019 / 23:22:34 / Claus Gittinger"
!

test01_crc32c
    "the default ccitt crc32"
    
    self assert:(CRC32Stream newCrc32c hashValueOf:'') = 0.
    self assert:(CRC32Stream newCrc32c hashValueOf:'a') = 16rC1D04330.
    self assert:(CRC32Stream newCrc32c hashValueOf:'123456789') = 16rE3069283.
    self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:0)) = 16r8A9136AA.
    self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:16rFF)) = 16r62a8ab43.
    self assert:(CRC32Stream newCrc32c hashValueOf:((0 to:31) asByteArray)) = 16r46dd794e.

    "Created: / 16-03-2019 / 23:26:18 / Claus Gittinger"
! !

!CRCTests class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
! !