From 667a8afdbdbdceac6161ad18ce7eefa9b8689381 Mon Sep 17 00:00:00 2001 From: Richard Stacpoole Date: Sat, 27 Jun 2026 10:03:50 +1000 Subject: [PATCH] =?UTF-8?q?Use=20literal=20kelvin=20value=20for=201=C2=B0F?= =?UTF-8?q?=20temperature=20assertion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Tests/UnitsTests/DefinitionTests.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/UnitsTests/DefinitionTests.swift b/Tests/UnitsTests/DefinitionTests.swift index e0bdd44..5c271e7 100644 --- a/Tests/UnitsTests/DefinitionTests.swift +++ b/Tests/UnitsTests/DefinitionTests.swift @@ -263,7 +263,8 @@ class DefinitionTests: XCTestCase { // Base unit: kelvin XCTAssertEqual(Measurement("1K"), 1.measured(in: .kelvin)) try XCTAssertEqual(Measurement("1°C"), (273.15.measured(in: .kelvin) + 1.measured(in: .kelvin)).convert(to: .celsius)) - 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) + // 1°F expressed in kelvin, within the test's margin of error: (1 - 32) * 5 / 9 + 273.15 + try XCTAssertEqual(XCTUnwrap(Measurement("1°F")), 255.927778.measured(in: .kelvin).convert(to: .fahrenheit), accuracy: 0.0001) try XCTAssertEqual(Measurement("1°R"), (5.0 / 9.0).measured(in: .kelvin).convert(to: .rankine)) }