comparison SimoleonTests/SimoleonTests.swift @ 146:f10b0e188905 v1.3.1

Merge pull request #16 from DennisTechnologies/development Release v1.3.1 committer: GitHub <noreply@github.com>
author Dennis C. M. <dennis@denniscm.com>
date Tue, 17 Aug 2021 22:14:58 +0100
parents cd801949925b
children bdedd0cc6cd1
comparison
equal deleted inserted replaced
117:a6df002a0a5c 146:f10b0e188905
15 } 15 }
16 16
17 override func tearDownWithError() throws { 17 override func tearDownWithError() throws {
18 // Put teardown code here. This method is called after the invocation of each test method in the class. 18 // Put teardown code here. This method is called after the invocation of each test method in the class.
19 } 19 }
20
21 func testMakeConversion() {
22 // Given
23 let testAmounts = ["iawuh", Int(100), Float(3450.30), Double(12530.43435)] as [Any]
24
25 for var amountToConvert in testAmounts {
26 // When
27 if let amountToConvert = amountToConvert as? Double {
28 // Then
29 XCTAssertEqual(amountToConvert, amountToConvert, "Amount to convert is not returning correctly")
30 } else {
31 // Then
32 amountToConvert = Int(0)
33 XCTAssertEqual(amountToConvert as! Int, 0, "Amount to convert must be 0")
34 }
35 }
36 }
37
38 func testFormatCurrency() {
39 // Given
40 let availableIdentifiers = Locale.availableIdentifiers
41 let amount: NSDecimalNumber = 1000
42
43 for identifier in availableIdentifiers {
44 let locale = Locale(identifier: identifier)
45
46 let formatter = NumberFormatter()
47 formatter.locale = locale
48 formatter.numberStyle = .currency
49
50 XCTAssertTrue((formatter.string(from: amount as NSNumber) != nil))
51 }
52
53 }
54 20
55 func testPerformanceExample() throws { 21 func testPerformanceExample() throws {
56 // This is an example of a performance test case. 22 // This is an example of a performance test case.
57 self.measure { 23 self.measure {
58 // Put the code you want to measure the time of here. 24 // Put the code you want to measure the time of here.