Skip to content

Commit

Permalink
fix indef types
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Nov 21, 2024
1 parent 5a2800b commit ff6035a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Source/AwsCommonRuntimeKit/crt/CBOR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -336,7 +336,7 @@ public class CBORDecoder {
else {
throw CommonRunTimeError.crtError(.makeFromLastError())
}
return .indef_map_start
return .indef_text_start
}

default:
Expand Down
18 changes: 17 additions & 1 deletion Test/AwsCommonRuntimeKitTests/crt/CBOR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AwsCCommon

class CBORTests: XCBaseTestCase {

func testCBOREncode() async throws {
func testCBOR() async throws {
let values: [CBORType] = [
.uint64(100),
.int(-100),
Expand All @@ -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()
Expand Down

0 comments on commit ff6035a

Please sign in to comment.