@@ -47,9 +47,9 @@ class RedBlackTreeTests: XCTestCase {
4747 XCTAssert ( 0 == s. count, " Test failed, got \( s. count) . " )
4848
4949 for _ in 0 ..< 1000 {
50- s. insert ( 1 , value : 1 )
51- s. insert ( 2 , value : 2 )
52- s. insert ( 3 , value : 3 )
50+ s. insert ( value : 1 , for : 1 )
51+ s. insert ( value : 2 , for : 2 )
52+ s. insert ( value : 3 , for : 3 )
5353 }
5454
5555 XCTAssert ( 3 == s. count, " Test failed. \( s) " )
@@ -58,24 +58,24 @@ class RedBlackTreeTests: XCTestCase {
5858 XCTAssert ( 3 == s [ 2 ] . value, " Test failed. " )
5959
6060 for _ in 0 ..< 500 {
61- s. removeValueForKeys ( 1 )
62- s. removeValueForKeys ( 3 )
61+ s. removeValue ( for : 1 )
62+ s. removeValue ( for : 3 )
6363 }
6464
6565 XCTAssert ( 1 == s. count, " Test failed. " )
66- s . removeValueForKeys ( 2 )
66+ s . removeValue ( for : 2 )
6767
68- XCTAssert ( true == s. insert ( 2 , value : 10 ) , " Test failed. " )
68+ XCTAssert ( true == s. insert ( value : 2 , for : 10 ) , " Test failed. " )
6969 XCTAssert ( 1 == s. count, " Test failed. " )
70- XCTAssert ( 10 == s. findValueForKey ( 2 ) , " Test failed. " )
70+ XCTAssert ( 10 == s. findValue ( for : 2 ) , " Test failed. " )
7171 XCTAssert ( 10 == s [ 0 ] . value, " Test failed. " )
7272
73- s . removeValueForKeys ( 2 )
73+ s . removeValue ( for : 2 )
7474 XCTAssert ( 0 == s. count, " Test failed. " )
7575
76- s. insert ( 1 , value : 1 )
77- s. insert ( 2 , value : 2 )
78- s. insert ( 3 , value : 3 )
76+ s. insert ( value : 1 , for : 1 )
77+ s. insert ( value : 2 , for : 2 )
78+ s. insert ( value : 3 , for : 3 )
7979
8080 for i in s. startIndex..< s. endIndex {
8181 s [ i] = ( s [ i] . key, 100 )
@@ -88,7 +88,7 @@ class RedBlackTreeTests: XCTestCase {
8888
8989 func testPropertyKey( ) {
9090 var s = RedBlackTree < String , Array < Int > > ( uniqueKeys: false )
91- s. insert ( " friends " , value: [ 1 , 2 , 3 ] )
91+ s. insert ( value: [ 1 , 2 , 3 ] , for : " friends " )
9292 s [ " menu " ] = [ 11 , 22 , 33 ]
9393
9494 XCTAssert ( s [ " friends " ] ! == s [ 0 ] . value!, " Test failed. " )
@@ -102,54 +102,54 @@ class RedBlackTreeTests: XCTestCase {
102102
103103 func testValue( ) {
104104 var t1 = RedBlackTree < Int , Int > ( )
105- t1. insert ( 1 , value : 1 )
106- t1. insert ( 2 , value : 2 )
107- t1. insert ( 3 , value : 3 )
105+ t1. insert ( value : 1 , for : 1 )
106+ t1. insert ( value : 2 , for : 2 )
107+ t1. insert ( value : 3 , for : 3 )
108108
109109 var t2 = RedBlackTree < Int , Int > ( )
110- t2. insert ( 4 , value : 4 )
111- t2. insert ( 5 , value : 5 )
112- t2. insert ( 6 , value : 6 )
110+ t2. insert ( value : 4 , for : 4 )
111+ t2. insert ( value : 5 , for : 5 )
112+ t2. insert ( value : 6 , for : 6 )
113113
114- var t3 = t1 + t2
114+ let t3 = t1 + t2
115115
116116 for i in 0 ..< t1. count {
117- XCTAssert ( t1 [ i] . value == t3. findValueForKey ( t1 [ i] . value!) , " Test failed. " )
117+ XCTAssert ( t1 [ i] . value == t3. findValue ( for : t1 [ i] . value!) , " Test failed. " )
118118 }
119119
120120 for i in 0 ..< t2. count {
121- XCTAssert ( t2 [ i] . value == t3. findValueForKey ( t2 [ i] . value!) , " Test failed. " )
121+ XCTAssert ( t2 [ i] . value == t3. findValue ( for : t2 [ i] . value!) , " Test failed. " )
122122 }
123123 }
124124
125125 func testIndexOfUniqueKeys( ) {
126126 var t1 = RedBlackTree < Int , Int > ( uniqueKeys: true )
127- t1. insert ( 1 , value : 1 )
128- t1. insert ( 2 , value : 2 )
129- t1. insert ( 3 , value : 3 )
130- t1. insert ( 4 , value : 4 )
131- t1. insert ( 5 , value : 5 )
132- t1. insert ( 5 , value : 5 )
133- t1. insert ( 6 , value : 6 )
134-
135- XCTAssert ( 0 == t1. indexOf ( 1 ) , " Test failed. " )
136- XCTAssert ( 5 == t1. indexOf ( 6 ) , " Test failed. " )
137- XCTAssert ( - 1 == t1. indexOf ( 100 ) , " Test failed. " )
127+ t1. insert ( value : 1 , for : 1 )
128+ t1. insert ( value : 2 , for : 2 )
129+ t1. insert ( value : 3 , for : 3 )
130+ t1. insert ( value : 4 , for : 4 )
131+ t1. insert ( value : 5 , for : 5 )
132+ t1. insert ( value : 5 , for : 5 )
133+ t1. insert ( value : 6 , for : 6 )
134+
135+ XCTAssert ( 0 == t1. index ( of : 1 ) , " Test failed. " )
136+ XCTAssert ( 5 == t1. index ( of : 6 ) , " Test failed. " )
137+ XCTAssert ( - 1 == t1. index ( of : 100 ) , " Test failed. " )
138138 }
139139
140140 func testIndexOfNonUniqueKeys( ) {
141141 var t1 = RedBlackTree < Int , Int > ( )
142- t1. insert ( 1 , value : 1 )
143- t1. insert ( 2 , value : 2 )
144- t1. insert ( 3 , value : 3 )
145- t1. insert ( 4 , value : 4 )
146- t1. insert ( 5 , value : 5 )
147- t1. insert ( 5 , value : 5 )
148- t1. insert ( 6 , value : 6 )
149-
150- XCTAssert ( 0 == t1. indexOf ( 1 ) , " Test failed. " )
151- XCTAssert ( 6 == t1. indexOf ( 6 ) , " Test failed. " )
152- XCTAssert ( - 1 == t1. indexOf ( 100 ) , " Test failed. " )
142+ t1. insert ( value : 1 , for : 1 )
143+ t1. insert ( value : 2 , for : 2 )
144+ t1. insert ( value : 3 , for : 3 )
145+ t1. insert ( value : 4 , for : 4 )
146+ t1. insert ( value : 5 , for : 5 )
147+ t1. insert ( value : 5 , for : 5 )
148+ t1. insert ( value : 6 , for : 6 )
149+
150+ XCTAssert ( 0 == t1. index ( of : 1 ) , " Test failed. " )
151+ XCTAssert ( 6 == t1. index ( of : 6 ) , " Test failed. " )
152+ XCTAssert ( - 1 == t1. index ( of : 100 ) , " Test failed. " )
153153 }
154154
155155 func testOperands( ) {
@@ -161,7 +161,7 @@ class RedBlackTreeTests: XCTestCase {
161161 t2. insert ( ( 5 , 5 ) , ( 6 , 6 ) , ( 7 , 7 ) , ( 8 , 8 ) )
162162 XCTAssert ( 4 == t2. count, " Test failed. " )
163163
164- var t3 = t1 + t2
164+ let t3 = t1 + t2
165165 XCTAssert ( 8 == t3. count, " Test failed. " )
166166
167167 XCTAssert ( t1 != t2, " Test failed. " )
0 commit comments