2106
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
2098
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#CRCTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-Streams'
|
|
12 |
!
|
|
13 |
|
|
14 |
!CRCTests class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
documentation to be added.
|
|
19 |
|
|
20 |
[author:]
|
|
21 |
Claus Gittinger
|
|
22 |
|
|
23 |
[instance variables:]
|
|
24 |
|
|
25 |
[class variables:]
|
|
26 |
|
|
27 |
[see also:]
|
|
28 |
|
|
29 |
"
|
|
30 |
! !
|
|
31 |
|
|
32 |
!CRCTests methodsFor:'tests'!
|
|
33 |
|
|
34 |
test01_crc32
|
|
35 |
"the default ccitt crc32"
|
|
36 |
|
|
37 |
self assert:(CRC32Stream new hashValueOf:'') = 0.
|
|
38 |
self assert:(CRC32Stream new hashValueOf:'resume') = 16r60C1D0A0.
|
|
39 |
self assert:(CRC32Stream new hashValueOf:#[1 2 3 4 5 6 7]) = 16r70E46888.
|
|
40 |
self assert:(CRC32Stream new hashValueOf:(ByteArray new:40 withAll:16rFF)) = 16r8CD04C73.
|
|
41 |
self assert:(CRC32Stream new hashValueOf:'123456789') = 16rCBF43926.
|
|
42 |
|
|
43 |
"Created: / 16-03-2019 / 23:22:34 / Claus Gittinger"
|
|
44 |
!
|
|
45 |
|
2106
|
46 |
test02_crc32c
|
|
47 |
"the Castagnoli crc32"
|
2098
|
48 |
|
|
49 |
self assert:(CRC32Stream newCrc32c hashValueOf:'') = 0.
|
|
50 |
self assert:(CRC32Stream newCrc32c hashValueOf:'a') = 16rC1D04330.
|
|
51 |
self assert:(CRC32Stream newCrc32c hashValueOf:'123456789') = 16rE3069283.
|
|
52 |
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:0)) = 16r8A9136AA.
|
|
53 |
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:16rFF)) = 16r62a8ab43.
|
|
54 |
self assert:(CRC32Stream newCrc32c hashValueOf:((0 to:31) asByteArray)) = 16r46dd794e.
|
|
55 |
|
2106
|
56 |
"Created: / 16-03-2019 / 23:39:52 / Claus Gittinger"
|
|
57 |
!
|
|
58 |
|
|
59 |
test03_crc16
|
|
60 |
"the default ccitt crc16"
|
|
61 |
|
|
62 |
CRC16Stream flushCrcTables.
|
|
63 |
"/ CRCStream flushCrcTables.
|
|
64 |
"/ CRC32Stream flushCrcTables.
|
|
65 |
self assert:(CRC16Stream new hashValueOf:#[16rFC 5 16r11]) = 16r2756.
|
|
66 |
self assert:(CRC16Stream new hashValueOf:'123456789') = 16r8921.
|
|
67 |
|
|
68 |
"Created: / 16-03-2019 / 23:40:26 / Claus Gittinger"
|
2098
|
69 |
! !
|
|
70 |
|
|
71 |
!CRCTests class methodsFor:'documentation'!
|
|
72 |
|
|
73 |
version_CVS
|
|
74 |
^ '$Header$'
|
|
75 |
! !
|
|
76 |
|