-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
122 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class BarChartTests: XCTestCase { | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class GroupedBarChartTests: XCTestCase { | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class StackedBarChartTests: XCTestCase { | ||
|
234 changes: 117 additions & 117 deletions
234
Tests/SwiftUIChartsTests/LineCharts/LineChartPathTests.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 |
---|---|---|
@@ -1,117 +1,117 @@ | ||
//import XCTest | ||
|
||
//@testable import SwiftUICharts | ||
|
||
//final class LineChartPathTests: XCTestCase { | ||
// | ||
// let chartData = LineChartData(dataSets: LineDataSet(dataPoints: [ | ||
// LineChartDataPoint(value: 0), | ||
// LineChartDataPoint(value: 25), | ||
// LineChartDataPoint(value: 50), | ||
// LineChartDataPoint(value: 75), | ||
// LineChartDataPoint(value: 100) | ||
// ])) | ||
// | ||
// let rect : CGRect = CGRect(x: 0, y: 0, width: 100, height: 100) | ||
// let touchLocation: CGPoint = CGPoint(x: 25, y: 25) | ||
// | ||
// func testGetIndicatorLocation() { | ||
// | ||
// let test = LineChartData.getIndicatorLocation(rect : rect, | ||
// dataPoints : chartData.dataSets.dataPoints, | ||
// touchLocation : touchLocation, | ||
// lineType : .line, | ||
// minValue : chartData.minValue, | ||
// range : chartData.range, | ||
// ignoreZero : false) | ||
// | ||
// XCTAssertEqual(test.x, 25, accuracy: 0.1) | ||
// XCTAssertEqual(test.y, 75, accuracy: 0.1) | ||
// } | ||
// | ||
// | ||
// func testGetPercentageOfPath() { | ||
// | ||
// let path = Path.straightLine(rect : rect, | ||
// dataPoints : chartData.dataSets.dataPoints, | ||
// minValue : chartData.minValue, | ||
// range : chartData.range, | ||
// isFilled : false) | ||
// | ||
// let test = LineChartData.getPercentageOfPath(path: path, touchLocation: touchLocation) | ||
// | ||
// XCTAssertEqual(test, 0.25, accuracy: 0.1) | ||
// } | ||
// | ||
// func testGetTotalLength() { | ||
// | ||
// let path = Path.straightLine(rect : rect, | ||
// dataPoints : chartData.dataSets.dataPoints, | ||
// minValue : chartData.minValue, | ||
// range : chartData.range, | ||
// isFilled : false) | ||
// | ||
// let test = LineChartData.getTotalLength(of: path) | ||
// | ||
// XCTAssertEqual(test, 141.42, accuracy: 0.01) | ||
// } | ||
// | ||
// func testGetLengthToTouch() { | ||
// | ||
// let path = Path.straightLine(rect : rect, | ||
// dataPoints : chartData.dataSets.dataPoints, | ||
// minValue : chartData.minValue, | ||
// range : chartData.range, | ||
// isFilled : false) | ||
// | ||
// let test = LineChartData.getLength(to: touchLocation, on: path) | ||
// | ||
// XCTAssertEqual(test, 35.35, accuracy: 0.01) | ||
// } | ||
// | ||
// func testRelativePoint() { | ||
// | ||
// let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
// let pointTwo = CGPoint(x: 100, y: 100) | ||
// | ||
// let test = LineChartData.relativePoint(from: pointOne, to: pointTwo, touchX: touchLocation.x) | ||
// | ||
// XCTAssertEqual(test.x, 25, accuracy: 0.01) | ||
// XCTAssertEqual(test.y, 25, accuracy: 0.01) | ||
// } | ||
// | ||
// func testDistanceToTouch() { | ||
// | ||
// let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
// let pointTwo = CGPoint(x: 100, y: 100) | ||
// | ||
// let test = LineChartData.distanceToTouch(from: pointOne, to: pointTwo, touchX: touchLocation.x) | ||
// | ||
// XCTAssertEqual(test, 35.355, accuracy: 0.01) | ||
// } | ||
// | ||
// func testDistance() { | ||
// | ||
// let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
// let pointTwo = CGPoint(x: 100, y: 100) | ||
// | ||
// let test = LineChartData.distance(from: pointOne, to: pointTwo) | ||
// | ||
// XCTAssertEqual(test, 141.421356237309, accuracy: 0.01) | ||
// } | ||
// | ||
// func testGetLocationOnPath() { | ||
// | ||
// let path = Path.straightLine(rect : rect, | ||
// dataPoints : chartData.dataSets.dataPoints, | ||
// minValue : chartData.minValue, | ||
// range : chartData.range, | ||
// isFilled : false) | ||
// | ||
// | ||
// let test = LineChartData.locationOnPath(0.5, path) | ||
// | ||
// XCTAssertEqual(test.x, 50, accuracy: 0.1) | ||
// XCTAssertEqual(test.y, 50, accuracy: 0.1) | ||
// } | ||
//} | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class LineChartPathTests: XCTestCase { | ||
|
||
let chartData = LineChartData(dataSets: LineDataSet(dataPoints: [ | ||
LineChartDataPoint(value: 0), | ||
LineChartDataPoint(value: 25), | ||
LineChartDataPoint(value: 50), | ||
LineChartDataPoint(value: 75), | ||
LineChartDataPoint(value: 100) | ||
])) | ||
|
||
let rect : CGRect = CGRect(x: 0, y: 0, width: 100, height: 100) | ||
let touchLocation: CGPoint = CGPoint(x: 25, y: 25) | ||
|
||
func testGetIndicatorLocation() { | ||
|
||
let test = LineChartData.getIndicatorLocation(rect : rect, | ||
dataPoints : chartData.dataSets.dataPoints, | ||
touchLocation : touchLocation, | ||
lineType : .line, | ||
minValue : chartData.minValue, | ||
range : chartData.range, | ||
ignoreZero : false) | ||
|
||
XCTAssertEqual(test.x, 25, accuracy: 0.1) | ||
XCTAssertEqual(test.y, 75, accuracy: 0.1) | ||
} | ||
|
||
|
||
func testGetPercentageOfPath() { | ||
|
||
let path = Path.straightLine(rect : rect, | ||
dataPoints : chartData.dataSets.dataPoints, | ||
minValue : chartData.minValue, | ||
range : chartData.range, | ||
isFilled : false) | ||
|
||
let test = LineChartData.getPercentageOfPath(path: path, touchLocation: touchLocation) | ||
|
||
XCTAssertEqual(test, 0.25, accuracy: 0.1) | ||
} | ||
|
||
func testGetTotalLength() { | ||
|
||
let path = Path.straightLine(rect : rect, | ||
dataPoints : chartData.dataSets.dataPoints, | ||
minValue : chartData.minValue, | ||
range : chartData.range, | ||
isFilled : false) | ||
|
||
let test = LineChartData.getTotalLength(of: path) | ||
|
||
XCTAssertEqual(test, 141.42, accuracy: 0.01) | ||
} | ||
|
||
func testGetLengthToTouch() { | ||
|
||
let path = Path.straightLine(rect : rect, | ||
dataPoints : chartData.dataSets.dataPoints, | ||
minValue : chartData.minValue, | ||
range : chartData.range, | ||
isFilled : false) | ||
|
||
let test = LineChartData.getLength(to: touchLocation, on: path) | ||
|
||
XCTAssertEqual(test, 35.35, accuracy: 0.01) | ||
} | ||
|
||
func testRelativePoint() { | ||
|
||
let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
let pointTwo = CGPoint(x: 100, y: 100) | ||
|
||
let test = LineChartData.relativePoint(from: pointOne, to: pointTwo, touchX: touchLocation.x) | ||
|
||
XCTAssertEqual(test.x, 25, accuracy: 0.01) | ||
XCTAssertEqual(test.y, 25, accuracy: 0.01) | ||
} | ||
|
||
func testDistanceToTouch() { | ||
|
||
let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
let pointTwo = CGPoint(x: 100, y: 100) | ||
|
||
let test = LineChartData.distanceToTouch(from: pointOne, to: pointTwo, touchX: touchLocation.x) | ||
|
||
XCTAssertEqual(test, 35.355, accuracy: 0.01) | ||
} | ||
|
||
func testDistance() { | ||
|
||
let pointOne = CGPoint(x: 0.0, y: 0.0) | ||
let pointTwo = CGPoint(x: 100, y: 100) | ||
|
||
let test = LineChartData.distance(from: pointOne, to: pointTwo) | ||
|
||
XCTAssertEqual(test, 141.421356237309, accuracy: 0.01) | ||
} | ||
|
||
func testGetLocationOnPath() { | ||
|
||
let path = Path.straightLine(rect : rect, | ||
dataPoints : chartData.dataSets.dataPoints, | ||
minValue : chartData.minValue, | ||
range : chartData.range, | ||
isFilled : false) | ||
|
||
|
||
let test = LineChartData.locationOnPath(0.5, path) | ||
|
||
XCTAssertEqual(test.x, 50, accuracy: 0.1) | ||
XCTAssertEqual(test.y, 50, accuracy: 0.1) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class LineChartTests: XCTestCase { | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import XCTest | ||
import SwiftUI | ||
@testable import SwiftUICharts | ||
|
||
final class MultiLineChartTest: XCTestCase { | ||
|