-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to encode and decode a size delimited message collect…
…ion in Swift.
- Loading branch information
Showing
7 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,4 +60,18 @@ final class RoundTripTests: XCTestCase { | |
XCTAssertEqual(decodedEmpty, empty) | ||
} | ||
|
||
func testSizeDelimited() throws { | ||
let values = [ | ||
Person3(name: "John Doe", id: 123), | ||
Person3(name: "Jane Doe", id: 456, email: "[email protected]") | ||
] | ||
|
||
let encoder = ProtoEncoder() | ||
let data = try encoder.encodeSizeDelimited(values) | ||
|
||
let decoder = ProtoDecoder() | ||
let decodedValues = try decoder.decodeSizeDelimited(Person3.self, from: data) | ||
|
||
XCTAssertEqual(decodedValues, values) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters