|
10 | 10 | // |
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 |
|
13 | | -#if canImport(TestSupport) |
14 | | -import TestSupport |
15 | | -#endif |
| 13 | +import Testing |
16 | 14 |
|
17 | 15 | #if canImport(FoundationInternationalization) |
18 | 16 | @testable import FoundationEssentials |
19 | 17 | @testable import FoundationInternationalization |
20 | | -#endif |
21 | | - |
22 | | -#if FOUNDATION_FRAMEWORK |
| 18 | +#elseif FOUNDATION_FRAMEWORK |
23 | 19 | @testable import Foundation |
24 | 20 | #endif |
25 | 21 |
|
26 | | -final class DurationExtensionTests : XCTestCase { |
| 22 | +@Suite("Duration Extension") |
| 23 | +private struct DurationExtensionTests { |
27 | 24 |
|
28 | | - func testRoundingMode() { |
| 25 | + @Test func roundingMode() { |
29 | 26 |
|
30 | | - func verify(_ tests: [Int64], increment: Int64, expected: [FloatingPointRoundingRule: [Int64]], file: StaticString = #filePath, line: UInt = #line) { |
| 27 | + func verify(_ tests: [Int64], increment: Int64, expected: [FloatingPointRoundingRule: [Int64]], sourceLocation: SourceLocation = #_sourceLocation) { |
31 | 28 | let modes: [FloatingPointRoundingRule] = [.down, .up, .towardZero, .awayFromZero, .toNearestOrEven, .toNearestOrAwayFromZero] |
32 | 29 | for mode in modes { |
33 | 30 | var actual: [Duration] = [] |
34 | 31 | for test in tests { |
35 | 32 | actual.append(Duration.seconds(test).rounded(increment: Duration.seconds(increment), rule: mode)) |
36 | 33 | } |
37 | | - XCTAssertEqual(actual, expected[mode]?.map { Duration.seconds($0) }, "\(mode) does not match", file: file, line: line) |
| 34 | + #expect(actual == expected[mode]?.map { Duration.seconds($0) }, "\(mode) does not match", sourceLocation: sourceLocation) |
38 | 35 | } |
39 | 36 | } |
40 | 37 |
|
|
0 commit comments