Ampere
Ampere copied to clipboard
UnitVolume tests fail on Linux
This test fails on Linux:
func testWithNonBaseUnits() {
let factor1 = Measurement(value: 100, unit: UnitArea.squareCentimeters)
let factor2 = Measurement(value: 10, unit: UnitLength.millimeters)
let actual: Measurement<UnitVolume> = factor1 * factor2
let expected = Measurement(value: 100, unit: UnitVolume.cubicCentimeters)
AmpereTest.assertEqual(actual, expected)
}
XCTAssertEqual failed: ("0.0001 m³") is not equal to ("0.001 m³") - "0.0001 m³" is not equal to "100.0 cm³"
This is due to a bug in swift-corelibs-foundation. Some of the conversion coefficients for UnitVolume are wrong.
Reported to bugs.swift.org: SR-11766.
PR: https://github.com/apple/swift-corelibs-foundation/pull/2561