You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some empty dictionaries that have been encoded with CBOREncoder throw a type mismatch error when the data is decoded again with CBORDecoder.
To me this seems like a relatively severe bug.
Actual Behavior
See provided test methods.
Steps To Reproduce
Test methods I added to CBORDecoderTests. The first one currently fails, the second one succeeds.
/// Fails!
func testEmptyDictionaryRoundTripUInt64Key() throws {
let dict = [UInt64: String]()
let data = try CBOREncoder().encode(dict)
let dict2: [UInt64: String] = try CBORDecoder().decode(from: data)
XCTAssertEqual(dict, dict2)
}
/// Succeeds
func testEmptyDictionaryRoundTripIntKey() throws {
let dict = [Int: String]()
let data = try CBOREncoder().encode(dict)
let dict2: [Int: String] = try CBORDecoder().decode(from: data)
XCTAssertEqual(dict, dict2)
}
Other types fail too, for example dictionaries with Int32 keys.
Expected Behavior
Some empty dictionaries that have been encoded with
CBOREncoder
throw a type mismatch error when the data is decoded again withCBORDecoder
.To me this seems like a relatively severe bug.
Actual Behavior
See provided test methods.
Steps To Reproduce
Test methods I added to
CBORDecoderTests
. The first one currently fails, the second one succeeds.Other types fail too, for example dictionaries with
Int32
keys.Project Version
6fbd643
The OS/Variant where this issue occurs.
The version of Xcode that was used when this issue appeared.
15.0.1 (15A507)
What was the environment in which the issue appeared?
Additional Context
No response
The text was updated successfully, but these errors were encountered: