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 |
|
2107
|
37 |
CRC32Stream flushCrcTables.
|
|
38 |
|
2098
|
39 |
self assert:(CRC32Stream new hashValueOf:'') = 0.
|
2107
|
40 |
self assert:(CRC32Stream new hashValueOf:'a') = 16rE8B7BE43.
|
2098
|
41 |
self assert:(CRC32Stream new hashValueOf:'resume') = 16r60C1D0A0.
|
|
42 |
self assert:(CRC32Stream new hashValueOf:#[1 2 3 4 5 6 7]) = 16r70E46888.
|
|
43 |
self assert:(CRC32Stream new hashValueOf:(ByteArray new:40 withAll:16rFF)) = 16r8CD04C73.
|
|
44 |
self assert:(CRC32Stream new hashValueOf:'123456789') = 16rCBF43926.
|
2107
|
45 |
self assert:(CRC32Stream new hashValueOf:'Lammert Bies') = 16r43C04CA6.
|
|
46 |
self assert:(CRC32Stream new hashValueOf:' ') = 16rE96CCF45.
|
2098
|
47 |
|
|
48 |
"Created: / 16-03-2019 / 23:22:34 / Claus Gittinger"
|
2107
|
49 |
"Modified (comment): / 17-03-2019 / 14:08:26 / Claus Gittinger"
|
2098
|
50 |
!
|
|
51 |
|
2106
|
52 |
test02_crc32c
|
|
53 |
"the Castagnoli crc32"
|
2098
|
54 |
|
2107
|
55 |
CRC32Stream flushCrcTables.
|
|
56 |
|
2098
|
57 |
self assert:(CRC32Stream newCrc32c hashValueOf:'') = 0.
|
|
58 |
self assert:(CRC32Stream newCrc32c hashValueOf:'a') = 16rC1D04330.
|
|
59 |
self assert:(CRC32Stream newCrc32c hashValueOf:'123456789') = 16rE3069283.
|
|
60 |
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:0)) = 16r8A9136AA.
|
|
61 |
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:32 withAll:16rFF)) = 16r62a8ab43.
|
|
62 |
self assert:(CRC32Stream newCrc32c hashValueOf:((0 to:31) asByteArray)) = 16r46dd794e.
|
2107
|
63 |
self assert:(CRC32Stream newCrc32c hashValueOf:(ByteArray new:1000000)) = 16r71AF9A4E.
|
2098
|
64 |
|
2106
|
65 |
"Created: / 16-03-2019 / 23:39:52 / Claus Gittinger"
|
2107
|
66 |
"Modified: / 17-03-2019 / 16:56:14 / Claus Gittinger"
|
2106
|
67 |
!
|
|
68 |
|
|
69 |
test03_crc16
|
|
70 |
"the default ccitt crc16"
|
2108
|
71 |
|
|
72 |
self skipIf:true description:'fails, in order of cg skip'.
|
|
73 |
|
2106
|
74 |
CRC16Stream flushCrcTables.
|
|
75 |
"/ CRCStream flushCrcTables.
|
|
76 |
"/ CRC32Stream flushCrcTables.
|
2107
|
77 |
self assert:(CRC16Stream newKERMIT hashValueOf:'') = 0.
|
|
78 |
self assert:(CRC16Stream newKERMIT hashValueOf:'a') = 16r8F72.
|
|
79 |
self assert:(CRC16Stream newKERMIT hashValueOf:' ') = 16r0221.
|
|
80 |
self assert:(CRC16Stream newKERMIT hashValueOf:'123456789') = 16r8921.
|
|
81 |
|
|
82 |
self assert:(CRC16Stream newDNP hashValueOf:'') = 16rFFFF.
|
|
83 |
self assert:(CRC16Stream newDNP hashValueOf:'a') = 16r50B3.
|
|
84 |
self assert:(CRC16Stream newDNP hashValueOf:' ') = 16r50D6.
|
|
85 |
self assert:(CRC16Stream newDNP hashValueOf:'123456789') = 16r82EA.
|
|
86 |
|
|
87 |
self assert:(CRC16Stream newMODBUS hashValueOf:'') = 0.
|
|
88 |
self assert:(CRC16Stream newMODBUS hashValueOf:'a') = 16rA87E.
|
|
89 |
self assert:(CRC16Stream newMODBUS hashValueOf:' ') = 16r98BE.
|
|
90 |
self assert:(CRC16Stream newMODBUS hashValueOf:'123456789') = 16r4B37.
|
|
91 |
|
|
92 |
self assert:(CRC16Stream newCRC_16 hashValueOf:'') = 0.
|
|
93 |
self assert:(CRC16Stream newCRC_16 hashValueOf:'a') = 16r50B3.
|
|
94 |
self assert:(CRC16Stream newCRC_16 hashValueOf:' ') = 16r50D6.
|
|
95 |
self assert:(CRC16Stream newCRC_16 hashValueOf:'123456789') = 16rBB3d.
|
|
96 |
|
|
97 |
self assert:(CRC16Stream newCCITT hashValueOf:'') = 0.
|
|
98 |
self assert:(CRC16Stream newCCITT hashValueOf:'a') = 16r9D77.
|
|
99 |
self assert:(CRC16Stream newCCITT hashValueOf:' ') = 16rC592.
|
|
100 |
self assert:(CRC16Stream newCCITT hashValueOf:'123456789') = 16r8921.
|
2106
|
101 |
|
|
102 |
"Created: / 16-03-2019 / 23:40:26 / Claus Gittinger"
|
2107
|
103 |
"Modified: / 17-03-2019 / 15:10:28 / Claus Gittinger"
|
2108
|
104 |
"Modified: / 19-03-2019 / 11:23:27 / Stefan Reise"
|
2098
|
105 |
! !
|
|
106 |
|
|
107 |
!CRCTests class methodsFor:'documentation'!
|
|
108 |
|
|
109 |
version_CVS
|
|
110 |
^ '$Header$'
|
|
111 |
! !
|
|
112 |
|