-
-
Notifications
You must be signed in to change notification settings - Fork 6k
/
Copy pathChartUtilsTests.swift
68 lines (48 loc) · 1.64 KB
/
ChartUtilsTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@testable import DGCharts
import XCTest
class ChartUtilsTests: 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 testDecimalWithNaN() {
let number = Double.nan
let actual = number.decimalPlaces
let expected = 0
XCTAssertEqual(expected, actual)
}
func testDecimalWithInfinite() {
let number = Double.infinity
let actual = number.decimalPlaces
let expected = 0
XCTAssertEqual(expected, actual)
}
func testDecimalWithZero() {
let number = 0.0
let actual = number.decimalPlaces
let expected = 0
XCTAssertEqual(expected, actual)
}
func testDecimalWithMaxValue() {
let number = Double.greatestFiniteMagnitude
let actual = number.decimalPlaces
let expected = 0
XCTAssertEqual(expected, actual)
}
func testDecimalWithMinValue() {
let number = Double.leastNormalMagnitude
let actual = number.decimalPlaces
let expected = 310 // Don't think this is supposed to be this value maybe 0?
XCTAssertEqual(expected, actual)
}
func testDecimalWithNormalValue() {
let number = 13.123123
let actual = number.decimalPlaces
let expected = 1 // Don't think this is supposed to be this value maybe 6?
XCTAssertEqual(expected, actual)
}
}