2038
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1692
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#EncoderTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-Collections'
|
|
12 |
!
|
|
13 |
|
|
14 |
|
|
15 |
!EncoderTests class methodsFor:'queries'!
|
|
16 |
|
|
17 |
coveredClassNames
|
|
18 |
^ #( Base64Coder Base32Coder )
|
|
19 |
|
|
20 |
"Modified: / 26-08-2017 / 12:38:14 / cg"
|
|
21 |
! !
|
|
22 |
|
|
23 |
!EncoderTests methodsFor:'testing'!
|
|
24 |
|
|
25 |
test01_base64
|
|
26 |
|verbose|
|
|
27 |
|
|
28 |
verbose := false.
|
|
29 |
|
|
30 |
0 to:80 do:[:l |
|
2038
|
31 |
|coder decoder data encoding decoded decoded2|
|
1692
|
32 |
|
|
33 |
data := (0 to:l) asByteArray copyTo:l.
|
|
34 |
coder := Base64Coder on:'' writeStream.
|
|
35 |
coder nextPutAll:data.
|
|
36 |
coder flush.
|
|
37 |
|
|
38 |
encoding := coder contents.
|
|
39 |
|
|
40 |
decoder := Base64Coder on:encoding readStream.
|
|
41 |
decoded := decoder upToEnd.
|
|
42 |
|
|
43 |
verbose ifTrue:[
|
|
44 |
Transcript showCR:(data printString).
|
|
45 |
Transcript show:' -> '; showCR:encoding.
|
|
46 |
Transcript show:' ---> '; showCR:(decoded printString).
|
|
47 |
].
|
|
48 |
|
|
49 |
self assert:(data = decoded).
|
2038
|
50 |
|
|
51 |
decoded2 := Base64Coder decode:encoding.
|
|
52 |
|
|
53 |
verbose ifTrue:[
|
|
54 |
Transcript showCR:(data printString).
|
|
55 |
Transcript show:' -> '; showCR:encoding.
|
|
56 |
Transcript show:' ---> '; showCR:(decoded2 printString).
|
|
57 |
].
|
|
58 |
|
|
59 |
self assert:(data = decoded2).
|
1692
|
60 |
].
|
|
61 |
|
|
62 |
"
|
|
63 |
self new test01_base64
|
|
64 |
"
|
|
65 |
|
|
66 |
"Created: / 26-08-2017 / 12:38:40 / cg"
|
2038
|
67 |
"Modified: / 30-09-2018 / 17:02:02 / Claus Gittinger"
|
1692
|
68 |
!
|
|
69 |
|
|
70 |
test11_base32
|
|
71 |
|verbose|
|
|
72 |
|
|
73 |
verbose := false.
|
|
74 |
|
|
75 |
0 to:80 do:[:l |
|
|
76 |
|coder decoder data encoding decoded|
|
|
77 |
|
|
78 |
data := (0 to:l) asByteArray copyTo:l.
|
|
79 |
coder := Base32Coder on:'' writeStream.
|
|
80 |
coder nextPutAll:data.
|
|
81 |
coder flush.
|
|
82 |
|
|
83 |
encoding := coder contents.
|
|
84 |
|
|
85 |
decoder := Base32Coder on:encoding readStream.
|
|
86 |
decoded := decoder upToEnd.
|
|
87 |
|
|
88 |
verbose ifTrue:[
|
|
89 |
Transcript showCR:(data printString).
|
|
90 |
Transcript show:' -> '; showCR:encoding.
|
|
91 |
Transcript show:' ---> '; showCR:(decoded printString).
|
|
92 |
].
|
|
93 |
self assert:(data = decoded).
|
|
94 |
].
|
|
95 |
|
|
96 |
"
|
|
97 |
self new test11_base32
|
|
98 |
"
|
|
99 |
|
|
100 |
"Created: / 26-08-2017 / 12:38:59 / cg"
|
|
101 |
! !
|
|
102 |
|
|
103 |
!EncoderTests class methodsFor:'documentation'!
|
|
104 |
|
|
105 |
version
|
|
106 |
^ '$Header$'
|
|
107 |
!
|
|
108 |
|
|
109 |
version_CVS
|
|
110 |
^ '$Header$'
|
|
111 |
! !
|
|
112 |
|