@@ -46,7 +46,7 @@ class StorageNonCrudTests: XCTestCase {
4646 try storage
. replace ( Employee ( id
: 6 , firstname
: " Michael " , lastname
: " Mitchell " , title
: " IT Manager " , email
: " [email protected] " ) ) 4747 try storage
. replace ( Employee ( id
: 7 , firstname
: " Robert " , lastname
: " King " , title
: " IT Staff " , email
: " [email protected] " ) ) 4848 try storage
. replace ( Employee ( id
: 8 , firstname
: " Laura " , lastname
: " Callahan " , title
: " IT Staff " , email
: " [email protected] " ) ) 49-
49+
5050 apiProvider. resetCalls ( )
5151 try section ( " one column " , routine: {
5252 let ids : [ Int ] = try storage. select ( \Employee . id, from ( Employee . self) )
@@ -139,6 +139,68 @@ class StorageNonCrudTests: XCTestCase {
139139 . init( id: 37 , callType: . sqlite3Close( . ignore) )
140140 ] )
141141 } )
142+ try section ( " three columns " , routine: {
143+ let rows : [ ( Int , String , String ) ] = try storage. select ( \Employee . id, \Employee . firstname, \Employee . lastname, from ( Employee . self) )
144+ let expected : [ ( Int , String , String ) ] = [
145+ ( 1 , " Andrew " , " Adams " ) ,
146+ ( 2 , " Nancy " , " Edwards " ) ,
147+ ( 3 , " Jane " , " Peacock " ) ,
148+ ( 4 , " Margaret " , " Park " ) ,
149+ ( 5 , " Steve " , " Johnson " ) ,
150+ ( 6 , " Michael " , " Mitchell " ) ,
151+ ( 7 , " Robert " , " King " ) ,
152+ ( 8 , " Laura " , " Callahan " ) ,
153+ ]
154+ XCTAssert ( compareUnordered ( rows, expected, { $0. 0 == $1. 0 && $0. 1 == $1. 1 && $0. 2 == $1. 2 } ) )
155+ XCTAssertEqual ( apiProvider. calls, [
156+ . init( id: 0 , callType: . sqlite3Open( filename, . ignore) ) ,
157+ . init( id: 1 , callType: . sqlite3PrepareV2( . ignore, " SELECT employees. \" id \" , employees. \" firstname \" , employees. \" lastname \" FROM employees " , - 1 , . ignore, nil ) ) ,
158+ . init( id: 2 , callType: . sqlite3Step( . ignore) ) ,
159+ . init( id: 3 , callType: . sqlite3ColumnCount( . ignore) ) ,
160+ . init( id: 4 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
161+ . init( id: 5 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
162+ . init( id: 6 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
163+ . init( id: 7 , callType: . sqlite3Step( . ignore) ) ,
164+ . init( id: 8 , callType: . sqlite3ColumnCount( . ignore) ) ,
165+ . init( id: 9 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
166+ . init( id: 10 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
167+ . init( id: 11 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
168+ . init( id: 12 , callType: . sqlite3Step( . ignore) ) ,
169+ . init( id: 13 , callType: . sqlite3ColumnCount( . ignore) ) ,
170+ . init( id: 14 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
171+ . init( id: 15 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
172+ . init( id: 16 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
173+ . init( id: 17 , callType: . sqlite3Step( . ignore) ) ,
174+ . init( id: 18 , callType: . sqlite3ColumnCount( . ignore) ) ,
175+ . init( id: 19 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
176+ . init( id: 20 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
177+ . init( id: 21 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
178+ . init( id: 22 , callType: . sqlite3Step( . ignore) ) ,
179+ . init( id: 23 , callType: . sqlite3ColumnCount( . ignore) ) ,
180+ . init( id: 24 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
181+ . init( id: 25 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
182+ . init( id: 26 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
183+ . init( id: 27 , callType: . sqlite3Step( . ignore) ) ,
184+ . init( id: 28 , callType: . sqlite3ColumnCount( . ignore) ) ,
185+ . init( id: 29 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
186+ . init( id: 30 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
187+ . init( id: 31 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
188+ . init( id: 32 , callType: . sqlite3Step( . ignore) ) ,
189+ . init( id: 33 , callType: . sqlite3ColumnCount( . ignore) ) ,
190+ . init( id: 34 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
191+ . init( id: 35 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
192+ . init( id: 36 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
193+ . init( id: 37 , callType: . sqlite3Step( . ignore) ) ,
194+ . init( id: 38 , callType: . sqlite3ColumnCount( . ignore) ) ,
195+ . init( id: 39 , callType: . sqlite3ColumnInt( . ignore, 0 ) ) ,
196+ . init( id: 40 , callType: . sqlite3ColumnText( . ignore, 1 ) ) ,
197+ . init( id: 41 , callType: . sqlite3ColumnText( . ignore, 2 ) ) ,
198+ . init( id: 42 , callType: . sqlite3Step( . ignore) ) ,
199+ . init( id: 43 , callType: . sqlite3ColumnCount( . ignore) ) ,
200+ . init( id: 44 , callType: . sqlite3Finalize( . ignore) ) ,
201+ . init( id: 45 , callType: . sqlite3Close( . ignore) ) ,
202+ ] )
203+ } )
142204 } )
143205 }
144206
0 commit comments