Skip to content

Commit

Permalink
Run SwiftFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed Jul 31, 2023
1 parent 4292b2b commit 4389c62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Sources/Parse3339/Parse3339.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public struct Parts {
/// The fractional second value in nanoseconds.
public var nanosecond: Int {
let nanoZeroes: Int = 9
return secondFraction * power10(nanoZeroes - secondFractionDigits)
return self.secondFraction * power10(nanoZeroes - self.secondFractionDigits)
}

/// Time zone in seconds.
Expand Down
28 changes: 14 additions & 14 deletions Tests/Parse3339Tests/Parse3339Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ final class Parse3339Tests: XCTestCase {
XCTAssertEqual(parsed.secondFractionDigits, 1)
XCTAssertEqual(parsed.zone, 0)
XCTAssertEqual(parsed.nanosecond, 200_000_000)
let unixTime = 1688458885.2

let unixTime = 1_688_458_885.2
XCTAssertEqual(parsed.dateComponents.date!.timeIntervalSince1970, unixTime, accuracy: 0.1)
}

func testFullZZoneWithMillisecondsSuccessful() throws {
let s = "2023-07-04T08:21:25.295Z"
let parsed = try XCTUnwrap(parse(s))

XCTAssertEqual(parsed.year, 2023)
XCTAssertEqual(parsed.month, 7)
XCTAssertEqual(parsed.day, 4)
Expand All @@ -120,11 +120,11 @@ final class Parse3339Tests: XCTestCase {
XCTAssertEqual(parsed.secondFractionDigits, 3)
XCTAssertEqual(parsed.zone, 0)
XCTAssertEqual(parsed.nanosecond, 295_000_000)
let unixTime = 1688458885.295

let unixTime = 1_688_458_885.295
XCTAssertEqual(parsed.dateComponents.date!.timeIntervalSince1970, unixTime, accuracy: 0.001)
}

func testFullZZoneWithMicrosecondsSuccessful() throws {
let s = "2023-07-04T08:21:25.295729Z"
let parsed = try XCTUnwrap(parse(s))
Expand All @@ -135,15 +135,15 @@ final class Parse3339Tests: XCTestCase {
XCTAssertEqual(parsed.hour, 8)
XCTAssertEqual(parsed.minute, 21)
XCTAssertEqual(parsed.second, 25)
XCTAssertEqual(parsed.secondFraction, 295729)
XCTAssertEqual(parsed.secondFraction, 295_729)
XCTAssertEqual(parsed.secondFractionDigits, 6)
XCTAssertEqual(parsed.zone, 0)
XCTAssertEqual(parsed.nanosecond, 295_729_000)
let unixTime = 1688458885.295729

let unixTime = 1_688_458_885.295729
XCTAssertEqual(parsed.dateComponents.date!.timeIntervalSince1970, unixTime, accuracy: 0.000001)
}

func testFullZZoneWithNanosecondsSuccessful() throws {
let s = "2023-07-04T08:21:25.295729572Z"
let parsed = try XCTUnwrap(parse(s))
Expand All @@ -154,12 +154,12 @@ final class Parse3339Tests: XCTestCase {
XCTAssertEqual(parsed.hour, 8)
XCTAssertEqual(parsed.minute, 21)
XCTAssertEqual(parsed.second, 25)
XCTAssertEqual(parsed.secondFraction, 295729572)
XCTAssertEqual(parsed.secondFraction, 295_729_572)
XCTAssertEqual(parsed.secondFractionDigits, 9)
XCTAssertEqual(parsed.zone, 0)
XCTAssertEqual(parsed.nanosecond, 295_729_572)
let unixTime = 1688458885.295729572

let unixTime = 1_688_458_885.295729572
XCTAssertEqual(parsed.dateComponents.date!.timeIntervalSince1970, unixTime, accuracy: 0.000000001)
}

Expand Down

0 comments on commit 4389c62

Please sign in to comment.