Ampere icon indicating copy to clipboard operation
Ampere copied to clipboard

UnitVolume tests fail on Linux

Open ole opened this issue 6 years ago • 1 comments

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.

ole avatar Nov 07 '19 10:11 ole

Reported to bugs.swift.org: SR-11766.

PR: https://github.com/apple/swift-corelibs-foundation/pull/2561

ole avatar Nov 12 '19 00:11 ole