Skip to content

Commit

Permalink
Add testMaxEntryCountSet
Browse files Browse the repository at this point in the history
  • Loading branch information
Tho Do authored and mmazzei committed Feb 1, 2023
1 parent 684cc8a commit 25c94a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tests/ChartsTests/ChartDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ class ChartDataTests: XCTestCase {
XCTAssertTrue(data.dataSet(forLabel: SetLabels.badLabel, ignorecase: true) == nil)
XCTAssertTrue(data.dataSet(forLabel: SetLabels.badLabel, ignorecase: false) == nil)
}

func testMaxEntryCountSet() throws {
let dataSet1 = BarChartDataSet(entries: (0 ..< 4).map { BarChartDataEntry(x: Double($0), y: Double($0)) },
label: "data-set-1")
let dataSet2 = BarChartDataSet(entries: (0 ..< 3).map { BarChartDataEntry(x: Double($0), y: Double($0)) },
label: "data-set-2")
let dataSet3 = BarChartDataSet(entries: [BarChartDataEntry(x: 0, y: 0)],
label: "data-set-3")
let data = BarChartData(dataSets: [dataSet1, dataSet2, dataSet3])

let maxEntryCountSet = try XCTUnwrap(data.maxEntryCountSet as? BarChartDataSet)

XCTAssertEqual(maxEntryCountSet, dataSet1)
}
}

0 comments on commit 25c94a7

Please sign in to comment.