author | Claus Gittinger <cg@exept.de> |
Wed, 27 Mar 2019 18:34:04 +0100 | |
changeset 2189 | 5c1b6dc15541 |
parent 1447 | 2351db93aa5b |
child 1500 | d406a10b2965 |
child 2254 | 49525f6c1f4d |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
1210 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#StreamUpToTests |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
1279
b6f6576c2106
class: RegressionTests::StreamUpToTests
Stefan Vogel <sv@exept.de>
parents:
1211
diff
changeset
|
9 |
category:'tests-Regression-Streams' |
1210 | 10 |
! |
11 |
||
12 |
!StreamUpToTests class methodsFor:'documentation'! |
|
13 |
||
14 |
documentation |
|
15 |
" |
|
16 |
documentation to be added. |
|
17 |
||
18 |
[author:] |
|
1447 | 19 |
ca |
1210 | 20 |
|
21 |
[instance variables:] |
|
22 |
||
23 |
[class variables:] |
|
24 |
||
25 |
[see also:] |
|
26 |
||
27 |
" |
|
28 |
! ! |
|
29 |
||
30 |
!StreamUpToTests methodsFor:'initialize / release'! |
|
31 |
||
32 |
setUp |
|
33 |
"common setup - invoked before testing." |
|
34 |
||
35 |
super setUp |
|
36 |
! |
|
37 |
||
38 |
tearDown |
|
39 |
"common cleanup - invoked after testing." |
|
40 |
||
41 |
super tearDown |
|
42 |
! ! |
|
43 |
||
44 |
!StreamUpToTests methodsFor:'tests'! |
|
45 |
||
46 |
test1_Array |
|
1211 | 47 |
|
48 |
self assert:( #( ) readStream upTo:$c ) = #(). |
|
49 |
self assert:( #( ) readStream upTo:$c; position ) = 0 . |
|
50 |
||
51 |
self assert:( #( $a $b ) readStream next; next; upTo:$c ) = #(). |
|
52 |
self assert:( #( $a $b ) readStream next; next; upTo:$c; position ) = 2 . |
|
53 |
||
1210 | 54 |
self assert:( #( $a $b $c $d ) readStream upTo:$c ) = #($a "16r61" $b "16r62"). |
55 |
self assert:( #( $a $b $c $d ) readStream upTo:$c; position ) = 3 . |
|
56 |
self assert:( #( $a $b $c $d ) readStream upTo:$1 ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64") . |
|
57 |
self assert:( #( $a $b $c $d ) readStream upTo:$1; position ) = 4 . |
|
58 |
||
59 |
self assert:( #( $a $b $c $d ) readStream upTo:$a ) = #(). |
|
60 |
self assert:( #( $a $b $c $d ) readStream upTo:$a; position ) = 1. |
|
61 |
||
62 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c ) = #($b "16r62") . |
|
63 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c; position ) = 3 . |
|
64 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1 ) = #($b "16r62" $c "16r63" $d "16r64") . |
|
65 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1; position ) = 4 . |
|
66 |
||
67 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c ) = #( $d $a $b) . |
|
68 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c; position ) = 7. |
|
69 |
||
70 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c ) = #($a "16r61" $b "16r62") . |
|
71 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c; position ) = 3 . |
|
72 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1 ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64" $e "16r65"). |
|
73 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1; position ) = 5 . |
|
74 |
! |
|
75 |
||
76 |
test1_String |
|
1211 | 77 |
|
78 |
self assert:( 'ab' readStream next; next; upTo:$c ) = ''. |
|
79 |
self assert:( 'ab' readStream next; next; upTo:$c; position ) = 2 . |
|
80 |
||
1210 | 81 |
self assert:( 'abcd' readStream upTo:$c ) = 'ab'. |
82 |
self assert:( 'abcd' readStream upTo:$c; position ) = 3. |
|
1447 | 83 |
self assert:( 'abcd' readStream upTo:$1 ) = 'abcd'. |
1210 | 84 |
self assert:( 'abcd' readStream upTo:$1; position ) = 4. |
85 |
||
86 |
self assert:( 'abcd' readStream upTo:$a ) = ''. |
|
87 |
self assert:( 'abcd' readStream upTo:$a; position ) = 1. |
|
88 |
||
89 |
||
90 |
self assert:( 'abcd' readStream next; upTo:$c ) = 'b' . |
|
91 |
self assert:( 'abcd' readStream next; upTo:$c; position ) = 3. |
|
92 |
self assert:( 'abcd' readStream next; upTo:$1 ) = 'bcd' . |
|
93 |
self assert:( 'abcd' readStream next; upTo:$1; position ) = 4. |
|
94 |
||
95 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c ) = 'dab' . |
|
96 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c; position ) = 7. |
|
97 |
||
98 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c ) = 'ab' . |
|
99 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c; position ) = 3. |
|
100 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1 ) = 'abcde'. |
|
101 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1; position ) = 5. |
|
102 |
! ! |
|
103 |
||
104 |
!StreamUpToTests class methodsFor:'documentation'! |
|
105 |
||
106 |
version |
|
107 |
^ '$Header$' |
|
108 |
! |
|
109 |
||
110 |
version_CVS |
|
111 |
^ '$Header$' |
|
112 |
! ! |
|
113 |