-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3002 from jjatie/equatable-fixed
Resubmit of #2730
- Loading branch information
Showing
7 changed files
with
94 additions
and
175 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
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
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
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,45 @@ | ||
// | ||
// EquatableTests.swift | ||
// Charts | ||
// | ||
// Created by Jacob Christie on 2017-11-13. | ||
// | ||
|
||
import XCTest | ||
@testable import Charts | ||
|
||
class EquatableTests: XCTestCase { | ||
func testChartDataEntryEquality() { | ||
let image = UIImage() | ||
let data = NSObject() | ||
let entry1 = ChartDataEntry(x: 5, y: 3, icon: image, data: data) | ||
let entry2 = ChartDataEntry(x: 5, y: 3, icon: image, data: data) | ||
|
||
XCTAssertTrue(entry1 == entry2) | ||
} | ||
|
||
func testChartDataEntryInequality() { | ||
let image = UIImage() | ||
let data1 = NSObject() | ||
let data2 = NSObject() | ||
let entry1 = ChartDataEntry(x: 5, y: 3, icon: image, data: data1) | ||
let entry2 = ChartDataEntry(x: 5, y: 3, icon: image, data: data2) | ||
|
||
XCTAssertFalse(entry1 == entry2) | ||
} | ||
|
||
func testHighlightEquality() { | ||
let high1 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .right) | ||
let high2 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .right) | ||
|
||
XCTAssertTrue(high1 == high2) | ||
} | ||
|
||
func testHighlightInequality() { | ||
let high1 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 8, axis: .left) | ||
let high2 = Highlight(x: 5, y: 3, xPx: 1, yPx: -1, dataSetIndex: 8, stackIndex: 9, axis: .left) | ||
|
||
XCTAssertFalse(high1 == high2) | ||
} | ||
} | ||
|