Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentneo committed Mar 19, 2022
1 parent f33faec commit 192860d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/DeviceModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ class DeviceModelTests: XCTestCase {
}

func testDeviceModelIPhone13ProMax() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone14,6"))
XCTAssert(deviceModel == .iPhoneSE3 , "DeviceModel - .iPhoneSE3 is failing")
}

func testDeviceModelIPhoneSE3() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone14,3"))
XCTAssert(deviceModel == .iPhone13ProMax , "DeviceModel - .iPhone13ProMax is failing")
}
Expand Down Expand Up @@ -392,6 +397,12 @@ class DeviceModelTests: XCTestCase {
XCTAssert(deviceModel1 == .iPadAir3 && deviceModel2 == .iPadAir3 , "DeviceModel - .iPadAir3 is failing")
}

func testDeviceModelIPadAir5() {
let deviceModel1 = DeviceModel(identifier: Identifier("iPad13,16"))
let deviceModel2 = DeviceModel(identifier: Identifier("iPad13,17"))
XCTAssert(deviceModel1 == .iPadAir5 && deviceModel2 == .iPadAir5 , "DeviceModel - .iPadAir5 is failing")
}

// MARK: - iPod Device Model tests

func testDeviceModelIPodTouchFirstGen() {
Expand Down
12 changes: 12 additions & 0 deletions Tests/IdentifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class IdentifierTests: XCTestCase {

// MARK: - iPhone String Description tests

func testDisplayStringiPhone14v6() {
XCTAssert(Identifier("iPhone14,6").description == "iPhone SE (3rd Gen)", "iPhone14,6 is failing to produce a common device model string")
}

func testDisplayStringiPhone14v5() {
XCTAssert(Identifier("iPhone14,5").description == "iPhone 13", "iPhone14,5 is failing to produce a common device model string")
}
Expand Down Expand Up @@ -286,6 +290,14 @@ class IdentifierTests: XCTestCase {
func testDisplayStringiPad14v1() {
XCTAssert(Identifier("iPad14,1").description == "6th Gen iPad mini (8.3 inch, Wi-Fi)", "iPad14,1 is failing to produce a common device model string")
}

func testDisplayStringiPad13v16() {
XCTAssert(Identifier("iPad13,16").description == "5th Gen iPad Air (Wi-Fi)", "iPad13,16 is failing to produce a common device model string")
}
func testDisplayStringiPad13v17() {
XCTAssert(Identifier("iPad13,17").description == "5th Gen iPad Air (Wi-Fi+5G)", "iPad13,17 is failing to produce a common device model string")
}

func testDisplayStringiPad13v11() {
XCTAssert(Identifier("iPad13,11").description == "5th Gen iPad Pro (12.9 inch, Wi-Fi+5G, 16GB RAM)", "iPad13,11 is failing to produce a common device model string")
}
Expand Down

0 comments on commit 192860d

Please sign in to comment.