TestFoundation failures for Test Case 'test_numberWithFloat' & 'test_numberWithDouble'

foundation
#1

The following errors are seen on PPC64LE while building Apple Swift 5 toolchain post changes pulled in commit d99579054bfe43ee3e92cf3e2c4a5357bdc7e0ef [NSNumber: Make comparing NaN with number match Darwin]

	Test Case 'TestNSNumber.test_numberWithFloat' started at 2019-04-01 12:15:56.247
	/home/sar/swift-source/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:868: error: TestNSNumber.test_numberWithFloat : XCTAssertEqual failed: ("9223372039002259456") is not equal to ("9223372036854775808") - 

	Test Case 'TestNSNumber.test_numberWithFloat' failed (0.0 seconds)

	Test Case 'TestNSNumber.test_numberWithDouble' started at 2019-04-01 12:15:56.247
	/home/sar/swift-source/swift-corelibs-foundation/TestFoundation/TestNSNumber.swift:913: error: TestNSNumber.test_numberWithDouble : XCTAssertEqual failed: ("9223372039002259456") is not equal to ("9223372036854775808") - 

	Test Case 'TestNSNumber.test_numberWithDouble' failed (0.0 seconds)

Can anyone please explain what these 2 tests are trying to test out? Since TestFoundation was working fine on PPC64LE before the above commit, is this a new feature added? If so, what is the purpose of this feature? I can see changes mention Darwin - "NSNumber: Make comparing NaN with number match Darwin". So is this test valid on PPC64LE?

(Xiaodi Wu) #2

The commit added new tests comparing the bit pattern representation of integers:

	        XCTAssertEqual(nanFloat.intValue, Int(bitPattern: 1 << 63))
	        XCTAssertEqual(nanFloat.uintValue, UInt(bitPattern: 1 << 63))
/* ... */
	        XCTAssertEqual(nanFloat.int64Value, Int64(bitPattern: 1 << 63))
	        XCTAssertEqual(nanFloat.uint64Value, UInt64(bitPattern: 1 << 63))