[CBOR] Implement Conformance Levels (#35246)
authorEirik Tsarpalis <eirik.tsarpalis@gmail.com>
Sat, 2 May 2020 21:34:00 +0000 (22:34 +0100)
committerGitHub <noreply@github.com>
Sat, 2 May 2020 21:34:00 +0000 (22:34 +0100)
* implement writing sorted keys in maps

* rename NoConformance to NonStrict

* add tests for strict mode map writes

* extract common conformance level logic to helper class

* implement reader map conformance levels

* add missing struct labels

* NonStrict -> Lax

* implement CborWriter indefinite length conformance levels

* implement CborWriter tag conformance levels

* remove preserve float representation check

* implement CborReader integer encoding conformance

* implement CborReader indefinte-length conformance

* implement CborReader tag conformance level validation

* factor frame struct out of checkpoint struct

* use HashSet for reader key uniqueness

* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs

Co-Authored-By: Jeremy Barton <jbarton@microsoft.com>
* address tuple label naming consistency

* address PR feedback

* address tuple label style

* implement appropriate rollback semantics for key conformance validation

* rename CborWriter.ToArray() => CborWriter.GetEncoding(); add a span encoding method

* implement patching for indefinite-length items

* minor CborReader string refactoring

* add support for indefinite byte string literals in reader helpers

* Implement CborReader.SkipToParent();

* add a validateConformance parameter to Skip* methods

* implement CborWriter encodeIndefiniteLengths parameter

* make ReadStartMap() and ReadStartArray() return int

* strip IndefiniteLength suffix from write methods

* replace SortedList use with HashSet

* pool key encoding range HashSets

* implement writing and reading multiple root-level values

* I am disappoint

* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
* address PR feedback

* clean up code and add comments; remove unneeded synchronization

* rework CborWriter map sorting implementation

* store current major type in a field

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
1  2 
src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj