#TUNING by cg
class: RegressionTests::CRCTests
changed:
#test01_crc32
#test02_crc32c
#test03_crc16
"{ Encoding: utf8 }"
"{ 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"
CRC32Stream flushCrcTables.
self assert:(CRC32Stream new hashValueOf:'') = 0.
self assert:(CRC32Stream new hashValueOf:'a') = 16rE8B7BE43.
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.
self assert:(CRC32Stream new hashValueOf:'Lammert Bies') = 16r43C04CA6.
self assert:(CRC32Stream new hashValueOf:' ') = 16rE96CCF45.
"Created: / 16-03-2019 / 23:22:34 / Claus Gittinger"
"Modified (comment): / 17-03-2019 / 14:08:26 / Claus Gittinger"
!
test02_crc32c
"the Castagnoli crc32"
CRC32Stream flushCrcTables.
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.
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:1000000)) = 16r71AF9A4E.
"Created: / 16-03-2019 / 23:39:52 / Claus Gittinger"
"Modified: / 17-03-2019 / 16:56:14 / Claus Gittinger"
!
test03_crc16
"the default ccitt crc16"
CRC16Stream flushCrcTables.
"/ CRCStream flushCrcTables.
"/ CRC32Stream flushCrcTables.
self assert:(CRC16Stream newKERMIT hashValueOf:'') = 0.
self assert:(CRC16Stream newKERMIT hashValueOf:'a') = 16r8F72.
self assert:(CRC16Stream newKERMIT hashValueOf:' ') = 16r0221.
self assert:(CRC16Stream newKERMIT hashValueOf:'123456789') = 16r8921.
self assert:(CRC16Stream newDNP hashValueOf:'') = 16rFFFF.
self assert:(CRC16Stream newDNP hashValueOf:'a') = 16r50B3.
self assert:(CRC16Stream newDNP hashValueOf:' ') = 16r50D6.
self assert:(CRC16Stream newDNP hashValueOf:'123456789') = 16r82EA.
self assert:(CRC16Stream newMODBUS hashValueOf:'') = 0.
self assert:(CRC16Stream newMODBUS hashValueOf:'a') = 16rA87E.
self assert:(CRC16Stream newMODBUS hashValueOf:' ') = 16r98BE.
self assert:(CRC16Stream newMODBUS hashValueOf:'123456789') = 16r4B37.
self assert:(CRC16Stream newCRC_16 hashValueOf:'') = 0.
self assert:(CRC16Stream newCRC_16 hashValueOf:'a') = 16r50B3.
self assert:(CRC16Stream newCRC_16 hashValueOf:' ') = 16r50D6.
self assert:(CRC16Stream newCRC_16 hashValueOf:'123456789') = 16rBB3d.
self assert:(CRC16Stream newCCITT hashValueOf:'') = 0.
self assert:(CRC16Stream newCCITT hashValueOf:'a') = 16r9D77.
self assert:(CRC16Stream newCCITT hashValueOf:' ') = 16rC592.
self assert:(CRC16Stream newCCITT hashValueOf:'123456789') = 16r8921.
"Created: / 16-03-2019 / 23:40:26 / Claus Gittinger"
"Modified: / 17-03-2019 / 15:10:28 / Claus Gittinger"
! !
!CRCTests class methodsFor:'documentation'!
version_CVS
^ '$Header$'
! !