@@ -44,6 +44,7 @@ class XMLParsingTests: XCTestCase {
4444 let data : Data ?
4545 let date : Date ?
4646 let bool : Bool ?
47+ let int : Int ?
4748 let double : Double ?
4849
4950 enum CodingKeys : String , CodingKey {
@@ -52,6 +53,7 @@ class XMLParsingTests: XCTestCase {
5253 case data = " Data "
5354 case date = " Date "
5455 case bool = " Bool "
56+ case int = " Int "
5557 case double = " Double "
5658 }
5759 }
@@ -126,6 +128,7 @@ class XMLParsingTests: XCTestCase {
126128 <Data>ZGF0YTE=</Data>
127129 <Date>1534352914</Date>
128130 <Bool>true</Bool>
131+ <Int>77</Int>
129132 <Double>45.345</Double>
130133 </Metadata>
131134 </Response>
@@ -147,6 +150,7 @@ class XMLParsingTests: XCTestCase {
147150
148151 XCTAssertEqual ( " data1 " , String ( data: response. metadata. data!, encoding: . utf8) ) // decode the data
149152 XCTAssertEqual ( Date ( timeIntervalSince1970: 1534352914 ) , response. metadata. date) // decode the date
153+ XCTAssertEqual ( 77 , response. metadata. int) // decode the integer
150154 XCTAssertEqual ( true , response. metadata. bool) // decode the boolean
151155
152156 let double = response. metadata. double!
@@ -252,6 +256,7 @@ class XMLParsingTests: XCTestCase {
252256 <Data></Data>
253257 <Date></Date>
254258 <Bool></Bool>
259+ <Int></Int>
255260 <Double></Double>
256261 </Metadata>
257262 </Response>
@@ -275,6 +280,7 @@ class XMLParsingTests: XCTestCase {
275280 XCTAssertNil ( response. metadata. data) // the Data tag is empty and optional
276281 XCTAssertNil ( response. metadata. date) // the Date tag is empty and optional
277282 XCTAssertNil ( response. metadata. bool) // the Bool tag is empty and optional
283+ XCTAssertNil ( response. metadata. int) // the Int tag is empty and optional
278284 XCTAssertNil ( response. metadata. double) // the Double tag is empty and optional
279285 }
280286
@@ -325,6 +331,7 @@ class XMLParsingTests: XCTestCase {
325331 <Data />
326332 <Date />
327333 <Bool />
334+ <Int />
328335 <Double />
329336 </Metadata>
330337 </Response>
@@ -348,6 +355,7 @@ class XMLParsingTests: XCTestCase {
348355 XCTAssertNil ( response. metadata. data) // the Data tag is empty and optional
349356 XCTAssertNil ( response. metadata. date) // the Date tag is empty and optional
350357 XCTAssertNil ( response. metadata. bool) // the Bool tag is empty and optional
358+ XCTAssertNil ( response. metadata. int) // the Int tag is empty and optional
351359 XCTAssertNil ( response. metadata. double) // the Double tag is empty and optional
352360 }
353361
0 commit comments