-
-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and docs for measurement unit
- Loading branch information
1 parent
6eceb69
commit c478807
Showing
4 changed files
with
98 additions
and
2 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
62 changes: 62 additions & 0 deletions
62
Tests/SentryTests/Protocol/SentryMeasurementUnitTests.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,62 @@ | ||
import XCTest | ||
|
||
final class SentryMeasurementUnitTests: XCTestCase { | ||
|
||
func testCustomUnit() { | ||
let unit = "custom" | ||
let sut = MeasurementUnit(unit: unit) | ||
|
||
XCTAssertEqual(unit, sut.unit) | ||
} | ||
|
||
func testUnitNone() { | ||
XCTAssertEqual("", MeasurementUnit.none.unit) | ||
} | ||
|
||
func testCopy() { | ||
let unit = "custom" | ||
let sut = MeasurementUnit(unit: unit).copy() as! MeasurementUnit | ||
|
||
XCTAssertEqual(unit, sut.unit) | ||
} | ||
|
||
func testCopyOfSubclass() { | ||
let unit = "custom" | ||
let sut = MeasurementUnitDuration(unit: unit).copy() as! MeasurementUnitDuration | ||
|
||
XCTAssertEqual(unit, sut.unit) | ||
} | ||
|
||
func testMeasurementUnitDuration() { | ||
XCTAssertEqual("nanosecond", MeasurementUnitDuration.nanosecond.unit) | ||
XCTAssertEqual("microsecond", MeasurementUnitDuration.microsecond.unit) | ||
XCTAssertEqual("millisecond", MeasurementUnitDuration.millisecond.unit) | ||
XCTAssertEqual("second", MeasurementUnitDuration.second.unit) | ||
XCTAssertEqual("minute", MeasurementUnitDuration.minute.unit) | ||
XCTAssertEqual("hour", MeasurementUnitDuration.hour.unit) | ||
XCTAssertEqual("day", MeasurementUnitDuration.day.unit) | ||
XCTAssertEqual("week", MeasurementUnitDuration.week.unit) | ||
} | ||
|
||
func testMeasurementUnitInformation() { | ||
XCTAssertEqual("bit", MeasurementUnitInformation.bit.unit) | ||
XCTAssertEqual("byte", MeasurementUnitInformation.byte.unit) | ||
XCTAssertEqual("kilobyte", MeasurementUnitInformation.kilobyte.unit) | ||
XCTAssertEqual("kibibyte", MeasurementUnitInformation.kibibyte.unit) | ||
XCTAssertEqual("megabyte", MeasurementUnitInformation.megabyte.unit) | ||
XCTAssertEqual("mebibyte", MeasurementUnitInformation.mebibyte.unit) | ||
XCTAssertEqual("gigabyte", MeasurementUnitInformation.gigabyte.unit) | ||
XCTAssertEqual("gibibyte", MeasurementUnitInformation.gibibyte.unit) | ||
XCTAssertEqual("terabyte", MeasurementUnitInformation.terabyte.unit) | ||
XCTAssertEqual("tebibyte", MeasurementUnitInformation.tebibyte.unit) | ||
XCTAssertEqual("petabyte", MeasurementUnitInformation.petabyte.unit) | ||
XCTAssertEqual("pebibyte", MeasurementUnitInformation.pebibyte.unit) | ||
XCTAssertEqual("exabyte", MeasurementUnitInformation.exabyte.unit) | ||
XCTAssertEqual("exbibyte", MeasurementUnitInformation.exbibyte.unit) | ||
} | ||
|
||
func testMeasurementUnitFraction() { | ||
XCTAssertEqual("ratio", MeasurementUnitFraction.ratio.unit) | ||
XCTAssertEqual("percent", MeasurementUnitFraction.percent.unit) | ||
} | ||
} |