author | Stefan Vogel <sv@exept.de> |
Tue, 11 Jun 2019 10:34:41 +0200 | |
changeset 2321 | 32ea6329f5ad |
parent 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:'tests'! |
|
31 |
||
32 |
test1_Array |
|
1211 | 33 |
|
34 |
self assert:( #( ) readStream upTo:$c ) = #(). |
|
35 |
self assert:( #( ) readStream upTo:$c; position ) = 0 . |
|
36 |
||
37 |
self assert:( #( $a $b ) readStream next; next; upTo:$c ) = #(). |
|
38 |
self assert:( #( $a $b ) readStream next; next; upTo:$c; position ) = 2 . |
|
39 |
||
1210 | 40 |
self assert:( #( $a $b $c $d ) readStream upTo:$c ) = #($a "16r61" $b "16r62"). |
41 |
self assert:( #( $a $b $c $d ) readStream upTo:$c; position ) = 3 . |
|
42 |
self assert:( #( $a $b $c $d ) readStream upTo:$1 ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64") . |
|
43 |
self assert:( #( $a $b $c $d ) readStream upTo:$1; position ) = 4 . |
|
44 |
||
45 |
self assert:( #( $a $b $c $d ) readStream upTo:$a ) = #(). |
|
46 |
self assert:( #( $a $b $c $d ) readStream upTo:$a; position ) = 1. |
|
47 |
||
48 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c ) = #($b "16r62") . |
|
49 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c; position ) = 3 . |
|
50 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1 ) = #($b "16r62" $c "16r63" $d "16r64") . |
|
51 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1; position ) = 4 . |
|
52 |
||
53 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c ) = #( $d $a $b) . |
|
54 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c; position ) = 7. |
|
55 |
||
56 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c ) = #($a "16r61" $b "16r62") . |
|
57 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c; position ) = 3 . |
|
58 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1 ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64" $e "16r65"). |
|
59 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1; position ) = 5 . |
|
60 |
! |
|
61 |
||
62 |
test1_String |
|
1211 | 63 |
|
64 |
self assert:( 'ab' readStream next; next; upTo:$c ) = ''. |
|
65 |
self assert:( 'ab' readStream next; next; upTo:$c; position ) = 2 . |
|
66 |
||
1210 | 67 |
self assert:( 'abcd' readStream upTo:$c ) = 'ab'. |
68 |
self assert:( 'abcd' readStream upTo:$c; position ) = 3. |
|
1447 | 69 |
self assert:( 'abcd' readStream upTo:$1 ) = 'abcd'. |
1210 | 70 |
self assert:( 'abcd' readStream upTo:$1; position ) = 4. |
71 |
||
72 |
self assert:( 'abcd' readStream upTo:$a ) = ''. |
|
73 |
self assert:( 'abcd' readStream upTo:$a; position ) = 1. |
|
74 |
||
75 |
||
76 |
self assert:( 'abcd' readStream next; upTo:$c ) = 'b' . |
|
77 |
self assert:( 'abcd' readStream next; upTo:$c; position ) = 3. |
|
78 |
self assert:( 'abcd' readStream next; upTo:$1 ) = 'bcd' . |
|
79 |
self assert:( 'abcd' readStream next; upTo:$1; position ) = 4. |
|
80 |
||
81 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c ) = 'dab' . |
|
82 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c; position ) = 7. |
|
83 |
||
84 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c ) = 'ab' . |
|
85 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c; position ) = 3. |
|
86 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1 ) = 'abcde'. |
|
87 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1; position ) = 5. |
|
88 |
! ! |
|
89 |
||
90 |
!StreamUpToTests class methodsFor:'documentation'! |
|
91 |
||
92 |
version |
|
93 |
^ '$Header$' |
|
94 |
! |
|
95 |
||
96 |
version_CVS |
|
97 |
^ '$Header$' |
|
98 |
! ! |
|
99 |