Skip to content

Commit 667a8af

Browse files
rstacpooleclaude
andcommitted
Use literal kelvin value for 1°F temperature assertion
The 1°F assertion computed its expected kelvin value algorithmically ((273.15 - (32 * 5.0 / 9.0)) + 5.0 / 9.0) — a mixed Int/Double expression heavy enough to exceed the Swift type-checker's per-expression budget on the macOS CI toolchain. Replace it with the equivalent literal kelvin value (255.927778 K, which converts back to 1°F well within the test's 0.0001 tolerance), removing the computation entirely. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 78ffb04 commit 667a8af

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Tests/UnitsTests/DefinitionTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ class DefinitionTests: XCTestCase {
263263
// Base unit: kelvin
264264
XCTAssertEqual(Measurement("1K"), 1.measured(in: .kelvin))
265265
try XCTAssertEqual(Measurement("1°C"), (273.15.measured(in: .kelvin) + 1.measured(in: .kelvin)).convert(to: .celsius))
266-
try XCTAssertEqual(XCTUnwrap(Measurement("1°F")), try ((273.15 - (32 * 5.0 / 9.0)).measured(in: .kelvin) + (5.0 / 9.0).measured(in: .kelvin)).convert(to: .fahrenheit), accuracy: 0.0001)
266+
// 1°F expressed in kelvin, within the test's margin of error: (1 - 32) * 5 / 9 + 273.15
267+
try XCTAssertEqual(XCTUnwrap(Measurement("1°F")), 255.927778.measured(in: .kelvin).convert(to: .fahrenheit), accuracy: 0.0001)
267268
try XCTAssertEqual(Measurement("1°R"), (5.0 / 9.0).measured(in: .kelvin).convert(to: .rankine))
268269
}
269270

0 commit comments

Comments
 (0)