diff --git a/Source/AwsCommonRuntimeKit/crt/CBOR.swift b/Source/AwsCommonRuntimeKit/crt/CBOR.swift index 2bd2c242..89d998d9 100644 --- a/Source/AwsCommonRuntimeKit/crt/CBOR.swift +++ b/Source/AwsCommonRuntimeKit/crt/CBOR.swift @@ -307,7 +307,7 @@ public class CBORDecoder { } return .indef_array_start } - case AWS_CBOR_TYPE_MAP_START: + case AWS_CBOR_TYPE_INDEF_MAP_START: do { guard aws_cbor_decoder_consume_next_single_element(self.rawValue) @@ -336,7 +336,7 @@ public class CBORDecoder { else { throw CommonRunTimeError.crtError(.makeFromLastError()) } - return .indef_map_start + return .indef_text_start } default: diff --git a/Test/AwsCommonRuntimeKitTests/crt/CBOR.swift b/Test/AwsCommonRuntimeKitTests/crt/CBOR.swift index 330c2b25..8a71de42 100644 --- a/Test/AwsCommonRuntimeKitTests/crt/CBOR.swift +++ b/Test/AwsCommonRuntimeKitTests/crt/CBOR.swift @@ -7,7 +7,7 @@ import AwsCCommon class CBORTests: XCBaseTestCase { - func testCBOREncode() async throws { + func testCBOR() async throws { let values: [CBORType] = [ .uint64(100), .int(-100), @@ -20,6 +20,22 @@ class CBORTests: XCBaseTestCase { .date(Date(timeIntervalSince1970: 10.5)), .array([.int(-100), .uint64(1000)]), .map(["key": .uint64(100), "key2": .int(-100)]), + .indef_array_start, + .uint64(100), + .int(-100), + .indef_break, + .indef_map_start, + .text("key1"), + .uint64(100), + .text("key2"), + .int(-100), + .indef_break, + .indef_text_start, + .text("hello"), + .indef_break, + .indef_bytes_start, + .int(-100), + .indef_break, ] // encode the values let encoder = CBOREncoder()