-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for: - UIViewTintAdjustmentModeConverter - CGRectConverter - BoolConverter
- Loading branch information
Wim Haanstra
committed
Jan 18, 2016
1 parent
608e4b7
commit 976f71e
Showing
4 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// BoolConverterTest.swift | ||
// pixelbits | ||
// | ||
// Created by Wim Haanstra on 18/01/16. | ||
// Copyright © 2016 Wim Haanstra. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import pixelbits | ||
|
||
class BoolConverterTest: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
super.tearDown() | ||
} | ||
|
||
func testValidBoolValue() { | ||
|
||
XCTAssertEqual(BooleanConverter.fromString("true"), true) | ||
XCTAssertEqual(BooleanConverter.fromString("yes"), true) | ||
XCTAssertEqual(BooleanConverter.fromString("false"), false) | ||
XCTAssertEqual(BooleanConverter.fromString("no"), false) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// CGRectConverterTest.swift | ||
// pixelbits | ||
// | ||
// Created by Wim Haanstra on 18/01/16. | ||
// Copyright © 2016 Wim Haanstra. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import pixelbits | ||
|
||
class CGRectConverterTest: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
super.tearDown() | ||
} | ||
|
||
func testSingleValue() { | ||
|
||
XCTAssertEqual(CGRectConverter.fromString("rect(4)"), NSValue(CGRect: CGRectMake(4, 4, 4, 4))) | ||
XCTAssertEqual(CGRectConverter.fromString("rect(4.25)"), NSValue(CGRect: CGRectMake(4.25, 4.25, 4.25, 4.25))) | ||
|
||
} | ||
|
||
func testDoubleValue() { | ||
XCTAssertEqual(CGRectConverter.fromString("rect(4, 5)"), NSValue(CGRect: CGRectMake(4, 5, 4, 5))) | ||
XCTAssertEqual(CGRectConverter.fromString("rect(4.25, 2.5)"), NSValue(CGRect: CGRectMake(4.25, 2.5, 4.25, 2.5))) | ||
} | ||
|
||
func testFull() { | ||
XCTAssertEqual(CGRectConverter.fromString("rect(4, 5,6, 7)"), NSValue(CGRect: CGRectMake(4, 5, 6, 7))) | ||
XCTAssertEqual(CGRectConverter.fromString("rect(4.25, 5.30,6.4, 7.5)"), NSValue(CGRect: CGRectMake(4.25, 5.3, 6.4, 7.5))) | ||
} | ||
|
||
func testInvalid() { | ||
XCTAssertNil(CGRectConverter.fromString("rect(stringvalue)")) | ||
XCTAssertNil(CGRectConverter.fromString("rect(4,stringvalue)")) | ||
XCTAssertNil(CGRectConverter.fromString("rect(4,4,4)")) | ||
XCTAssertNil(CGRectConverter.fromString("rect(4,stringvalue,4)")) | ||
|
||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
pixelbitsTests/UIViewTintAdjustmentModeConverterTest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// UIViewTintAdjustmentModeConverterTest.swift | ||
// pixelbits | ||
// | ||
// Created by Wim Haanstra on 18/01/16. | ||
// Copyright © 2016 Wim Haanstra. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import pixelbits | ||
|
||
class UIViewTintAdjustmentModeConverterTest: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
super.tearDown() | ||
} | ||
|
||
func testFromString() { | ||
XCTAssertEqual(UIViewTintAdjustmentModeConverter.fromString("UIViewTintAdjustmentModeAutomatic"), UIViewTintAdjustmentMode.Automatic) | ||
XCTAssertEqual(UIViewTintAdjustmentModeConverter.fromString("UIViewTintAdjustmentModeNormal"), UIViewTintAdjustmentMode.Normal) | ||
XCTAssertEqual(UIViewTintAdjustmentModeConverter.fromString("UIViewTintAdjustmentModeDimmed"), UIViewTintAdjustmentMode.Dimmed) | ||
} | ||
|
||
} |