RegressionTests__StringTests.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 17:19:49 +0100
changeset 2586 7dc7be5a6f3d
parent 2575 1d58d4961f53
permissions -rw-r--r--
#OTHER by cg s
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
     1
"{ Encoding: utf8 }"
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
     2
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
     3
"{ Package: 'stx:goodies/regression' }"
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: RegressionTests }"
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
TestCase subclass:#StringTests
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
     8
	instanceVariableNames:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
     9
	classVariableNames:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
    10
	poolDictionaries:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
    11
	category:'tests-Regression-Collections'
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
1425
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    15
!StringTests class methodsFor:'queries'!
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    16
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    17
coveredClassNames
2575
1d58d4961f53 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    18
    "These classes can be instrumented for coverage analysis,
1425
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    19
     before running the suite to provide coverage analysis/report"
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    20
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    21
    ^ #( String CharacterArray )
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    22
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    23
    "Created: / 06-07-2011 / 21:27:03 / cg"
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    24
! !
66a1a63431a0 #QUALITY by mawalch
mawalch
parents: 1421
diff changeset
    25
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    26
!StringTests methodsFor:'helpers'!
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    27
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    28
runAccessTestsOnInstancesOf:aStringClass
874
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
    29
    |str s0 s1 s2 s3 s4 t|
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    30
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    31
    0 to:33 do:[:l |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    32
	str := aStringClass new:l.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    33
	str atAllPut:(Character space).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    34
	self assert:( str isBlank ).
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    35
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    36
	1 to:l do:[:pos |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    37
	    str at:pos put:$a.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    38
	    self assert:( str isBlank not ).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    39
	    str at:pos put:(Character space).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
    40
	].
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    41
    ].
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
    42
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    43
    s0 := aStringClass new:0.
287
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
    44
    self assert:s0 isEmpty.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
    45
    self assert:s0 isEmptyOrNil.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
    46
    self assert:s0 size == 0.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
    47
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    48
    s1 := (aStringClass new:5) replaceFrom:1 with:'hello'.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    49
    s2 := (aStringClass new:6) replaceFrom:1 with:' world'.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    50
    self assert:(s1 , s2) size == 11.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    51
    self assert:(s1 , s2) class == aStringClass.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    52
    self assert:(s1 = 'hello').
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    53
    self assert:(s2 = ' world').
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    54
    self assert:(s1 size == 5).
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    55
    self assert:(s2 size == 6).
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    56
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    57
    self assert:(s1 = 'hello').
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    58
    self assert:(s1 asSymbol == #'hello').
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    59
    self assert:(s1 copyFrom:1) = 'hello'.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    60
    self assert:(s1 copyFrom:1) class == aStringClass.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    61
    self assert:(s1 copyFrom:1 to:3) = 'hel'.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    62
    self assert:(s1 copyFrom:1 to:3) class == aStringClass.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    63
    self assert:(s1 copyWith:$X) = 'helloX'.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    64
    self assert:(s1 copyWith:$X) class == aStringClass.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    65
    self assert:(s1 endsWith:'llo').
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    66
    self assert:(s1 startsWith:'hel').
2564
4e29ca66fa6b #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2465
diff changeset
    67
    self assert:(s1 copyTo:3) = 'hel'.
4e29ca66fa6b #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2465
diff changeset
    68
    self assert:(s1 copyFirst:3) = 'hel'.
4e29ca66fa6b #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2465
diff changeset
    69
    self assert:(s1 first:3) = 'hel'.
286
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    70
702
4c5fb5598e9e changed: #runAccessTestsOnInstancesOf:
Claus Gittinger <cg@exept.de>
parents: 635
diff changeset
    71
    self assert:(t := s1 identityIndexOf:$h) == 1 description:('identityIndex is %1 (should be 1)' bindWith:t).
4c5fb5598e9e changed: #runAccessTestsOnInstancesOf:
Claus Gittinger <cg@exept.de>
parents: 635
diff changeset
    72
    self assert:(t := s1 identityIndexOf:$l) == 3 description:('identityIndex is %1 (should be 3)' bindWith:t).
4c5fb5598e9e changed: #runAccessTestsOnInstancesOf:
Claus Gittinger <cg@exept.de>
parents: 635
diff changeset
    73
    self assert:(t := s1 identityIndexOf:$L) == 0 description:('identityIndex is %1 (should be 0)' bindWith:t).
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    74
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    75
    self assert:(s1 identityIndexOf:$h startingAt:1) == 1.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    76
    self assert:(s1 identityIndexOf:$h startingAt:2) == 0.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    77
    self assert:(s1 identityIndexOf:$e startingAt:1) == 2.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    78
    self assert:(s1 identityIndexOf:$e startingAt:2) == 2.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    79
    self assert:(s1 identityIndexOf:$l startingAt:1) == 3.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    80
    self assert:(s1 identityIndexOf:$l startingAt:2) == 3.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    81
    self assert:(s1 identityIndexOf:$l startingAt:3) == 3.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    82
    self assert:(s1 identityIndexOf:$l startingAt:4) == 4.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    83
    self assert:(s1 identityIndexOf:$l startingAt:5) == 0.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    84
    self assert:(s1 identityIndexOf:$l startingAt:6) == 0.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    85
286
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    86
    self assert:(s1 indexOf:$h) == 1.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    87
    self assert:(s1 indexOf:$l) == 3.
287
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
    88
    self assert:(s1 indexOf:$L) == 0.
874
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
    89
    self assert:(s1 indexOf:$A) == 0.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
    90
286
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    91
    self assert:(s1 indexOf:$h startingAt:1) == 1.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    92
    self assert:(s1 indexOf:$h startingAt:2) == 0.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    93
    self assert:(s1 indexOf:$e startingAt:1) == 2.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    94
    self assert:(s1 indexOf:$e startingAt:2) == 2.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    95
    self assert:(s1 indexOf:$l startingAt:1) == 3.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    96
    self assert:(s1 indexOf:$l startingAt:2) == 3.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    97
    self assert:(s1 indexOf:$l startingAt:3) == 3.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    98
    self assert:(s1 indexOf:$l startingAt:4) == 4.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
    99
    self assert:(s1 indexOf:$l startingAt:5) == 0.
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   100
    self assert:(s1 indexOf:$l startingAt:6) == 0.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   101
286
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   102
    self assert:(s1 includes:$l).
bf494c929515 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 285
diff changeset
   103
    self assert:(s1 includes:$L) not.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   104
287
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   105
    self assert:(s1 includesAny:'a') not.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   106
    self assert:(s1 includesAny:'ab') not.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   107
    self assert:(s1 includesAny:'abc') not.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   108
    self assert:(s1 includesAny:'abcd') not.
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   109
    self assert:(s1 includesAny:'abcde').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   110
    self assert:(s1 includesAny:'e').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   111
    self assert:(s1 includesAny:'ae').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   112
    self assert:(s1 includesAny:'ea').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   113
    self assert:(s1 includesAny:'abe').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   114
    self assert:(s1 includesAny:'eab').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   115
    self assert:(s1 includesAny:'aeb').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   116
    self assert:(s1 includesAny:'abce').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   117
    self assert:(s1 includesAny:'eabc').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   118
    self assert:(s1 includesAny:'aebc').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   119
    self assert:(s1 includesAny:'abec').
e19c028a4dc5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 286
diff changeset
   120
    self assert:(s1 includesAny:'abcde').
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   121
						  " 12345678901234567890 "
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   122
    s3 := (aStringClass new:20) replaceFrom:1 with:'12 45,78;01.34-67+90'.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   123
    t := s3 asCollectionOfSubstringsSeparatedBy:$,.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   124
    self assert:(t size = 2).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   125
    self assert:(t first = '12 45').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   126
    self assert:(t second = '78;01.34-67+90').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   127
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   128
    t := s3 asCollectionOfSubstringsSeparatedByAny:',;. '.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   129
    self assert:(t size = 5).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   130
    self assert:(t first = '12').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   131
    self assert:(t second = '45').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   132
    self assert:(t third = '78').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   133
    self assert:(t fourth = '01').
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   134
    self assert:(t fifth = '34-67+90').
874
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   135
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   136
    s4 := (aStringClass new:10) replaceFrom:1 with:'123',Character tab,'567',Character cr,'90'.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   137
    self assert:(s4 size = 10).
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   138
    self assert:(s4 indexOfSeparatorStartingAt:1) = 4.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   139
    self assert:(s4 indexOfSeparatorStartingAt:3) = 4.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   140
    self assert:(s4 indexOfSeparatorStartingAt:4) = 4.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   141
    self assert:(s4 indexOfSeparatorStartingAt:5) = 8.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   142
    self assert:(s4 indexOfControlCharacterStartingAt:1) = 4.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   143
    self assert:(s4 indexOfNonSeparatorStartingAt:1) = 1.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   144
    self assert:(s4 indexOfNonSeparatorStartingAt:3) = 3.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   145
    self assert:(s4 indexOfNonSeparatorStartingAt:4) = 5.
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   146
    self assert:(s4 indexOfNonSeparatorStartingAt:5) = 5.
352
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   147
! !
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   148
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   149
!StringTests methodsFor:'tests'!
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   150
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   151
bench_stringSearch
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   152
    "
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   153
     self new bench_stringSearch
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   154
    "
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   155
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   156
    |haystack toBeFoundAtEnd|
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   157
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   158
    toBeFoundAtEnd := '0123456789012345678901234567890123456789'.
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   159
    haystack := String new:50000.
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   160
    haystack := String new:1000.
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   161
    haystack replaceFrom:(haystack size-toBeFoundAtEnd size) with:toBeFoundAtEnd.
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   162
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   163
    #(
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   164
	$0
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   165
	'0'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   166
	'01'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   167
	'012'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   168
	'0123'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   169
	'01234'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   170
	'012345'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   171
	'0123456'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   172
	'01234567'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   173
	'012345678'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   174
	'0123456789'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   175
	'01234567890123456789'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   176
	'0123456789012345678901234567890123456789'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   177
	'01234567890123456789012345678901234567890123456789'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   178
	'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   179
    ) do:[:needle |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   180
	|micros i|
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   181
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   182
	needle isCharacter ifTrue:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   183
	    micros := Time microsecondsToRun:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   184
		    1000 timesRepeat:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   185
			haystack indexOf:needle startingAt:1
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   186
		    ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   187
		 ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   188
	    i := haystack indexOf:needle startingAt:1
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   189
	] ifFalse:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   190
	    micros := Time microsecondsToRun:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   191
		    1000 timesRepeat:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   192
			haystack indexOfSubCollection:needle startingAt:1 ifAbsent:0 caseSensitive:true
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   193
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   194
		    ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   195
		 ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   196
	    i := haystack indexOfSubCollection:needle startingAt:1 ifAbsent:(haystack size) caseSensitive:true.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   197
	].
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   198
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   199
	Transcript showCR:'size %1: t=%2 (%3 chars/second)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   200
		     with:(needle isCharacter ifTrue:[1] ifFalse:[needle size])
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   201
		     with:(TimeDuration microseconds:micros)
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   202
		     with:(UnitConverter
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   203
			    unitStringFor:((i*1000000.0) / micros )
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   204
			    scale:1000 rounded:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   205
			    unitStrings:#('' 'k' 'M' 'G' 'T' 'P' 'E' )).
2365
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   206
    ].
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   207
!
c49d92aa47aa #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2364
diff changeset
   208
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   209
test01_access
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   210
    0 to:33 do:[:l |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   211
	|str|
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   212
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   213
	str := String new:l.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   214
	str atAllPut:(Character space).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   215
	self assert:( str isBlank ).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   216
	self assert:((str size == 0) or: [(str first) == Character space.]).
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   217
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   218
	1 to:l do:[:pos |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   219
	    str at:pos put:$a.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   220
	    self assert:( str isBlank not ).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   221
	    self assert:((str at:pos) == $a).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   222
	    str at:pos put:(Character space).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   223
	].
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   224
    ].
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   225
    self runAccessTestsOnInstancesOf:String
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   226
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   227
    "
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   228
     self new test01_access
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   229
    "
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   230
!
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   231
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   232
test02_subclassAccess
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   233
    |myStringClass s1|
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   234
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   235
    Class withoutUpdatingChangesDo:[
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   236
	myStringClass := String
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   237
			subclass:#'MyString'
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   238
			instanceVariableNames:'foo'
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   239
			classVariableNames:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   240
			poolDictionaries:nil.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   241
	myStringClass compile:'foo ^foo'.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   242
	myStringClass compile:'foo:arg foo := arg'.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   243
    ].
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   244
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   245
    s1 := (myStringClass new:5) replaceFrom:1 with:'hello'.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   246
    self assert:(s1 foo isNil).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   247
    self assert:(s1 size == 5).
874
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   248
    s1 foo:16r11413344.         "/ ensure there is a $A inside (hex 41)
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   249
    self assert:(s1 foo == 16r11413344).
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   250
    self assert:(s1 = 'hello').
874
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   251
    self assert:(s1 deepCopy foo == 16r11413344).
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   252
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   253
    self assert:((s1 indexOf:$A) == 0).                 "/ should not find the A
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   254
    self assert:((s1 identityIndexOf:$A) == 0).         "/ should not find the A
7936c9ee23d5 class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   255
    self assert:((s1 findFirst:[:ch | ch == $A]) == 0). "/ should not find the A
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   256
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   257
    self runAccessTestsOnInstancesOf:myStringClass.
285
11e1200a3625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
   258
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   259
    "
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   260
     self new test02_subclassAccess
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   261
    "
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   262
!
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   263
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   264
test03a_unicode16
1693
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   265
    |u s u2|
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   266
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   267
    u := 'hello' asUnicode16String.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   268
    self assert:(u class == Unicode16String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   269
    self assert:(u size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   270
    self assert:((u at:1) == $h).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   271
    self assert:((u at:2) == $e).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   272
    self assert:((u at:3) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   273
    self assert:((u at:4) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   274
    self assert:((u at:5) == $o).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   275
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   276
    s := u asSingleByteString.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   277
    self assert:(s class == String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   278
    self assert:(s size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   279
    self assert:((s at:1) == $h).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   280
    self assert:((s at:2) == $e).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   281
    self assert:((s at:3) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   282
    self assert:((s at:4) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   283
    self assert:((s at:5) == $o).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   284
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   285
    s := u asSingleByteStringIfPossible.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   286
    self assert:(s class == String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   287
    self assert:(s size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   288
    self assert:((s at:1) == $h).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   289
    self assert:((s at:2) == $e).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   290
    self assert:((s at:3) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   291
    self assert:((s at:4) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   292
    self assert:((s at:5) == $o).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   293
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   294
    u2 := 'hello' asUnicode16String.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   295
    u2 at:1 put:(Character codePoint:16r20AC).   "/ euro character
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   296
    self assert:(u2 size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   297
    self assert:((u2 at:1) = (Character codePoint:16r20AC)).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   298
    self assert:((u2 at:2) == $e).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   299
    self assert:((u2 at:3) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   300
    self assert:((u2 at:4) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   301
    self assert:((u2 at:5) == $o).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   302
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   303
    s := u2 asSingleByteStringIfPossible.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   304
    self assert:(s class == Unicode16String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   305
    self assert:(u2 == s).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   306
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   307
    u := Unicode16String fromString:'hello'.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   308
    self assert:(u class == Unicode16String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   309
    self assert:(u size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   310
    self assert:((u at:1) == $h).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   311
    self assert:((u at:2) == $e).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   312
    self assert:((u at:3) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   313
    self assert:((u at:4) == $l).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   314
    self assert:((u at:5) == $o).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   315
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   316
    u replaceFrom:1 to:5 with:'abcde' startingAt:1.
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   317
    self assert:(u class == Unicode16String).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   318
    self assert:(u size == 5).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   319
    self assert:((u at:1) == $a).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   320
    self assert:((u at:2) == $b).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   321
    self assert:((u at:3) == $c).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   322
    self assert:((u at:4) == $d).
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   323
    self assert:((u at:5) == $e).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   324
1693
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   325
    "
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   326
     self new test03a_unicode16
1693
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   327
    "
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   328
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   329
    "Created: / 02-04-2019 / 10:43:49 / Claus Gittinger"
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   330
!
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   331
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   332
test03b_unicode32
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   333
    |u s u2|
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   334
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   335
    u := 'hello' asUnicode32String.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   336
    self assert:(u class == Unicode32String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   337
    self assert:(u size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   338
    self assert:((u at:1) == $h).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   339
    self assert:((u at:2) == $e).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   340
    self assert:((u at:3) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   341
    self assert:((u at:4) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   342
    self assert:((u at:5) == $o).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   343
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   344
    s := u asSingleByteString.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   345
    self assert:(s class == String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   346
    self assert:(s size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   347
    self assert:((s at:1) == $h).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   348
    self assert:((s at:2) == $e).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   349
    self assert:((s at:3) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   350
    self assert:((s at:4) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   351
    self assert:((s at:5) == $o).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   352
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   353
    s := u asSingleByteStringIfPossible.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   354
    self assert:(s class == String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   355
    self assert:(s size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   356
    self assert:((s at:1) == $h).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   357
    self assert:((s at:2) == $e).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   358
    self assert:((s at:3) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   359
    self assert:((s at:4) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   360
    self assert:((s at:5) == $o).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   361
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   362
    u2 := 'hello' asUnicode32String.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   363
    u2 at:1 put:(Character codePoint:16r20AC).   "/ euro character
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   364
    self assert:(u2 size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   365
    self assert:((u2 at:1) = (Character codePoint:16r20AC)).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   366
    self assert:((u2 at:2) == $e).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   367
    self assert:((u2 at:3) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   368
    self assert:((u2 at:4) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   369
    self assert:((u2 at:5) == $o).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   370
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   371
    s := u2 asSingleByteStringIfPossible.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   372
    self assert:(s class == Unicode32String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   373
    self assert:(u2 == s).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   374
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   375
    u := Unicode32String fromString:'hello'.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   376
    self assert:(u class == Unicode32String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   377
    self assert:(u size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   378
    self assert:((u at:1) == $h).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   379
    self assert:((u at:2) == $e).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   380
    self assert:((u at:3) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   381
    self assert:((u at:4) == $l).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   382
    self assert:((u at:5) == $o).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   383
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   384
    u replaceFrom:1 to:5 with:'abcde' startingAt:1.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   385
    self assert:(u class == Unicode32String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   386
    self assert:(u size == 5).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   387
    self assert:((u at:1) == $a).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   388
    self assert:((u at:2) == $b).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   389
    self assert:((u at:3) == $c).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   390
    self assert:((u at:4) == $d).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   391
    self assert:((u at:5) == $e).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   392
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   393
    "
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   394
     self new test03b_unicode32
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   395
    "
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   396
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   397
    "Created: / 02-04-2019 / 10:44:34 / Claus Gittinger"
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   398
!
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   399
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   400
test03c_unicodeStrings
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   401
    |u32 u16 u8|
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   402
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   403
    u32 := 'hello' asUnicode32String.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   404
    u16 := 'hello' asUnicode16String.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   405
    u8 := 'hello' asString.
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   406
    self assert:(u32 = u16).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   407
    self assert:(u16 = u32).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   408
    self assert:(u32 = u8).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   409
    self assert:(u8 = u32).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   410
    self assert:(u16 = u8).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   411
    self assert:(u8 = u16).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   412
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   413
    self assert:(u32 asDenseUnicodeString = u8).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   414
    self assert:(u32 asDenseUnicodeString class == String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   415
    self assert:(u16 asDenseUnicodeString = u8).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   416
    self assert:(u16 asDenseUnicodeString class == String).
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   417
    self assert:(u8 asDenseUnicodeString == u8).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   418
2209
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   419
    "
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   420
     self new test03c_unicodeStrings
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   421
    "
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   422
dd72456e8de4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   423
    "Created: / 02-04-2019 / 10:46:10 / Claus Gittinger"
1693
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   424
!
04a3687c829e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   425
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   426
test10_Contains8BitCharacters
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   427
    0 to:65 do:[:l |
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   428
	|str|
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   430
	str := String new:l.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   431
	str atAllPut:(Character value:16r7F).
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   432
	self assert:( str contains8BitCharacters not ).
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   434
	1 to:l do:[:pos |
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   435
	    str at:pos put:(Character value:16r80).
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   436
	    self assert:( str contains8BitCharacters ).
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   437
	    str at:pos put:(Character value:16r7F).
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   438
	].
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    ].
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
    "
284
5a049629081c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 283
diff changeset
   442
     self new test10_Contains8BitCharacters
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
    "
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   444
!
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   445
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   446
test11_IsEmpty
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   447
    |nul n|
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   448
    nul := 0 asCharacter.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   449
    n := 1.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   450
    self assert:('' isEmpty).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   451
    self assert:(' ' isEmpty not).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   452
    self assert:(nul asCharacter asString isEmpty not).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   453
    self assert:(('' , nul) isEmpty not).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   454
    self assert:((String new:0) isEmpty).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   455
    self assert:((String new:17 withAll:nul) isEmpty not).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   456
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   457
    29 timesRepeat:[
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   458
	|s|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   459
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   460
	s := String new:(n + 17).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   461
	self assert:(s isEmpty not).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   462
	n := n * 2.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   463
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   464
    self assert:((String new:17 withAll:nul) isEmpty not).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   465
    self assert:((String new:0 withAll:nul) isEmpty).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   466
    "
1429
0201c6bd39a4 #DOCUMENTATION by mawalch
mawalch
parents: 1428
diff changeset
   467
     self new test11_IsEmpty
0201c6bd39a4 #DOCUMENTATION by mawalch
mawalch
parents: 1428
diff changeset
   468
    "
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   469
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   470
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   471
test12_Comparison
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   472
    0 to: 255 do: [ :i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   473
	|s t|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   474
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   475
	1 to: 9 do: [ :j |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   476
	    s := String new:j withAll:(i asCharacter).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   477
	    t := s copy.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   478
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   479
	    self assert:(s notNil).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   480
	    self assert:(s = s).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   481
	    self assert:(s ~= s) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   482
	    self assert:(s < s) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   483
	    self assert:(s > s) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   484
	    self assert:(s = (s,s)) not.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   485
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   486
	    self assert:(t notNil).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   487
	    self assert:(s = t).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   488
	    self assert:(s ~= t) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   489
	    self assert:(s < t) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   490
	    self assert:(s > t) not.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   491
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   492
	    self assert:((s = nil) == ((s ~= nil) not)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   493
	    self assert:((s = '') == ((s ~= '') not)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   494
	].
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   495
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   496
	s := i asCharacter asString.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   497
	0 to: 255 do: [ :j |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   498
	    t := j asCharacter asString.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   499
	    self assert:(t notNil).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   500
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   501
	    self assert:((s = t) == ((s ~= t) not)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   502
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   503
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   504
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   505
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   506
     self new test12_Comparison
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   507
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   508
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   509
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   510
test13_startsWithEndsWithSameAs
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   511
    self assert:('hello' startsWith:'').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   512
    self assert:('hello' startsWith:'h').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   513
    self assert:('hello' startsWith:'he').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   514
    self assert:('hello' startsWith:'hel').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   515
    self assert:('hello' startsWith:'hell').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   516
    self assert:('hello' startsWith:'hello').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   517
    self assert:('hello' startsWith:'hello world') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   518
    "/ int size
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   519
    self assert:('1234' startsWith:'123').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   520
    self assert:('1234' startsWith:'1234').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   521
    self assert:('1234' startsWith:'12345') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   522
    self assert:('12345678' startsWith:'123').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   523
    self assert:('12345678' startsWith:'1234').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   524
    self assert:('12345678' startsWith:'12345').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   525
    self assert:('12345678' startsWith:'123456').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   526
    self assert:('12345678' startsWith:'1234567').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   527
    self assert:('12345678' startsWith:'12345678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   528
    self assert:('12345678' startsWith:'123456789') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   529
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   530
    self assert:('1234' startsWith:'x23') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   531
    self assert:('1234' startsWith:'x234') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   532
    self assert:('1234' startsWith:'1x34') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   533
    self assert:('1234' startsWith:'12x4') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   534
    self assert:('1234' startsWith:'123x') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   535
    self assert:('1234' startsWith:'12345') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   536
    self assert:('12345678' startsWith:'x234') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   537
    self assert:('12345678' startsWith:'1x34') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   538
    self assert:('12345678' startsWith:'12x4') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   539
    self assert:('12345678' startsWith:'123x') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   540
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   541
    self assert:('hello' endsWith:'').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   542
    self assert:('hello' endsWith:'o').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   543
    self assert:('hello' endsWith:'lo').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   544
    self assert:('hello' endsWith:'llo').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   545
    self assert:('hello' endsWith:'ello').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   546
    self assert:('hello' endsWith:'hello').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   547
    self assert:('hello' endsWith:'hello world') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   548
    "/ int size
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   549
    self assert:('1234' endsWith:'234').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   550
    self assert:('1234' endsWith:'1234').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   551
    self assert:('1234' endsWith:'1235') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   552
    self assert:('1234' endsWith:'12345') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   553
    self assert:('12345678' endsWith:'678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   554
    self assert:('12345678' endsWith:'5678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   555
    self assert:('12345678' endsWith:'45678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   556
    self assert:('12345678' endsWith:'345678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   557
    self assert:('12345678' endsWith:'2345678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   558
    self assert:('12345678' endsWith:'12345678').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   559
    self assert:('12345678' endsWith:'123456789') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   560
    self assert:('12345678' endsWith:'012345678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   561
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   562
    self assert:('1234' endsWith:'x233') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   563
    self assert:('1234' endsWith:'1x34') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   564
    self assert:('1234' endsWith:'12x4') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   565
    self assert:('1234' endsWith:'123x') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   566
    self assert:('12345678' endsWith:'x2345678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   567
    self assert:('12345678' endsWith:'1x345678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   568
    self assert:('12345678' endsWith:'12x45678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   569
    self assert:('12345678' endsWith:'123x5678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   570
    self assert:('12345678' endsWith:'1234x678') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   571
    self assert:('12345678' endsWith:'12345x78') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   572
    self assert:('12345678' endsWith:'123456x8') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   573
    self assert:('12345678' endsWith:'1234567x') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   574
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   575
    self assert:('' sameAs:'').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   576
    self assert:('' sameAs:'a') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   577
    self assert:('a' sameAs:'') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   578
    self assert:('a' sameAs:'a').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   579
    self assert:('a' sameAs:'A').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   580
    self assert:('A' sameAs:'A').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   581
    self assert:('A' sameAs:'a').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   582
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   583
    self assert:('a' sameAs:'1') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   584
    self assert:('A' sameAs:'1') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   585
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   586
    1 to:20 do:[:len |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   587
	|s1 s2|
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   588
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   589
	s1 := ($a to:($a + len - 1)) asString.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   590
	s2 := s1 copy.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   591
	1 to:len do:[:idx |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   592
	    s2 at:idx put:(s2 at:idx) asUppercase.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   593
	    self assert:(s1 sameAs:s2).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   594
	].
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   595
    ].
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   596
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   597
    self assert:('Ä' sameAs:'ä').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   598
    self assert:('Ä' sameAs:'ä').
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   599
    self assert:('ß' sameAs:'ÿ') not.
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   600
    self assert:('Ÿ' sameAs:'ÿ'). "/ single byte char ws. wide char
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   601
    self assert:('Ÿ' sameAs:'Ÿ'). "/ single byte char ws. wide char
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   602
    self assert:('ÿ' sameAs:'ÿ'). "/ single byte char ws. wide char
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   603
1990
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   604
    "
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   605
     self new test13_startsWithEndsWithSameAs
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   606
    "
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   607
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   608
    "Created: / 19-07-2018 / 11:05:32 / Claus Gittinger"
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   609
!
add7e46a1fac #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   610
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   611
test15_CompareWithCollating
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   612
    | nul |
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   613
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   614
    nul := 0 asCharacter asString.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   615
    self assert:('' compareWith:'' collating:true) == 0.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   616
    self assert:('' compareWith:'' collating:false) == 0.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   617
    self assert:(nul compareWith:(255 asCharacter asString) collating:false) == -1.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   618
    self assert:((255 asCharacter asString) compareWith:nul collating:false) == 1.
1433
6291f067c336 #REFACTORING by mawalch
mawalch
parents: 1430
diff changeset
   619
    "/ This will fail and is a WONTFIX
6291f067c336 #REFACTORING by mawalch
mawalch
parents: 1430
diff changeset
   620
    "/ self assert:((('' compareWith:nul collating:false) == 0) == ('' = nul)).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   621
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   622
    0 to: 255 do: [ :i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   623
	|s|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   624
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   625
	s := i asCharacter asString.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   626
	self assert:(s notNil).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   627
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   628
	"/ This will fail and is a WONTFIX
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   629
	"/ self assert:('' compareWith:s collating:false) ~= 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   630
	self assert:('' compareWith:s collating:false) == ((s compareWith:'' collating:false) negated).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   631
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   632
	0 to: 255 do: [ :j |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   633
	    | t |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   634
	    t := j asCharacter asString.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   635
	    self assert:(t notNil).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   636
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   637
	    self assert:(((s compareWith:t collating:false) == -1) == (s < t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   638
	    self assert:(((s compareWith:t collating:false) == 0) == (s = t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   639
	    self assert:(((s compareWith:t collating:false) == 1) == (s > t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   640
	    self assert:(((s compareWith:t collating:true) == -1) == (s < t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   641
	    self assert:(((s compareWith:t collating:true) == 0) == (s = t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   642
	    self assert:(((s compareWith:t collating:true) == 1) == (s > t)).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   643
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   644
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   645
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   646
    0 to: 9 do: [ :i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   647
	0 to: 255 do: [ :j |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   648
	    |s t|
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   649
	    s := String new:i withAll:(j asCharacter).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   650
	    t := s copy.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   651
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   652
	    self assert: (s compareWith:s collating:false) == 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   653
	    self assert: (s compareWith:s collating:true) == 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   654
	    self assert: (s compareWith:t collating:false) == 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   655
	    self assert: (s compareWith:t collating:true) == 0
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   656
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   657
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   658
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   659
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   660
     self new test15_CompareWithCollating
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   661
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   662
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   663
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   664
test20_literalsAreReadonly
605
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   665
    |myClass s1 l2 s2 parserFlags compiler|
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   666
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   667
    parserFlags := Compiler new parserFlags copy.
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   668
    parserFlags stringsAreImmutable:true.
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   669
    parserFlags arraysAreImmutable:true.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   670
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   671
    Class withoutUpdatingChangesDo:[
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   672
	myClass := Object
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   673
			subclass:#'MyClass'
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   674
			instanceVariableNames:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   675
			classVariableNames:''
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   676
			poolDictionaries:nil.
605
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   677
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   678
	compiler := myClass compilerClass new.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   679
	compiler parserFlags:parserFlags.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   680
	compiler compile:'lit1 ^''hello''' forClass:myClass install:true.
605
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   681
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   682
	compiler := myClass compilerClass new.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   683
	compiler parserFlags:parserFlags.
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   684
	compiler compile:'lit2 ^#(''foo'' ''bar'' ''baz'')' forClass:myClass install:true.
288
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   685
    ].
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   686
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   687
    s1 := myClass new perform:#lit1.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   688
    self assert:(s1 isString).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   689
    self assert:(s1 class == ImmutableString).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   690
    self should:[ s1 at:1 put:$H ] raise:Error.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   691
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   692
    l2 := myClass new perform:#lit2.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   693
    self assert:(l2 isArray).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   694
    self assert:(l2 class == ImmutableArray).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   695
    self should:[ l2 at:1 put:$H ] raise:Error.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   696
    s2 := l2 at:1.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   697
    self assert:(s2 isString).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   698
    self assert:(s2 class == ImmutableString).
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   699
    self should:[ s2 at:1 put:$H ] raise:Error.
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   700
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   701
    "
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   702
     self new test20_literalsAreReadonly
453fbe5663a8 immutable strings
Claus Gittinger <cg@exept.de>
parents: 287
diff changeset
   703
    "
605
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   704
6f0411c4d46f changed: #test20_literalsAreReadonly
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   705
    "Modified: / 02-08-2011 / 19:30:53 / cg"
352
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   706
!
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   707
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   708
test30_indexOfSubCollection
352
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   709
    |i|
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   710
      "/  12345678901
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   711
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   712
    self assert:(i == 7).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   713
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   714
    self assert:(i == 0).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   715
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   716
    self assert:(i == 7).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   717
    i := 'hello wOrLd' indexOfSubCollection:'ll' startingAt:1 ifAbsent:0 caseSensitive:false.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   718
    self assert:(i == 3).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   719
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   720
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:1 ifAbsent:0 caseSensitive:false.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   721
    self assert:(i == 3).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   722
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:3 ifAbsent:0 caseSensitive:false.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   723
    self assert:(i == 3).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   724
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:4 ifAbsent:0 caseSensitive:false.
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   725
    self assert:(i == 15).
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   726
353
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   727
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:1 ifAbsent:0 caseSensitive:false.
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   728
    self assert:(i == 16).
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   729
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:17 ifAbsent:0 caseSensitive:false.
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   730
    self assert:(i == 0).
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   731
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:18 ifAbsent:0 caseSensitive:false.
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   732
    self assert:(i == 0).
70a6187c1f2b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 352
diff changeset
   733
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   734
    i := 'world' indexOfString:'world'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   735
    self assert:(i == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   736
    i := 'world' indexOfString:'world' startingAt:1.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   737
    self assert:(i == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   738
    i := 'world' indexOfString:'world' startingAt:6.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   739
    self assert:(i == 0).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   740
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   741
    i := 'hello world' indexOfString:'world'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   742
    self assert:(i == 7).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   743
    i := 'hello world' indexOfString:'world' startingAt:1.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   744
    self assert:(i == 7).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   745
    i := 'hello world' indexOfString:'world' startingAt:4.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   746
    self assert:(i == 7).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   747
    i := 'hello world' indexOfString:'world' startingAt:7.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   748
    self assert:(i == 7).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   749
    i := 'hello world' indexOfString:'world' startingAt:8.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   750
    self assert:(i == 0).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   751
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   752
    i := 'hello wOrLd' indexOfString:'world' startingAt:1.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   753
    self assert:(i == 0).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   754
352
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   755
    "
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   756
     self new test30_indexOfSubCollection
352
7196bdd29f7a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   757
    "
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   758
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   759
    "Modified: / 25-05-2019 / 09:01:43 / Claus Gittinger"
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   760
!
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   761
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   762
test30b_indexOfSubCollection
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   763
    |i|
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   764
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   765
      "/  12345678901
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   766
    i := 'hello world' indexOfSubCollection:'w' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   767
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   768
    i := 'hello world' indexOfSubCollection:'w' startingAt:6 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   769
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   770
    i := 'hello world' indexOfSubCollection:'w' startingAt:7 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   771
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   772
    i := 'hello world' indexOfSubCollection:'w' startingAt:8 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   773
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   774
    i := 'hello world' indexOfSubCollection:'x' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   775
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   776
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   777
      "/  12345678901
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   778
    i := 'hello world' indexOfSubCollection:'wo' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   779
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   780
    i := 'hello world' indexOfSubCollection:'wo' startingAt:6 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   781
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   782
    i := 'hello world' indexOfSubCollection:'wo' startingAt:7 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   783
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   784
    i := 'hello world' indexOfSubCollection:'wo' startingAt:8 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   785
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   786
    i := 'hello world' indexOfSubCollection:'xx' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   787
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   788
    i := 'hello world' indexOfSubCollection:'wO' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   789
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   790
    i := 'hello world' indexOfSubCollection:'wO' startingAt:6 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   791
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   792
    i := 'hello world' indexOfSubCollection:'wO' startingAt:7 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   793
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   794
    i := 'hello world' indexOfSubCollection:'wO' startingAt:8 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   795
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   796
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   797
      "/  12345678901
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   798
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   799
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   800
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   801
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   802
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   803
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   804
    i := 'hello wOrLd' indexOfSubCollection:'ll' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   805
    self assert:(i == 3).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   806
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   807
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   808
    self assert:(i == 3).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   809
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:3 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   810
    self assert:(i == 3).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   811
    i := 'hello wOrLd yellow' indexOfSubCollection:'ll' startingAt:4 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   812
    self assert:(i == 15).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   813
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   814
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   815
    self assert:(i == 16).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   816
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:17 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   817
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   818
    i := 'hello wOrLd yellow' indexOfSubCollection:'low' startingAt:18 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   819
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   820
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   821
    i := 'world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   822
    self assert:(i == 1).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   823
    i := 'world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   824
    self assert:(i == 1).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   825
    i := 'world' indexOfSubCollection:'world' startingAt:2 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   826
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   827
    i := 'world' indexOfSubCollection:'world' startingAt:2 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   828
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   829
    i := 'world' indexOfSubCollection:'world' startingAt:6 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   830
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   831
    i := 'world' indexOfSubCollection:'world' startingAt:6 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   832
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   833
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   834
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   835
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   836
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   837
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   838
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   839
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   840
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   841
    i := 'hello world' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   842
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   843
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   844
    i := 'hello world' indexOfSubCollection:'world' startingAt:4 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   845
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   846
    i := 'hello world' indexOfSubCollection:'world' startingAt:4 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   847
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   848
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   849
    i := 'hello world' indexOfSubCollection:'world' startingAt:7 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   850
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   851
    i := 'hello world' indexOfSubCollection:'world' startingAt:7 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   852
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   853
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   854
    i := 'hello world' indexOfSubCollection:'world' startingAt:8 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   855
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   856
    i := 'hello world' indexOfSubCollection:'world' startingAt:8 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   857
    self assert:(i == 0).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   858
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   859
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:true.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   860
    self assert:(i == 0).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   861
    i := 'hello wOrLd' indexOfSubCollection:'world' startingAt:1 ifAbsent:0 caseSensitive:false.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   862
    self assert:(i == 7).
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   863
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   864
    "
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   865
     self new test30b_indexOfSubCollection
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   866
    "
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   867
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   868
    "Modified: / 25-05-2019 / 09:01:43 / Claus Gittinger"
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   869
!
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
   870
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   871
test31_occurrencesOfString
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   872
    |n|
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   873
      "/  12345678901
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   874
    n := 'hello world' occurrencesOfString:'world'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   875
    self assert:(n == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   876
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   877
    n := 'hello wOrLd world' occurrencesOfString:'world'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   878
    self assert:(n == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   879
2242
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   880
    n := 'hello wOrLd world' occurrencesOfString:'world' caseSensitive:false.
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   881
    self assert:(n == 2).
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   882
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   883
    n := 'hello world hello world' occurrencesOfString:'world'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   884
    self assert:(n == 2).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   885
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   886
    n := '' occurrencesOfString:'aa'.
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   887
    self assert:(n == 0).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   888
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   889
    n := 'a' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   890
    self assert:(n == 0).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   891
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   892
    n := 'aa' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   893
    self assert:(n == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   894
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   895
    n := ' aa ' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   896
    self assert:(n == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   897
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   898
    n := ' aa a' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   899
    self assert:(n == 1).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   900
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   901
    n := ' aaaa' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   902
    self assert:(n == 2).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   903
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   904
    n := ' aa aa ' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   905
    self assert:(n == 2).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   906
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   907
    n := ' aa bb ab ba aa ab' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   908
    self assert:(n == 2).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   909
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   910
    n := ' aa bb cc aa bb cc aa bb ' occurrencesOfString:'aa'.
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   911
    self assert:(n == 3).
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   912
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   913
    n := ' aa bb cc aA bb cc Aa bb ' occurrencesOfString:'aa'.
2242
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   914
    self assert:(n == 1).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   915
    n := ' aa bb cc aA bb cc Aa bb ' occurrencesOfString:'aa' caseSensitive:false.
2242
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   916
    self assert:(n == 3).
6ed9be004635 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2241
diff changeset
   917
2241
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   918
    "
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   919
     self new test31_occurrencesOfString
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   920
    "
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   921
748bb1185b08 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   922
    "Created: / 25-05-2019 / 09:03:11 / Claus Gittinger"
570
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   923
!
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   924
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   925
test40_indexOfAny
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   926
    |s i collection|
570
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   927
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   928
    s := 'Some Sample Generators (74035660-d1f6-11df-9ab3-00ff7b08316c)'.
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   929
    1 to:s size do:[:start |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   930
	i := s indexOfAny:'-' startingAt:start.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   931
	self assert:(i == 0 or:[ i >= start]).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   932
	(i ~~ 0) ifTrue:[
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   933
	    self assert:(s at:i) == $-
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   934
	].
1308
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   935
    ].
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   936
    "/    123456789012
1308
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   937
    s := 'bla bla 1234'.
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   938
    1 to:s size do:[:start |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   939
	i := s indexOfAny:'1234' startingAt:start.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   940
	self assert:(i == 0 or:[ i >= start]).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   941
	(i == 9) ifTrue:[ self assert:((s at:i) == $1) ].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   942
	(i == 10) ifTrue:[ self assert:((s at:i) == $2) ].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   943
	(i == 11) ifTrue:[ self assert:((s at:i) == $3) ].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   944
	(i == 12) ifTrue:[ self assert:((s at:i) == $4) ].
570
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   945
    ].
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   946
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   947
    collection := #($o, $l, $o).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   948
      "/  12345678901
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   949
    i := 'hello world' indexOfAny:collection startingAt:1.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   950
    self assert:(i == 3).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   951
    i := 'hello world' indexOfAny:collection startingAt:2.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   952
    self assert:(i == 3).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   953
    i := 'hello world' indexOfAny:collection startingAt:3.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   954
    self assert:(i == 3).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   955
    i := 'hello world' indexOfAny:collection startingAt:4.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   956
    self assert:(i == 4).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   957
    i := 'hello world' indexOfAny:collection startingAt:5.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   958
    self assert:(i == 5).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   959
    i := 'hello world' indexOfAny:collection startingAt:6.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   960
    self assert:(i == 8).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   961
    i := 'hello world' indexOfAny:collection startingAt:7.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   962
    self assert:(i == 8).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   963
    i := 'hello world' indexOfAny:collection startingAt:8.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   964
    self assert:(i == 8).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   965
    i := 'hello world' indexOfAny:collection startingAt:9.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   966
    self assert:(i == 10).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   967
    i := 'hello world' indexOfAny:collection startingAt:10.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   968
    self assert:(i == 10).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   969
    i := 'hello world' indexOfAny:collection startingAt:11.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   970
    self assert:(i == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   971
    i := 'hello world' indexOfAny:collection startingAt:12.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   972
    self assert:(i == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   973
    i := 'hello world' indexOfAny:collection startingAt:10000.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   974
    self assert:(i == 0).
570
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   975
    "
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   976
     self new test40_indexOfAny
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   977
    "
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   978
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
   979
    "Created: / 29-10-2010 / 14:58:21 / cg"
571
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
   980
!
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
   981
1308
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   982
test41_contains
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   983
    |s|
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   984
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   985
    s := 'abcdefg'.
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   986
    self assert:(s contains:[:ch | ch == $a]).
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   987
    self assert:(s contains:[:ch | ch == $A]) not.
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   988
    self assert:(s contains:[:ch | ch == $1]) not.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
   989
    self assert:(s contains:[:ch | ch == (0 asCharacter)]) not.
1308
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   990
    "
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   991
     self new test41_contains
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   992
    "
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   993
!
0514727b0371 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
   994
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
   995
test42a_includesAny
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   996
    |s|
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   997
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
   998
    1 to:20 do:[:na |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
   999
	s := (String new:na withAll:$a),'bla bla 1234'.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1000
	self assert:( s includesAny:'12').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1001
	self assert:( s includesAny:'21').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1002
	self assert:( s includesAny:'15').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1003
	self assert:( s includesAny:'51').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1004
	self assert:( s includesAny:'45').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1005
	self assert:( s includesAny:'54').
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1006
	self assert:( s includesAny:'56') not.
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1007
    ].
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1008
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1009
    "
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1010
     self new test42a_includesAny
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1011
    "
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1012
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1013
    "Created: / 02-04-2019 / 11:03:13 / Claus Gittinger"
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1014
!
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1015
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1016
test42b_includesMatchCharacters
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1017
    self assert:('hello' includesMatchCharacters not).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1018
    self assert:('he*llo' includesMatchCharacters).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1019
    self assert:('h[eE]llo' includesMatchCharacters).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1020
    self assert:('h#llo' includesMatchCharacters).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1021
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1022
    "
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1023
     self new test42b_includesMatchCharacters
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1024
    "
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1025
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1026
    "Created: / 02-04-2019 / 11:03:46 / Claus Gittinger"
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1027
!
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1028
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1029
test42c_includesSeparator
2388
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1030
    self assert:('' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1031
    self assert:('a' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1032
    self assert:('ab' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1033
    self assert:('abc' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1034
    self assert:('abcd' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1035
    self assert:('abcde' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1036
    self assert:('abcdef' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1037
    self assert:('abcdefg' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1038
    self assert:('abcdefgh' includesSeparator not).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1039
    self assert:('a ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1040
    self assert:('ab ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1041
    self assert:('abc ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1042
    self assert:('abcd ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1043
    self assert:('abcde ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1044
    self assert:('abcdef ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1045
    self assert:('abcdefg ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1046
    self assert:('abcdefgh ' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1047
    self assert:(' a' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1048
    self assert:(' ab' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1049
    self assert:(' abc' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1050
    self assert:(' abcd' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1051
    self assert:(' abcde' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1052
    self assert:(' abcdef' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1053
    self assert:(' abcdefg' includesSeparator).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  1054
    self assert:(' abcdefgh' includesSeparator).
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1055
    self assert:('hello' includesSeparator not).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1056
    self assert:('he llo' includesSeparator).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1057
    self assert:(' hello' includesSeparator).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1058
    self assert:('hello ' includesSeparator).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1059
    self assert:(' he llo ' includesSeparator).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1060
    self assert:(c'h\nllo' includesSeparator).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1061
    self assert:(c'h\tllo' includesSeparator).
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1062
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1063
    "
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1064
     self new test42c_includesSeparator
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1065
    "
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1066
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1067
    "Created: / 02-04-2019 / 11:05:39 / Claus Gittinger"
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1068
!
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1069
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1070
test43_occurrencesOf
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1071
    |s|
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1072
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1073
    "/             12345678901
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1074
    self assert:( 'hello world' occurrencesOf:$0 ) == 0.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1075
    self assert:( 'hello world' occurrencesOf:$l ) == 3.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1076
    self assert:( 'hello world' occurrencesOf:$d ) == 1.
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1077
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1078
    "/ how about 0-bytes in between
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1079
    self assert:( #[0 0 1 0 0] asString occurrencesOf:(Character value:1) ) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1080
    self assert:( #[0 0 1 0 0] asString occurrencesOf:(Character value:0) ) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1081
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1082
    1 to:10 do:[:nA |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1083
	1 to:10 do:[:nB |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1084
	    s := (String new:nA withAll:$a),(String new:nB withAll:$b).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1085
	    self assert:(s occurrencesOf:$a) == nA.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1086
	    self assert:(s occurrencesOf:$b) == nB.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1087
	]
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1088
    ].
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1089
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1090
    s := String new:1024.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1091
    s atAllPut:$a.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1092
    s at:512 put:(Character space).
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1093
    self assert:(s occurrencesOf:(Character space)) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1094
    self assert:(s occurrencesOf:$a) == 1023.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1095
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1096
    s := String new:1024.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1097
    s atAllPut:$a.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1098
    1 to:1024 by:2 do:[:i | s at:i put:$b].
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1099
    self assert:(s occurrencesOf:$a) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1100
    self assert:(s occurrencesOf:$b) == 512.
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1101
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1102
    "
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1103
     self new test43_occurrencesOf
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1104
    "
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1105
!
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1106
571
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1107
test50_indexOf
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1108
    |s i|
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1109
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1110
    s := 'Some Sample Generators (74035660-d1f6-11df-9ab3-00ff7b08316c)'.
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1111
    1 to:s size do:[:start |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1112
	i := s indexOf:$- startingAt:start.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1113
	self assert:(i == 0 or:[ i >= start]).
571
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1114
    ].
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1115
    "/             12345678901
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1116
    self assert:( 'hello world' indexOf:$0 startingAt:1 ) == 0.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1117
    self assert:( 'hello world' indexOf:$l startingAt:1 ) == 3.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1118
    self assert:( 'hello world' indexOf:$l startingAt:5 ) == 10.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1119
    self assert:( 'hello world' indexOf:$d startingAt:5 ) == 11.
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1120
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1121
    "/             12345678901
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1122
    self assert:(('hello world' indexOf:$o startingAt:1) == 5).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1123
    self assert:(('hello world' indexOf:$o startingAt:2) == 5).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1124
    self assert:(('hello world' indexOf:$o startingAt:3) == 5).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1125
    self assert:(('hello world' indexOf:$o startingAt:4) == 5).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1126
    self assert:(('hello world' indexOf:$o startingAt:5) == 5).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1127
    self assert:(('hello world' indexOf:$o startingAt:6) == 8).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1128
    self assert:(('hello world' indexOf:$o startingAt:7) == 8).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1129
    self assert:(('hello world' indexOf:$o startingAt:8) == 8).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1130
    self assert:(('hello world' indexOf:$o startingAt:9) == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1131
    self assert:(('hello world' indexOf:$o startingAt:10) == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1132
    self assert:(('hello world' indexOf:$o startingAt:11) == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1133
    self assert:(('hello world' indexOf:$o startingAt:12) == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1134
    self assert:(('hello world' indexOf:$o startingAt:10000) == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1135
1418
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1136
    "/ how about 0-bytes in between
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1137
    self assert:( #[0 0 1 0 0] asString indexOf:(Character value:1) startingAt:1 ) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1138
    self assert:( #[0 0 1 0 0] asString indexOf:(Character value:0) startingAt:3 ) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1139
    self assert:( #[0 0 1 1 0] asString indexOf:(Character value:0) startingAt:3 ) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1140
    self assert:( #[0 1 0 1 0] asString indexOf:(Character value:1) startingAt:3 ) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1141
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1142
    s := '12345678901234b'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1143
    self assert:(s indexOf:$x) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1144
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1145
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1146
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1147
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1148
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1149
    self assert:(s indexOf:$0) == 10.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1150
    self assert:(s indexOf:$b) == 15.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1151
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1152
    s := ''.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1153
    self assert:(s indexOf:$1) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1154
    s := '1'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1155
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1156
    self assert:(s indexOf:$2) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1157
    s := '12'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1158
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1159
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1160
    self assert:(s indexOf:$3) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1161
    s := '123'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1162
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1163
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1164
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1165
    self assert:(s indexOf:$4) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1166
    s := '1234'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1167
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1168
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1169
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1170
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1171
    self assert:(s indexOf:$5) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1172
    s := '12345'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1173
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1174
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1175
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1176
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1177
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1178
    self assert:(s indexOf:$6) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1179
    s := '123456'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1180
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1181
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1182
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1183
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1184
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1185
    self assert:(s indexOf:$6) == 6.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1186
    self assert:(s indexOf:$7) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1187
    s := '1234567'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1188
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1189
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1190
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1191
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1192
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1193
    self assert:(s indexOf:$6) == 6.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1194
    self assert:(s indexOf:$7) == 7.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1195
    self assert:(s indexOf:$8) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1196
    s := '12345678'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1197
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1198
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1199
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1200
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1201
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1202
    self assert:(s indexOf:$6) == 6.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1203
    self assert:(s indexOf:$7) == 7.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1204
    self assert:(s indexOf:$8) == 8.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1205
    self assert:(s indexOf:$9) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1206
    s := '123456789'.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1207
    self assert:(s indexOf:$1) == 1.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1208
    self assert:(s indexOf:$2) == 2.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1209
    self assert:(s indexOf:$3) == 3.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1210
    self assert:(s indexOf:$4) == 4.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1211
    self assert:(s indexOf:$5) == 5.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1212
    self assert:(s indexOf:$6) == 6.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1213
    self assert:(s indexOf:$7) == 7.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1214
    self assert:(s indexOf:$8) == 8.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1215
    self assert:(s indexOf:$9) == 9.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1216
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1217
    self assert:(s indexOf:$0) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1218
    self assert:(s indexOf:$b) == 0.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1219
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1220
    s := String new:1024.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1221
    s atAllPut:$a.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1222
    s at:512 put:(Character space).
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1223
    self assert:(s indexOf:(Character space)) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1224
    self assert:(s indexOf:(Character space) startingAt:1) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1225
    self assert:(s indexOf:(Character space) startingAt:2) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1226
    self assert:(s indexOf:(Character space) startingAt:3) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1227
    self assert:(s indexOf:(Character space) startingAt:4) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1228
    self assert:(s indexOf:(Character space) startingAt:5) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1229
    self assert:(s indexOf:(Character space) startingAt:6) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1230
    self assert:(s indexOf:(Character space) startingAt:7) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1231
    self assert:(s indexOf:(Character space) startingAt:8) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1232
    self assert:(s indexOf:(Character space) startingAt:9) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1233
    self assert:(s indexOf:(Character space) startingAt:511) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1234
    self assert:(s indexOf:(Character space) startingAt:512) == 512.
17555e11c398 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1235
    self assert:(s indexOf:(Character space) startingAt:513) == 0.
571
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1236
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1237
    self assert:(s indexOfSeparator) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1238
    self assert:(s indexOfSeparatorStartingAt:1) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1239
    self assert:(s indexOfSeparatorStartingAt:2) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1240
    self assert:(s indexOfSeparatorStartingAt:3) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1241
    self assert:(s indexOfSeparatorStartingAt:4) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1242
    self assert:(s indexOfSeparatorStartingAt:5) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1243
    self assert:(s indexOfSeparatorStartingAt:6) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1244
    self assert:(s indexOfSeparatorStartingAt:7) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1245
    self assert:(s indexOfSeparatorStartingAt:8) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1246
    self assert:(s indexOfSeparatorStartingAt:9) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1247
    self assert:(s indexOfSeparatorStartingAt:511) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1248
    self assert:(s indexOfSeparatorStartingAt:512) == 512.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1249
    self assert:(s indexOfSeparatorStartingAt:513) == 0.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1250
571
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1251
    "
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1252
     self new test50_indexOf
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1253
    "
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1254
181f1551fa0c Additional method
Stefan Vogel <sv@exept.de>
parents: 570
diff changeset
  1255
    "Created: / 29-10-2010 / 14:58:21 / cg"
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1256
    "Modified: / 02-04-2019 / 11:06:52 / Claus Gittinger"
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1257
!
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1258
1373
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1259
test51_substrings
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1260
    self assert:('aaa/bbb/ccc' subStrings:'/') asArray = #('aaa' 'bbb' 'ccc').
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1261
    self assert:(('aaa/bbb/ccc' subStrings:'/') asStringWith:'/') = 'aaa/bbb/ccc'.
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1262
2083
fd47bd71202f #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2077
diff changeset
  1263
    self assert:('aaa/bbb' withoutSuffix:'bbb') = 'aaa/'.
fd47bd71202f #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2077
diff changeset
  1264
    self assert:('aaa/bbb' withoutPrefix:'aaa') = '/bbb'.
fd47bd71202f #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2077
diff changeset
  1265
1385
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1266
"/    self assert:('/aaa/bbb/ccc' subStrings:'/') asArray = #('' 'aaa' 'bbb' 'ccc').
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1267
"/    self assert:(('/aaa/bbb/ccc' subStrings:'/') asStringWith:'/') = '/aaa/bbb/ccc'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1268
"/
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1269
"/    self assert:('aaa/bbb/ccc/' subStrings:'/') asArray = #('aaa' 'bbb' 'ccc' '' ).
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1270
"/    self assert:(('aaa/bbb/ccc/' subStrings:'/') asStringWith:'/') = '/aaa/bbb/ccc/'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1271
"/
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1272
"/    self assert:('/aaa/bbb/ccc/' subStrings:'/') asArray = #('' 'aaa' 'bbb' 'ccc' '').
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1273
"/    self assert:(('/aaa/bbb/ccc/' subStrings:'/') asStringWith:'/') = '/aaa/bbb/ccc'' '.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1274
"/
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1275
"/    self assert:('//aaa/bbb/ccc' subStrings:'/') asArray = #('' '' 'aaa' 'bbb' 'ccc').
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1276
"/    self assert:(('//aaa/bbb/ccc' subStrings:'/') asStringWith:'/') = '//aaa/bbb/ccc'.
1373
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1277
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1278
    "
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1279
     self new test51_substrings
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1280
    "
2083
fd47bd71202f #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2077
diff changeset
  1281
fd47bd71202f #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2077
diff changeset
  1282
    "Modified: / 11-02-2019 / 23:57:03 / Claus Gittinger"
1373
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1283
!
92c28dfbf621 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1284
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1285
test52_indexOfSeparator
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1286
    |j s|
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1287
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1288
    self assert:('' indexOfSeparator) == 0.
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1289
    1 to:20 do:[:n |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1290
	s := (String new:n withAll:$a).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1291
	1 to:20 do:[:start |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1292
	    self assert:(s indexOfSeparatorStartingAt:start) == 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1293
	].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1294
    ].
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1295
    1 to:20 do:[:n |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1296
	s := (String new:n withAll:$a),' '.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1297
	1 to:n do:[:start |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1298
	    self assert:(s indexOfSeparatorStartingAt:start) == (n+1).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1299
	].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1300
    ].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1301
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1302
    {
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1303
	Character space .
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1304
	Character tab .
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1305
	Character return .
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1306
	Character lf .
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1307
    } do:[:sep |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1308
	1 to:20 do:[:na |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1309
	    1 to:20 do:[:nb |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1310
		s := (String new:na withAll:$a),sep,(String new:na withAll:$a).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1311
		1 to:na do:[:start |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1312
		    self assert:(s indexOfSeparatorStartingAt:start) == (na+1).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1313
		]
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1314
	    ]
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1315
	].
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1316
    ].
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1317
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1318
    {
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1319
	Character esc .
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1320
	Character null .
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1321
	$a .
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1322
    } do:[:nonSep |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1323
	1 to:20 do:[:na |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1324
	    1 to:20 do:[:nb |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1325
		s := (String new:na withAll:$a),nonSep,(String new:na withAll:$a).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1326
		1 to:20 do:[:start |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1327
		    self assert:(s indexOfSeparatorStartingAt:start) == 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1328
		]
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1329
	    ]
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1330
	].
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1331
    ].
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1332
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1333
    s := String new:1000 withAll:$a.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1334
    self assert:(s indexOfSeparatorStartingAt:1) == 0.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1335
    400 to: 417 do:[:i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1336
	s := String new:1000 withAll:$a.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1337
	s at:i put:(Character space).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1338
	self assert:(s indexOfSeparatorStartingAt:1) == i.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1339
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1340
	s := String new:1000 withAll:$a.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1341
	s at:i put:(Character return).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1342
	self assert:(s indexOfSeparatorStartingAt:1) == i.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1343
    ].
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1344
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1345
      "/  12345678901
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1346
    j := 'hello world' indexOfSeparatorStartingAt:1.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1347
    self assert:(j == 6).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1348
    j := 'hello world ' indexOfSeparatorStartingAt:2.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1349
    self assert:(j == 6).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1350
    j := 'hello world ' indexOfSeparatorStartingAt:3.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1351
    self assert:(j == 6).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1352
    j := 'hello world ' indexOfSeparatorStartingAt:4.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1353
    self assert:(j == 6).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1354
    j := 'hello world ' indexOfSeparatorStartingAt:5.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1355
    self assert:(j == 6).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1356
    j := 'hello world ' indexOfSeparatorStartingAt:6.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1357
    self assert:(j == 6).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1358
    j := 'hello world ' indexOfSeparatorStartingAt:7.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1359
    self assert:(j == 12).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1360
    j := 'hello world ' indexOfSeparatorStartingAt:8.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1361
    self assert:(j == 12).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1362
    j := 'hello world ' indexOfSeparatorStartingAt:9.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1363
    self assert:(j == 12).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1364
    j := 'hello world ' indexOfSeparatorStartingAt:10.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1365
    self assert:(j == 12).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1366
    j := 'hello world ' indexOfSeparatorStartingAt:11.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1367
    self assert:(j == 12).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1368
    j := 'hello world ' indexOfSeparatorStartingAt:12.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1369
    self assert:(j == 12).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1370
    j := 'hello world' indexOfSeparatorStartingAt:12.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1371
    self assert:(j == 0).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1372
    j := 'hello world ' indexOfSeparatorStartingAt:13.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1373
    self assert:(j == 0).
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1374
    j := 'hello world ' indexOfSeparatorStartingAt:10000.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1375
    self assert:(j == 0).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1376
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1377
    "
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1378
     self new test52_indexOfSeparator
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1379
    "
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1380
!
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1381
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1382
test54_occurrencesOf
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1383
    |s|
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1384
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1385
    self assert:('' occurrencesOf:$a) == 0.
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1386
    1 to:20 do:[:n |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1387
	s := (String new:n withAll:$a).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1388
	self assert:(s occurrencesOf:$a) == n.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1389
    ].
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1390
    1 to:20 do:[:na |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1391
	1 to:20 do:[:nb |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1392
	    s := (String new:na withAll:$a),(String new:nb withAll:$b).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1393
	    self assert:(s occurrencesOf:$a) == na.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1394
	].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1395
    ].
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1396
    1 to:40 do:[:n |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1397
	s := String new:n withAll:$a.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1398
	1 to:n by:2 do:[:n |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1399
	    s at:n put:$b.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1400
	].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1401
	self assert:(s occurrencesOf:$a) == (n // 2).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1402
    ].
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1403
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1404
    s := String new:1000 withAll:$a.
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1405
    self assert:(s occurrencesOf:$a) == 1000.
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1406
    1 to:1000 do:[:i |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1407
	s at:i put:$b.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1408
	self assert:(s occurrencesOf:$a) == (1000-i).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1409
	self assert:(s occurrencesOf:$b) == i.
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1410
    ].
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1411
1420
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1412
    "
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1413
     self new test54_occurrencesOf
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1414
    "
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1415
!
d5438e5960ed #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1416
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1417
test60a_hash
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1418
    "
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1419
    As of 2013-01-09 for strings of size 7 String & Unicode16String hash
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1420
    returned different values. This test checks this
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1421
    "
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1422
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1423
    | tester |
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1424
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1425
    tester := [:s|
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1426
	|sHash u16Hash u32Hash|
1385
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1427
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1428
	sHash := s hash.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1429
	u16Hash := s asUnicode16String hash.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1430
	u32Hash := s asUnicode32String hash.
1385
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1431
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1432
	self assert: sHash == u16Hash
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1433
	     description: ('String and Unicode16String hashes differ on "%1" (%2)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1434
				bindWith:s with:s class name).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1435
	self assert: sHash == u32Hash
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1436
	     description: ('String and Unicode32String hashes differ on "%1" (%2)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1437
				bindWith:s with:s class name)
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1438
    ].
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1439
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1440
    tester value:'a'.
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1441
    tester value:'123456789012345678'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1442
    tester value:'12345678901234567'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1443
    tester value:'1234567890123456'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1444
    tester value:'123456789012345'.
1385
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1445
    tester value:'12345678901234'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1446
    tester value:'1234567890123'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1447
    tester value:'123456789012'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1448
    tester value:'12345678901'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1449
    tester value:'1234567890'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1450
    tester value:'123456789'.
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1451
    tester value:'12345678'.
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1452
    tester value:'1234567'.
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1453
    tester value:'123456'.
1385
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1454
    tester value:'12345'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1455
    tester value:'1234'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1456
    tester value:'123'.
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1457
    tester value:'12'.
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1458
    tester value:'boolean'.
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1459
1417
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1460
    "/ strings with 0-elements
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1461
    tester value:('' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1462
    tester value:('1' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1463
    tester value:('12' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1464
    tester value:('123' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1465
    tester value:('1234' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1466
    tester value:('12345' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1467
    tester value:('123456' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1468
    tester value:('1234567' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1469
    tester value:('12345678' copyWith:Character null).
d624843fda05 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
  1470
    tester value:('123456789' copyWith:Character null).
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1471
    tester value:('1234567890' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1472
    tester value:('12345678901' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1473
    tester value:('123456789012' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1474
    tester value:('1234567890123' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1475
    tester value:('12345678901234' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1476
    tester value:('123456789012345' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1477
    tester value:('1234567890123456' copyWith:Character null).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1478
    tester value:('12345678901234567' copyWith:Character null).
1419
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1479
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1480
    tester value:('' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1481
    tester value:('1' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1482
    tester value:('12' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1483
    tester value:('123' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1484
    tester value:('1234' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1485
    tester value:('12345' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1486
    tester value:('123456' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1487
    tester value:('1234567' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1488
    tester value:('12345678' copyWith:Character null),'123'.
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1489
    tester value:('123456789' copyWith:Character null),'123'.
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1490
    tester value:('1234567890' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1491
    tester value:('12345678901' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1492
    tester value:('123456789012' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1493
    tester value:('1234567890123' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1494
    tester value:('12345678901234' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1495
    tester value:('123456789012345' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1496
    tester value:('1234567890123456' copyWith:Character null),'123'.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1497
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1498
    "Created: / 02-04-2019 / 10:55:23 / Claus Gittinger"
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1499
!
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1500
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1501
test60b_hash
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  1502
    "verifies that symbols hash the same as string, u16string and u32string"
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  1503
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1504
    | tester |
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1505
2212
80b766225587 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2211
diff changeset
  1506
    "/ self skip:'takes long'.
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1507
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1508
    tester := [:s|
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1509
	|sHash u8Hash u16Hash u32Hash|
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1510
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1511
	sHash := s hash.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1512
	u8Hash := s asString hash.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1513
	u16Hash := s asUnicode16String hash.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1514
	u32Hash := s asUnicode32String hash.
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1515
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1516
	self assert: sHash == u8Hash
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1517
	     description: ('Symbol and String hashes differ on "%1" (%2)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1518
				bindWith:s with:s class name).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1519
	self assert: sHash == u16Hash
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1520
	     description: ('Symbol and Unicode16String hashes differ on "%1" (%2)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1521
				bindWith:s with:s class name).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1522
	self assert: sHash == u32Hash
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1523
	     description: ('Symbol and Unicode32String hashes differ on "%1" (%2)'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1524
				bindWith:s with:s class name)
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1525
    ].
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1526
1419
cfc3eb59fbcf #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1418
diff changeset
  1527
    "/ String allInstancesDo:[:each| tester value:each].
753
81af28f807cf class: RegressionTests::StringTests
Stefan Vogel <sv@exept.de>
parents: 752
diff changeset
  1528
    Symbol allInstancesDo:[:each| tester value:each].
751
8c9ff6c5efe2 Added string hashing tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 702
diff changeset
  1529
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1530
    "Created: / 02-04-2019 / 10:55:26 / Claus Gittinger"
962
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1531
!
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1532
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1533
test61_hash
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1534
    "all string-representations must hash equal"
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1535
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1536
    | string8 string16 string32 |
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1537
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1538
    string8 := 'sun/nio/cs/UTF_8.class'.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1539
    string16 := string8 asUnicode16String.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1540
    string32 := string8 asUnicode16String.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1541
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1542
    self assert: string8 hash == string16 hash.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1543
    self assert: string8 hash == string32 hash.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1544
    self assert: string8 hash == string8 asSymbol hash.
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1545
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1546
    "Created: / 09-10-2014 / 12:41:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1547
    "Modified: / 02-04-2019 / 10:42:35 / Claus Gittinger"
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1548
!
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  1549
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1550
test65_concatenation
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1551
    |strA strB|
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1552
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1553
    0 to:32 do:[:szA |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1554
	0 to:32 do:[:szB |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1555
	    |szAB|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1556
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1557
	    strA := String new:szA withAll:$a.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1558
	    strB := String new:szB withAll:$b.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1559
	    szAB := szA + szB.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1560
	    self assert:(szA = strA size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1561
	    self assert:(szB = strB size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1562
	    "/ why repeat ??? - to check GC???
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1563
	    1 "10000" timesRepeat:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1564
		|strAB|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1565
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1566
		strAB := strA , strB.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1567
		self assert:(szAB == strAB size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1568
	    ]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1569
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1570
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1571
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1572
    strA := strB := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1573
    self assert: ((strA , strB) = '').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1574
    self assert: ((strA , strA) = '').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1575
    strA := 'a'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1576
    self assert: ((strA , strA) = 'aa').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1577
    self assert: ((strA , strB) = 'a').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1578
    strA := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1579
    strB := 'b'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1580
    self assert: ((strA , strB) = 'b').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1581
    strA := 'b'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1582
    strB := 'a'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1583
    self assert: ((strB , strA) = 'ab').
2207
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1584
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1585
    "/ concatenating other things
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1586
    self assert:('hello',123) = 'hello123'.
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1587
    self assert:('hello' asUnicode16String,123) = 'hello123' asUnicode16String.
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1588
    self assert:('hello' asUnicode32String,123) = 'hello123' asUnicode32String.
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1589
2207
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1590
    "/ concatenating other things
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1591
    self assert:('hello',,123) = c'hello\n123'.
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1592
    self assert:('hello' asUnicode16String,,123) = c'hello\n123' asUnicode16String.
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1593
    self assert:('hello' asUnicode32String,,123) = c'hello\n123' asUnicode32String.
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1594
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1595
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1596
     self new test65_concatenation
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1597
    "
2207
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1598
33fec8c61cb8 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1599
    "Modified: / 02-04-2019 / 10:41:24 / Claus Gittinger"
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1600
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1601
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1602
test66_replace
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1603
    |strA|
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1604
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1605
    1 to:64 do:[:szA |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1606
	strA := String new:szA withAll:$a.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1607
	    1 to:szA do:[:idx |
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1608
		strA at:idx put:$*.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1609
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1610
		strA replaceAll:$* with:$#.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1611
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1612
		self assert:(strA at:idx) = $#.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1613
		self assert:(strA occurrencesOf:$#) = idx.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1614
		self assert:(strA count:[:ch | ch = $#]) = idx.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1615
		self assert:(strA occurrencesOf:$*) = 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1616
		self assert:(strA count:[:ch | ch = $*]) = 0.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1617
		self assert:(strA includes:$#).
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1618
		self assert:(strA includes:$*) not.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1619
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1620
    ]
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1621
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1622
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1623
     self new test66_replace
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1624
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1625
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1626
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1627
test67_concatenationAnd
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1628
    |strA strB strC|
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1629
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1630
    0 to:32 do:[:szA |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1631
	0 to:32 do:[:szB |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1632
	    0 to:32 do:[:szC |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1633
		|szABC|
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1634
		strA := String new:szA withAll:$a.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1635
		strB := String new:szB withAll:$b.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1636
		strC := String new:szC withAll:$c.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1637
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1638
		szABC := szA + szB + szC.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1639
		self assert:(szA = strA size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1640
		self assert:(szB = strB size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1641
		self assert:(szC = strC size).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1642
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1643
		"/ why repeat? to test GC???
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1644
		1 "300" timesRepeat:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1645
		    |strABC|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1646
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1647
		    strABC := strA concatenate:strB and:strC.
2210
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1648
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1649
		    self assert:(szABC == strABC size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1650
		]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1651
	    ]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1652
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1653
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1654
    strA := strB := strC := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1655
    self assert: ((strA concatenate:strB and:strC) = '').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1656
    strA := 'a'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1657
    self assert: ((strA concatenate:strB and:strC) = 'a').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1658
    strA := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1659
    strB := 'b'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1660
    self assert: ((strA concatenate:strB and:strC) = 'b').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1661
    strB := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1662
    strC := 'c'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1663
    self assert: ((strA concatenate:strB and:strC) = 'c').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1664
    strA := 'c'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1665
    strB := 'b'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1666
    strC := 'a'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1667
    self assert: ((strC concatenate:strB and:strA) = 'abc').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1668
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1669
     self new test67_concatenationAnd
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1670
    "
2210
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1671
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1672
    "Modified: / 02-04-2019 / 10:51:31 / Claus Gittinger"
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1673
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1674
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1675
test68_concatenationAndAnd
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1676
    |strA strB strC strD|
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1677
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1678
    0 to:32 do:[:szA |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1679
	strA := String new:szA withAll:$a.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1680
	self assert:(szA = strA size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1681
	0 to:32 do:[:szB |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1682
	    strB := String new:szB withAll:$b.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1683
	    self assert:(szB = strB size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1684
	    0 to:32 do:[:szC |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1685
		strC := String new:szC withAll:$c.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1686
		self assert:(szC = strC size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1687
		0 to:32 do:[:szD |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1688
		    |szABCD|
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1689
		    strD := String new:szD withAll:$d.
2210
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1690
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1691
		    szABCD := szA + szB + szC + szD.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1692
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1693
		    self assert:(szD = strD size).
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1694
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1695
		    "/ why repeat???
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1696
		    1 "5" timesRepeat:[
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1697
			|strABCD|
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1698
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1699
			strABCD := strA concatenate:strB and:strC and:strD.
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1700
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1701
			self assert:(szABCD == strABCD size).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1702
		    ]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1703
		]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1704
	    ]
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1705
	]
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1706
    ].
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1707
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1708
    strA := strB := strC := strD := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1709
    self assert: ((strA concatenate:strB and:strC and:strD) = '').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1710
    strA := 'a'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1711
    self assert: ((strA concatenate:strB and:strC and:strD) = 'a').
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1712
    strA := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1713
    strB := 'b'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1714
    self assert: ((strA concatenate:strB and:strC and:strD) = 'b').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1715
    strB := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1716
    strC := 'c'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1717
    self assert: ((strA concatenate:strB and:strC and:strD) = 'c').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1718
    strC := ''.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1719
    strD := 'd'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1720
    self assert: ((strA concatenate:strB and:strC and:strD) = 'd').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1721
    strA := 'd'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1722
    strB := 'c'.
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1723
    strC := 'b'.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1724
    strD := 'a'.
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
  1725
    self assert: ((strD concatenate:strC and:strB and:strA) = 'abcd').
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1726
    "
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1727
     self new test68_concatenationAndAnd
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1728
    "
2210
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1729
d3368bb7f119 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  1730
    "Modified: / 02-04-2019 / 10:51:50 / Claus Gittinger"
1426
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1731
!
f9427fb3fbcf #QUALITY by mawalch
mawalch
parents: 1425
diff changeset
  1732
1991
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1733
test69_split
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1734
    self assert:(('a,b,c,d' splitByAny:',;') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1735
    self assert:(('a;b;c;d' splitByAny:',;') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1736
    self assert:(('a;b,c;d' splitByAny:',;') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1737
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1738
    self assert:(($, split:'a,b,c,d') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1739
    self assert:((',' split:'a,b,c,d') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1740
    self assert:(('//' split:'a//b//c//d') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1741
    self assert:(('a//b//c//d' splitOn:'//') sameContentsAs: #('a' 'b' 'c' 'd')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1742
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1743
    "/ self assert:(([:ch | ch isLetter] split:'a2b3c4') sameContentsAs: #('1' '2' '3' '4')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1744
    "/ self assert:(([:char | char isDigit] split: '1a2b3c4') sameContentsAs: #('a' 'b' 'c')).
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1745
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1746
    "
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1747
     self new test69_split
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1748
    "
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1749
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1750
    "Created: / 20-07-2018 / 23:54:15 / Claus Gittinger"
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1751
!
522d8744231d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1752
962
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1753
test70_storeString
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1754
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1755
    self assert: 'AAA' storeString = '''AAA'''.
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1756
    self assert: 'A''A''A' storeString = '''A''''A''''A'''.
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1757
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1758
    self assert: 'AAA' asImmutableString storeString = '''AAA'''.
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1759
    self assert: 'A''A''A' asImmutableString storeString = '''A''''A''''A'''.
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1760
2fca937dc59b class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 874
diff changeset
  1761
    "Created: / 14-07-2013 / 19:17:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1103
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1762
!
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1763
2465
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1764
test80a_copyReplaceAll
1103
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1765
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1766
    | orig copy |
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1767
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1768
    orig := 'AAA' copy. "/ In case literals are immutable...
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1769
    self assert: orig = 'AAA'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1770
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1771
    copy := orig copyReplaceAll: $A with: $X.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1772
    self assert: copy = 'XXX'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1773
    self assert: orig = 'AAA'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1774
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1775
    orig := 'AAA' asImmutableString.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1776
    self assert: orig = 'AAA'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1777
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1778
    copy := orig copyReplaceAll: $A with: $X.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1779
    self assert: copy = 'XXX'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1780
    self assert: orig = 'AAA'.
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1781
373c0f5e539d class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1060
diff changeset
  1782
    "Created: / 06-03-2014 / 15:10:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1214
11cb005634cb class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1103
diff changeset
  1783
!
11cb005634cb class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1103
diff changeset
  1784
2465
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1785
test80b_copyReplaceString
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1786
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1787
    | copy |
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1788
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1789
    copy := 'AAA' copyReplaceString:'AA' withString:'BB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1790
    self assert: copy = 'BBA'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1791
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1792
    copy := 'AAAA' copyReplaceString:'AA' withString:'BB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1793
    self assert: copy = 'BBBB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1794
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1795
    copy := 'AAAA' copyReplaceString:'XX' withString:'BB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1796
    self assert: copy = 'AAAA'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1797
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1798
    copy := '' copyReplaceString:'XX' withString:'BB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1799
    self assert: copy = ''.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1800
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1801
    copy := 'X' copyReplaceString:'XX' withString:'BB'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1802
    self assert: copy = 'X'.
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1803
!
dafd40caecba #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2393
diff changeset
  1804
1240
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1805
test81_filling
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1806
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1807
    | str |
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1808
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1809
    str := 'AAA' copy. "/ In case literals are immutable...
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1810
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1811
    str atAllPut:$B.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1812
    self assert: str = 'BBB'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1813
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1814
    str from:1 to:0 put:$C.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1815
    self assert: str = 'BBB'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1816
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1817
    str from:1 to:1 put:$D.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1818
    self assert: str = 'DBB'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1819
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1820
    str from:1 to:2 put:$E.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1821
    self assert: str = 'EEB'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1822
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1823
    str from:1 to:3 put:$F.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1824
    self assert: str = 'FFF'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1825
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1826
    str from:1 to:0 put:$G.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1827
    self assert: str = 'FFF'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1828
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1829
    str from:-1 to:-2 put:$G.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1830
    self assert: str = 'FFF'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1831
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1832
    self should:[
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1833
	str from:-1 to:-1 put:$x
1240
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1834
    ] raise:SubscriptOutOfBoundsError.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1835
    self assert: str = 'FFF'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1836
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1837
    self should:[
1421
3236b9c7d993 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1838
	str from:-1 to:1 put:$x
1240
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1839
    ] raise:SubscriptOutOfBoundsError.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1840
    self assert: str = 'FFF'.
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1841
!
4b187f56458b class: RegressionTests::StringTests
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  1842
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1843
test82a_expanding
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1844
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1845
    | rslt |
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1846
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1847
    rslt := 'A%1B%2C' expandPlaceholdersWith:#(10 20 30).
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1848
    self assert:(rslt = 'A10B20C').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1849
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1850
    rslt := 'A%1B%2C%' expandPlaceholdersWith:#(10 20 30).
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1851
    self assert:(rslt = 'A10B20C%').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1852
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1853
    rslt := 'A%%1B%2C%' expandPlaceholdersWith:#(10 20 30).
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1854
    self assert:(rslt = 'A%1B20C%').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1855
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1856
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1857
    rslt := 'A%aB%bC' expandPlaceholdersWith:(Dictionary withKeys:#(a b c)
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1858
							 andValues:#(10 20 30)).
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1859
    self assert:(rslt = 'A10B20C').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1860
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1861
    "/ not expanded, if not found
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1862
    rslt := 'A%aB%bC' expandPlaceholdersWith:(Dictionary withKeys:#(aa bb cc)
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1863
							 andValues:#(10 20 30)).
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1864
    self assert:(rslt = 'A%aB%bC').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1865
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1866
    rslt := 'A%aaB%bbC' expandPlaceholdersWith:(Dictionary withKeys:#(aa bb cc)
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1867
							 andValues:#(10 20 30)).
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1868
    self assert:(rslt = 'A%aaB%bbC').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1869
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1870
    rslt := 'A%(aa)B%(bb)C' expandPlaceholdersWith:(Dictionary withKeys:#(aa bb cc)
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1871
							 andValues:#(10 20 30)).
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1872
    self assert:(rslt = 'A10B20C').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1873
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1874
    "/ allowing non-parenthized
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1875
    rslt := String streamContents:[:s |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1876
		'A%aa,B%bb,C'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1877
			expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1878
			with:(Dictionary withKeys:#(aa bb cc) andValues:#(10 20 30))
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1879
			ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1880
			requireParentheses:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1881
			on:s.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1882
	    ].
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1883
    self assert:(rslt = 'A10,B20,C').
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1884
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1885
    "Created: / 02-04-2019 / 11:00:08 / Claus Gittinger"
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1886
!
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1887
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1888
test82b_expanding
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1889
    | rslt |
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1890
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1891
    rslt := 'hello' copyExpanding:(Dictionary
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1892
					withKeys:{$h . $e . $o}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1893
					andValues:{'HH' . 'EE' . $O }).
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1894
    self assert:(rslt = 'HHEEllO').
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1895
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1896
    rslt := 'he%2llo%1' % { 123 . 456 }.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1897
    self assert:(rslt = 'he456llo123').
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1898
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1899
    "Created: / 02-04-2019 / 11:00:43 / Claus Gittinger"
2077
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1900
!
a8fde1ea4970 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  1901
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1902
test82c_expanding
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1903
    | rslt |
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1904
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1905
    rslt := '%1-%2-%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1906
	    expandPlaceholders:$$
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1907
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1908
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1909
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1910
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1911
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1912
    self assert:(rslt = '%1-%2-%3').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1913
2328
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1914
    rslt := '$$rev'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1915
	    expandPlaceholders:$$
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1916
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1917
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1918
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1919
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1920
	    requireParentheses:false.
2328
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1921
    self assert:(rslt = '$rev').
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1922
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1923
    rslt := '$$rev'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1924
	    expandPlaceholders:$$
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1925
	    with:(Dictionary withKeysAndValues:{ 'rev' . '1234'})
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1926
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1927
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1928
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1929
	    requireParentheses:false.
2328
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1930
    self assert:(rslt = '$rev').
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1931
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1932
    rslt := '$rev'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1933
	    expandPlaceholders:$$
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1934
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1935
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1936
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1937
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1938
	    requireParentheses:false.
2328
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1939
    self assert:(rslt = '$rev').
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1940
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1941
    rslt := '$rev'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1942
	    expandPlaceholders:$$
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1943
	    with:(Dictionary withKeysAndValues:{ 'rev' . '1234'})
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1944
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1945
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1946
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1947
	    requireParentheses:false.
2328
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1948
    self assert:(rslt = '1234').
cfee3c8c8f98 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  1949
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1950
    rslt := '%1-%2-%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1951
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1952
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1953
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1954
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1955
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1956
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1957
    self assert:(rslt = '10-20-30').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1958
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1959
    rslt := '%1-%2-%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1960
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1961
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1962
	    ignoreNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1963
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1964
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1965
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1966
    self assert:(rslt = '%1-%2-%3').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1967
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1968
    rslt := '%1%<cr>%2%<cr>%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1969
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1970
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1971
	    ignoreNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1972
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1973
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1974
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1975
    self assert:(rslt = c'%1\n%2\n%3').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1976
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1977
    rslt := '%1%<cr>%2%<cr>%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1978
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1979
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1980
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1981
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1982
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1983
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1984
    self assert:(rslt = c'10\n20\n30').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1985
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1986
    rslt := '%1%<cr>%2%<cr>%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1987
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1988
	    with:{10 . 20 . 30}
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1989
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1990
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1991
	    ignoreSpecialEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1992
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1993
    self assert:(rslt = '10%<cr>20%<cr>30').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1994
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  1995
    rslt := '%1 %(a) %(1) %(b)'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1996
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1997
	    with:(Dictionary withKeysAndValues:{ 'a' . 'AAA' . 'b' . 'BBB' })
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1998
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  1999
	    ignoreNonNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2000
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2001
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2002
    self assert:(rslt = ' %(a)  %(b)').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2003
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2004
    rslt := '%1 %(a) %(1) %(b)'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2005
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2006
	    with:(Dictionary withKeysAndValues:{ 'a' . 'AAA' . 'b' . 'BBB' })
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2007
	    ignoreNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2008
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2009
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2010
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2011
    self assert:(rslt = '%1 AAA %(1) BBB').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2012
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2013
    rslt := '%1 %a %(1) %b'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2014
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2015
	    with:(Dictionary withKeysAndValues:{ 'a' . 'AAA' . 'b' . 'BBB' })
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2016
	    ignoreNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2017
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2018
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2019
	    requireParentheses:false.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2020
    self assert:(rslt = '%1 AAA %(1) BBB').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2021
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2022
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2023
    rslt := '%1 %aa %(1) %bb'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2024
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2025
	    with:(Dictionary withKeysAndValues:{ 'a' . 'AAA' . 'b' . 'BBB' })
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2026
	    ignoreNumericEscapes:true
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2027
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2028
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2029
	    requireParentheses:true.
2327
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2030
    self assert:(rslt = '%1 AAAa %(1) BBBb').
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2031
!
bf482d49aeaf #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
  2032
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2033
test82d_expanding
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2034
    "what happens with missing keys:"
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2035
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2036
    | rslt |
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2037
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2038
    rslt := '%1-%2-%3'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2039
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2040
	    with:{10 . 20 }
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2041
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2042
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2043
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2044
	    requireParentheses:false.
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2045
    self assert:(rslt = '10-20-').
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2046
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2047
    "/ stupid backward compatibiliy!!
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2048
    rslt := '%a-%b-%c'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2049
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2050
	    with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2051
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2052
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2053
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2054
	    requireParentheses:false.
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2055
    self assert:(rslt = '10-20-%c').
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2056
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2057
    rslt := '%(a)-%(b)-%(c)'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2058
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2059
	    with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2060
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2061
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2062
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2063
	    requireParentheses:false.
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2064
    self assert:(rslt = '10-20-').
2378
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2065
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2066
    rslt := '%(a)-%(b)-%(c)'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2067
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2068
	    with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2069
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2070
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2071
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2072
	    requireParentheses:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2073
	    ifKeyAbsent:[:str :var | str].
2378
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2074
    self assert:(rslt = '10-20-%(c)').
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2075
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2076
    rslt := '%(a)-%(b)-%(abc)'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2077
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2078
	    with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2079
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2080
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2081
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2082
	    requireParentheses:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2083
	    ifKeyAbsent:[:str :var | str].
2378
789f2fc52c57 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
  2084
    self assert:(rslt = '10-20-%(abc)').
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2085
!
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2086
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2087
test82e_expandingSpecialSequences
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2088
    | rslt |
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2089
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2090
    rslt := 'abc%<tab>def'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2091
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2092
	    with:nil
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2093
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2094
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2095
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2096
	    requireParentheses:false.
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2097
    self assert:(rslt = ('abc',Character tab,'def')).
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2098
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2099
    rslt := 'abc%<crlf>def'
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2100
	    expandPlaceholders:$%
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2101
	    with:nil
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2102
	    ignoreNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2103
	    ignoreNonNumericEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2104
	    ignoreSpecialEscapes:false
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2105
	    requireParentheses:false.
2377
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2106
    self assert:(rslt = ('abc',String crlf,'def')).
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2107
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2108
    rslt := 'abc%<crlf>def' with:nil.
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2109
    self assert:(rslt = ('abc',String crlf,'def')).
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2110
!
e730910ab2a5 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2365
diff changeset
  2111
2388
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2112
test82f_expanding
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2113
    "special cases:"
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2114
2389
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2115
    | rslt args |
2388
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2116
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2117
    rslt := '%' bindWith:'aaa'.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2118
    self assert:(rslt = '%').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2119
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2120
    rslt := '%1' bindWith:'aaa'.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2121
    self assert:(rslt = 'aaa').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2122
    rslt := '%1b' bindWith:'aaa'.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2123
    self assert:(rslt = 'aaab').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2124
    rslt := '%2' bindWith:'aaa'.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2125
    self assert:(rslt = '').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2126
    rslt := '%9' bindWith:'aaa'.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2127
    self assert:(rslt = '').
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2128
    rslt := '%9' bindWithArguments:#(a1 b2 c3 d4 e5 f6 g7 h8 i9).
2388
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2129
    self assert:(rslt = 'i9').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2130
    rslt := '%1x' bindWithArguments:#(a1 b2 c3 d4 e5 f6 g7 h8 i9 j10).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2131
    self assert:(rslt = 'a1x').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2132
    rslt := '%10' bindWithArguments:#(a1 b2 c3 d4 e5 f6 g7 h8 i9 j10).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2133
    self assert:(rslt = 'j10').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2134
    rslt := '%10x' bindWithArguments:#(a1 b2 c3 d4 e5 f6 g7 h8 i9 j10).
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2135
    self assert:(rslt = 'j10x').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2136
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2137
    rslt := 'hello %10%9%8' expandPlaceholders:$% with:{ 'x1' . 'x2' . 'x3' . 'x4' . 'x5' . 'x6' . 'x7' . 'x8' . 'x9' . 'x10' }.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2138
    self assert:(rslt = 'hello x10x9x8').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2139
    rslt := 'hello %10' expandPlaceholders:$% with:{ 'x1' . 'x2' . 'x3' . 'x4' . 'x5' . 'x6' . 'x7' . 'x8' . 'x9' . 'x10' }.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2140
    self assert:(rslt = 'hello x10').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2141
    rslt := 'hello %(1)x' expandPlaceholders:$% with:{ 'x1' . 'x2' . 'x3' . 'x4' . 'x5' . 'x6' . 'x7' . 'x8' . 'x9' . 'x10' }.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2142
    self assert:(rslt = 'hello x1x').
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2143
2389
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2144
    args := Dictionary new
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2145
		at:'year' put:'yyyy';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2146
		at:'mon' put:'mmm';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2147
		at:'day' put:'dd';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2148
		at:'h' put:'HH';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2149
		at:'m' put:'MM';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2150
		at:'s' put:'SS';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2151
		at:'i' put:'II';
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2152
		yourself.
2389
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2153
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2154
    rslt := '%(year)-%(mon)-%(day) %h:%m:%s.%i' bindWithArguments:args.
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2155
    self assert:(rslt = 'yyyy-mmm-dd HH:MM:SS.II').
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2156
    rslt := '%(year)-%(mon)-%(day) %(h):%(m):%(s).%(i)' bindWithArguments:args.
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2157
    self assert:(rslt = 'yyyy-mmm-dd HH:MM:SS.II').
481588f3ca33 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2388
diff changeset
  2158
2388
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2159
    self should:[ rslt := '%(' bindWith:'aaa' ] raise:Error.
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2160
!
6ac280a6d988 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2378
diff changeset
  2161
2112
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2162
test83_padding
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2163
    | rslt |
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2164
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2165
    rslt := 'foo' paddedTo:10.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2166
    self assert:(rslt = 'foo       ').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2167
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2168
    rslt := 'foo' paddedTo:3.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2169
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2170
    rslt := 'foo' paddedTo:4.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2171
    self assert:(rslt = 'foo ').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2172
    rslt := 'foo' paddedTo:2.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2173
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2174
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2175
    rslt := '' paddedTo:2.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2176
    self assert:(rslt = '  ').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2177
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2178
    rslt := 'foo' paddedTo:10 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2179
    self assert:(rslt = 'foo-------').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2180
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2181
    rslt := 'foo' paddedTo:3 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2182
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2183
    rslt := 'foo' paddedTo:4 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2184
    self assert:(rslt = 'foo-').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2185
    rslt := 'foo' paddedTo:2 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2186
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2187
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2188
    rslt := '' paddedTo:2 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2189
    self assert:(rslt = '--').
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2190
2112
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2191
    rslt := 'foo' leftPaddedTo:10.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2192
    self assert:(rslt = '       foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2193
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2194
    rslt := 'foo' leftPaddedTo:3.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2195
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2196
    rslt := 'foo' leftPaddedTo:4.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2197
    self assert:(rslt = ' foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2198
    rslt := 'foo' leftPaddedTo:2.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2199
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2200
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2201
    rslt := '' leftPaddedTo:2.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2202
    self assert:(rslt = '  ').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2203
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2204
    rslt := 'foo' leftPaddedTo:10 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2205
    self assert:(rslt = '-------foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2206
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2207
    rslt := 'foo' leftPaddedTo:3 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2208
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2209
    rslt := 'foo' leftPaddedTo:4 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2210
    self assert:(rslt = '-foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2211
    rslt := 'foo' leftPaddedTo:2 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2212
    self assert:(rslt = 'foo').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2213
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2214
    rslt := '' leftPaddedTo:2 with:$-.
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2215
    self assert:(rslt = '--').
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2216
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2217
    "Created: / 21-03-2019 / 12:58:33 / Claus Gittinger"
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2218
!
3e51f70c1b03 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
  2219
2211
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2220
test84_withCRs
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2221
    | rslt |
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2222
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2223
    rslt := 'foo\bar' addLineDelimiters.
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2224
    self assert:(rslt = ('foo',Character cr,'bar')).
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2225
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2226
    "Created: / 02-04-2019 / 10:57:44 / Claus Gittinger"
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2227
!
632cea1b911c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  2228
2393
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2229
test85_printf
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2230
    self assert:( (PrintfScanf printf:'%c' argument:$a) = 'a' ).
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2231
    self assert:( (PrintfScanf printf:'%c' argument:'a') = 'a' ).
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2232
    self assert:( (PrintfScanf printf:'%c' argument:'abc') = 'a' ).
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2233
    self assert:( (PrintfScanf printf:'%c' argument:65) = 'A' ).
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2234
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2235
    "/ verify that our printf generates the same string as the system-printf.
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2236
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2237
    #(
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2238
	'%s'       ''           ''
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2239
	'%s'       'abc'        'abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2240
	'x%s'      ''           'x'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2241
	'x%s'      'abc'        'xabc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2242
	'%sx'      ''           'x'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2243
	'%sx'      'abc'        'abcx'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2244
	'x%sx'     ''           'xx'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2245
	'x%sx'     'abc'        'xabcx'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2246
	'%6s'      'abc'        '   abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2247
	'%-6s'     'abc'        'abc   '
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2248
     "/   '%06s'     'abc'        '000abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2249
     "/   '%-06s'    'abc'        'abc000'
2393
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2250
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2251
	'%.3s'     'abcdef'     'abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2252
	'%6.3s'    'abcdef'     '   abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2253
	'%-6.3s'   'abcdef'     'abc   '
2393
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2254
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2255
    ) inGroupsOf:3 do:[:fmt :val :expected|
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2256
	|printfGenerated stxGenerated|
2393
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2257
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2258
	printfGenerated := val printfPrintString:fmt.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2259
	stxGenerated := PrintfScanf printf:fmt argument:val.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2260
	self assert:(stxGenerated = printfGenerated).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2261
	self assert:(printfGenerated = expected).
2393
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2262
    ].
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2263
!
96f3b2a65ead #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2389
diff changeset
  2264
2566
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2265
test86_misc
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2266
    self assert:( '"hello"' withoutQuotes = 'hello' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2267
    self assert:( '''hello''' withoutQuotes = 'hello' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2268
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2269
    self assert:( 'hello''' withoutQuotes = 'hello''' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2270
    self assert:( '''hello' withoutQuotes = '''hello' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2271
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2272
    self assert:( 'hello"' withoutQuotes = 'hello"' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2273
    self assert:( '"hello' withoutQuotes = '"hello' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2274
    self assert:( 'hello' withoutQuotes = 'hello' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2275
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2276
    self assert:( 'he' withoutQuotes = 'he' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2277
    self assert:( 'h' withoutQuotes = 'h' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2278
    self assert:( '' withoutQuotes = '' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2279
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2280
    self assert:( '""' withoutQuotes = '' ).
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2281
    self assert:( '''''' withoutQuotes = '' ).
2567
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2282
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2283
    "/ ------------------------------------
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2284
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2285
    "/ unquote only unquotes double quotes
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2286
    self assert:( '"hello"' unquote = 'hello' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2287
    self assert:( '''hello''' unquote = '''hello''' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2288
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2289
    self assert:( 'hello"' unquote = 'hello"' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2290
    self assert:( '"hello' unquote = '"hello' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2291
    self assert:( 'hello' unquote = 'hello' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2292
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2293
    self assert:( 'he' unquote = 'he' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2294
    self assert:( 'h' unquote = 'h' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2295
    self assert:( '' unquote = '' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2296
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2297
    self assert:( '""' unquote = '' ).
2570
d62760a8ac9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  2298
    self assert:( '''''' unquote = '''''' ).
2567
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2299
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2300
    "/ ------------------------------------
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2301
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2302
    "/ unquote only unquotes double quotes
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2303
    self assert:( ('"hello"' unquote:$") = 'hello' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2304
    self assert:( ('''hello''' unquote:$") = '''hello''' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2305
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2306
    self assert:( ('"hello"' unquote:$') = '"hello"' ).
bf0f6e311a5d #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2566
diff changeset
  2307
    self assert:( ('''hello''' unquote:$') = 'hello' ).
2566
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2308
!
ca2e98a4c1ed #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2564
diff changeset
  2309
2572
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2310
test87_misc
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2311
     self assert:( String readSmalltalkStringFrom:('''hello world''' readStream) onError:[nil] ) = 'hello world'.
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2312
     self assert:( String readSmalltalkStringFrom:('''hello '''' world''' readStream) onError:[nil] ) = 'hello '' world'.   
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2313
     self assert:( String readSmalltalkStringFrom:('1 ''hello'' ' readStream) onError:[nil] ) isNil.
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2314
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2315
     self assert:( String readSmalltalkStringFrom:('1 ''hello'' ' readStream) onError:['foobar'] ) = 'foobar'.   
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2316
     self assert:( String readSmalltalkStringFrom:('''hello\nworld''' readStream) onError:[nil] ) = 'hello\nworld'.       
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2317
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2318
     self assert:( String readSmalltalkStringFrom:('c''hello\nworld''' readStream) keepCRs:false onError:[nil] ) = c'hello\nworld'.   
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2319
     self assert:( String readSmalltalkStringFrom:('c''hello\tworld''' readStream) keepCRs:false onError:[nil] ) = c'hello\tworld'.   
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2320
!
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2321
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2322
test90_enumeratingLines
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2323
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2324
    |  |
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2325
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2326
    #(
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2327
	c''
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2328
	c'abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2329
	c'\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2330
	c'abc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2331
	c'\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2332
	c'abc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2333
	c'\n\nabc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2334
	c'\nabc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2335
	c'abc\nabc\nabc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2336
	c'abc\nabc\nabc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2337
	c'abc\nabc\nabc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2338
	c'a\nb\nc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2339
	c'a\n\n\nb\nc\n\n\n\nd'
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2340
    ) do:[:eachTestString |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2341
	|testString sColl calledWith1 calledWith2 count1 count2 countReturned|
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2342
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2343
	#( yourself asUnicode16String asUnicode32String ) do:[:conv |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2344
	    testString := eachTestString perform:conv.
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2345
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2346
	    "/ try asStringCollection as reference
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2347
	    sColl := testString asStringCollection.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2348
	    count1 := 0.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2349
	    calledWith1 := OrderedCollection new.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2350
	    sColl do:[:each |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2351
		count1 := count1 + 1.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2352
		calledWith1 add:each.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2353
	    ].
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2354
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2355
	    "/ check asCollectionOfLinesDo:
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2356
	    count2 := 0.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2357
	    calledWith2 := OrderedCollection new.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2358
	    countReturned := testString asCollectionOfLinesDo:[:each |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2359
		count2 := count2 + 1.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2360
		calledWith2 add:each.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2361
	    ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2362
	    self assert:(count1 == count2).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2363
	    self assert:(count2 == countReturned).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2364
	    self assert:(calledWith1 = calledWith2).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2365
	].
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2366
    ].
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2367
!
1214
11cb005634cb class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1103
diff changeset
  2368
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2369
test91_enumeratingWords
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2370
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2371
    |  |
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2372
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2373
    #(
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2374
	0 c''
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2375
	1 c'abc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2376
	0 c'\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2377
	1 c'abc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2378
	0 c'\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2379
	1 c'abc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2380
	1 c'\n\nabc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2381
	1 c'\nabc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2382
	3 c'abc\nabc\nabc'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2383
	3 c'abc\nabc\nabc\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2384
	3 c'abc\nabc\nabc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2385
	3 c'a\nb\nc\n\n'
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2386
	4 c'a\n\n\nb\nc\n\n\n\nd'
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2387
    ) pairWiseDo:[:expectedCount :eachTestString |
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2388
	|testString sColl calledWith1 calledWith2 count1 count2 countReturned|
1214
11cb005634cb class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1103
diff changeset
  2389
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2390
	#( yourself asUnicode16String asUnicode32String ) do:[:conv |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2391
	    testString := eachTestString perform:conv.
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2392
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2393
	    "/ try asStringCollection as reference
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2394
	    sColl := testString asCollectionOfWords.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2395
	    count1 := 0.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2396
	    calledWith1 := OrderedCollection new.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2397
	    sColl do:[:each |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2398
		count1 := count1 + 1.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2399
		calledWith1 add:each.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2400
	    ].
1214
11cb005634cb class: RegressionTests::StringTests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1103
diff changeset
  2401
2569
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2402
	    "/ check asCollectionOfWordsDo:
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2403
	    count2 := 0.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2404
	    calledWith2 := OrderedCollection new.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2405
	    countReturned := testString asCollectionOfWordsDo:[:each |
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2406
		count2 := count2 + 1.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2407
		calledWith2 add:each.
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2408
	    ].
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2409
	    self assert:(count1 == expectedCount).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2410
	    self assert:(count1 == count2).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2411
	    self assert:(count2 == countReturned).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2412
	    self assert:(calledWith1 = calledWith2).
9b7a08d2261c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2567
diff changeset
  2413
	].
2364
41b2b20fa672 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 2328
diff changeset
  2414
    ].
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2415
! !
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2416
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2417
!StringTests class methodsFor:'documentation'!
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2418
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2419
version
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2420
    ^ '$Header$'
570
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  2421
!
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  2422
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  2423
version_CVS
705b823baac2 string error
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  2424
    ^ '$Header$'
283
6aeeeda25c69 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2425
! !
2572
c0cb4ff0f03a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
  2426