Remove placeholders from spec and implementations 1/5

Update spec and test suite.
This commit is contained in:
Tony Garnock-Jones 2020-05-28 23:20:02 +02:00
parent dfc50fcaee
commit e7ef060695
5 changed files with 306 additions and 342 deletions

View File

@ -23,7 +23,6 @@ binary syntax.
**General rules.**
Streaming formats ("format C") *MUST NOT* be used.
Annotations *MUST NOT* be present.
Placeholders *MUST NOT* be used.
Whenever there is a choice between fixed-length ("format A") or
variable-length ("format B") formats, the fixed-length format *MUST* be
used.

View File

@ -4,7 +4,7 @@ title: "Preserves: an Expressive Data Language"
---
Tony Garnock-Jones <tonyg@leastfixedpoint.com>
May 2020. Version 0.0.7.
May 2020. Version 0.0.8.
[sexp.txt]: http://people.csail.mit.edu/rivest/Sexp.txt
[spki]: http://world.std.com/~cme/html/spki.html
@ -278,8 +278,12 @@ either.[^reading-and-writing-floats-accurately]
[^arbitrary-precision-signedinteger]: **Implementation note.** Be
aware when implementing reading and writing of `SignedInteger`s
that the data model *requires* arbitrary-precision integers. Your
I/O routines must not truncate precision either when reading or
writing a `SignedInteger`.
implementation may (but, ideally, should not) truncate precision
when reading or writing a `SignedInteger`; however, if it does so,
it should (a) signal its client that truncation has occurred, and
(b) make it clear to the client that comparing such truncated
values for equality or ordering will not yield results that match
the expected semantics of the data model.
`String`s are,
[as in JSON](https://tools.ietf.org/html/rfc8259#section-7), possibly
@ -417,11 +421,8 @@ different.
## Compact Binary Syntax
A `Repr` is a binary-syntax encoding, or representation, of either
- a `Value`,
- a “placeholder” for a `Value`, or
- an annotation on a `Repr`.
A `Repr` is a binary-syntax encoding, or representation, of either a
`Value` or an annotation on a `Repr`.
Each `Repr` comprises one or more bytes describing the kind of
represented information and the length of the representation, followed
@ -434,7 +435,7 @@ For a value `v`, we write `[[v]]` for the `Repr` of v.
Each `Repr` takes one of three possible forms:
- (A) type-specific form, used for simple values such as `Boolean`s
or `Float`s, for placeholders, and for introducing annotations.
or `Float`s as well as for introducing annotations.
- (B) a variable-length form with length specified up-front, used for
compound and variable-length atomic data structures when their
@ -465,7 +466,6 @@ representation.[^some-encodings-unused]
| 0 | 0 | 03 | (format A) An `Atom` with fixed-length binary representation |
| 0 | 0 | 4 | (format C) Stream end |
| 0 | 0 | 5 | (format A) Annotation |
| 0 | 1 | | (format A) Placeholder for an application-specific `Value` |
| 0 | 2 | | (format C) Stream start |
| 0 | 3 | | (format A) Certain small `SignedInteger`s |
| 1 | | | (format B) An `Atom` with variable-length binary representation |
@ -565,41 +565,6 @@ Format C (streaming):
Applications *SHOULD* prefer the known-length format for encoding
`Record`s.
### Placeholders.
Applications may define an interpretation for numbered *placeholders*
in the binary syntax, mapping each *placeholder number* `n` to a
specific `Value`. For example, a placeholder number may be assigned
for a frequently-used `Record` label.
A `Value` `v` for which placeholder number `n` has been assigned may
be tersely encoded as
[[v]] = header(0,1,n) when n is a placeholder number for v
**Examples.** For example, a protocol may choose to assign placeholder
number 4 to the symbol `void`, making
[[void]] = header(0,1,4) = [0x14]
[[<void>]] = header(2,0,1) ++ [[void]] = [0x81, 0x14]
or it may map symbol `person` to placeholder number 102, making
[[person]] = header(0,1,102) = [0x1F, 0x66]
and so
[[<person "Dr" "Elizabeth" "Blackwell">]]
= header(2,0,4) ++ [[person]] ++ [["Dr"]] ++ [["Elizabeth"]] ++ [["Blackwell"]]
= [0x84, 0x1F, 0x66] ++ [["Dr"]] ++ [["Elizabeth"]] ++ [["Blackwell"]]
for format B, or
open(2,0) ++ [[person]] ++ [["Dr"]] ++ [["Elizabeth"]] ++ [["Blackwell"]] ++ close()
= [0x28, 0x1F, 0x66] ++ [["Dr"]] ++ [["Elizabeth"]] ++ [["Blackwell"]] ++ [0x04]
for format C.
### Sequences, Sets and Dictionaries.
Format B (known length):
@ -741,14 +706,9 @@ i.e. an empty sequence annotated with two symbols, `a` and `b`, is
<!-- TODO: Give some examples of large and small Preserves, perhaps -->
<!-- translated from various JSON blobs floating around the internet. -->
For the following examples, imagine an application that maps
placeholder number 0 to symbol `discard`, 1 to `capture`, and 2 to
`observe`.
| Value | Encoded byte sequence |
|---------------------------------------------------|-------------------------------------------------------------------------------------|
| `<capture <discard>>` | 82 11 81 10 |
| `<observe <speak <discard> <capture <discard>>>>` | 82 12 83 75 's' 'p' 'e' 'a' 'k' 81 10 82 11 81 11 |
| `<capture <discard>>` | 82 77 'c' 'a' 'p' 't' 'u' 'r' 'e' 81 77 'd' 'i' 's' 'c' 'a' 'r' 'd' |
| `[1 2 3 4]` (format B) | 94 31 32 33 34 |
| `[1 2 3 4]` (format C) | 29 31 32 33 34 04 |
| `[-2 -1 0 1]` | 94 3E 3F 30 31 |
@ -974,7 +934,7 @@ can be done as follows:
04 - End stream
05 - Annotation
(0x) RESERVED 06-0F (NB. 09, 0A, 0D specially reserved)
1x - Placeholder
(1x) RESERVED
2x - Start Stream (NB. 20, 2C specially reserved)
3x - Small integers 0..12,-3..-1
@ -1010,7 +970,7 @@ can be done as follows:
00 00 1010 (ASCII LF) |- Reserved: may be used to indicate
00 00 1101 (ASCII CR) / use of text encoding
00 01 mmmm Placeholder; m is the placeholder number
00 01 xxxx error, RESERVED
00 10 ttnn Start Stream <tt,nn>
When tt = 00 --> error
@ -1038,16 +998,17 @@ can be done as follows:
10 10 mmmm Set
10 11 mmmm Dictionary
11 nn mmmm error, RESERVED
11 00 xxxx error, RESERVED
11 01 xxxx error, RESERVED
11 10 xxxx error, RESERVED
11 11 1111 no-op; unambiguous indication of binary Preserves format
Where `mmmm` appears, interpret it as an unsigned 4-bit number `m`. If
`m`<15, let `l`=`m`. Otherwise, `m`=15; let `l` be the result of
decoding the varint that follows.
Then, if `ttnn`=`0001`, `l` is the placeholder number; otherwise, `l`
is the length of the body that follows, counted in bytes for `tt`=`01`
and in `Repr`s for `tt`=`10`.
Then, `l` is the length of the body that follows, counted in bytes for
`tt`=`01` and in `Repr`s for `tt`=`10`.
## Appendix. Binary SignedInteger representation

View File

@ -1,7 +1,8 @@
all: samples.bin
samples.bin: samples.txt
racket ../implementations/racket/preserves/preserves/tool.rkt --atob < $< > $@
racket ../implementations/racket/preserves/preserves/tool.rkt --atob < $< > $@.tmp || (rm -f $@.tmp; false)
mv $@.tmp $@
clean:
rm -f samples.bin

Binary file not shown.

View File

@ -8,8 +8,10 @@
DecodeTest: {fields: [binary annotatedValue] expectations: {1 2 3 4 5 6 7 8}}
ParseError: {fields: [text] expectations: {12}}
ParseShort: {fields: [text] expectations: {13}}
DecodeError: {fields: [bytes] expectations: {14}}
DecodeShort: {fields: [bytes] expectations: {15}}
ParseEOF: {fields: [text] expectations: {14}}
DecodeError: {fields: [bytes] expectations: {15}}
DecodeShort: {fields: [bytes] expectations: {16}}
DecodeEOF: {fields: [bytes] expectations: {17}}
}>
"In each test, let value = strip(annotatedValue),",
" forward = value,",
@ -30,297 +32,298 @@
10: "canonicallyEncodeBinary(forward) = binary"
11: "encodeBinary(annotatedValue) = binary"
12: "decodeText(text) fails with a syntax error (NB. never with premature EOF)"
13: "decodeText(text) fails signalling premature EOF (NB. never with a syntax error)"
12: "decodeText(text) fails with a syntax error (NB. never with EOF)"
13: "decodeText(text) fails signalling premature EOF after partial parse (NB. never with a syntax error)"
14: "decodeText(text) fails signalling immediate EOF (NB. never with a syntax error)"
14: "decodeBinary(bytes) fails with a syntax error (NB. never with premature EOF)"
15: "decodeBinary(bytes) fails signalling premature EOF (NB. never with a syntax error)"
15: "decodeBinary(bytes) fails with a syntax error (NB. never with EOF)"
16: "decodeBinary(bytes) fails signalling premature EOF after partial parse (NB. never with a syntax error)"
17: "decodeBinary(bytes) fails signalling immediate EOF (NB. never with a syntax error)"
}>
"Each `StreamingTest` will need to have an implementation-specific `forward`"
"supplied that encodes to the specific format C byte sequences in `binary`."
"Alternatively, implementations may choose to skip expectation 11 for"
"`StreamingTest`s, treating them like `DecodeTest`s."
""
"Implementations may vary in their treatment of the difference between expectations"
"13/14 and 16/17, depending on how they wish to treat end-of-stream conditions."
]>
<TestCases
<ExpectedPlaceholderMapping {
0: discard
1: capture
2: observe
}>
{
annotation1: <Test #hex{055361626339} @"abc" 9>
annotation2: <Test #hex{05536162630553646566929005517890} @"abc" @"def" [[] @"x" []]>
annotation3: <Test #hex{050531320505333435} @@1 2 @@3 4 5>
annotation4: <NondeterministicTest #hex{b4 05 72616b 7161 05 726176 31 05 72626b 7162 05 726276 32}
{@ak a: @av 1 @bk b: @bv 2}>
annotation5: <Test #hex{05726172827152057261667166} @ar <R @af f>>
annotation6: <Test #hex{82057261727152057261667166} <@ar R @af f>>
annotation7:
@"Stop reading symbols at @ -- this test has three separate annotations"
<Test #hex{05716105716205716390} @a@b@c[]>
bytes1: <StreamingTest #hex{26626865626c6c616f04} #"hello">
bytes2: <Test #hex{6568656c6c6f} #"hello">
bytes2a: <Test @"Internal whitespace is allowed, including commas!" #hex{65, 68, 65, 6c, 6c, 6f} #"hello">
bytes3: <Test #hex{63414243} #"ABC">
bytes4: <Test #hex{63414243} #hex{414243}>
bytes5: <Test #hex{63414a4e} #hex{ 41 4A 4e }>
bytes6: @"Bytes must be 2-digits entire" <ParseError "#hex{414 243}">
bytes7: <Test #"\x66corymb" #base64{Y29yeW1i}>
bytes8: <Test #"\x66corymb" #base64{Y29 yeW 1i}>
bytes9: <Test #"\x62Hi" #base64{SGk=}>
bytes10: <Test #"\x62Hi" #base64{SGk}>
bytes11: <Test #"\x62Hi" #base64{S G k}>
bytes12: @"Bytes syntax only supports \\x, not \\u" <ParseError "#\"\\u6c34\"">
bytes13: <Test #hex{6f 11 61 62 63 6c 34 f0 5c 2f 22 08 0c 0a 0d 09 78 79 7a} #"abc\x6c\x34\xf0\\/\"\b\f\n\r\txyz">
<TestCases {
annotation1: <Test #hex{055361626339} @"abc" 9>
annotation2: <Test #hex{05536162630553646566929005517890} @"abc" @"def" [[] @"x" []]>
annotation3: <Test #hex{050531320505333435} @@1 2 @@3 4 5>
annotation4: <NondeterministicTest #hex{b4 05 72616b 7161 05 726176 31 05 72626b 7162 05 726276 32}
{@ak a: @av 1 @bk b: @bv 2}>
annotation5: <Test #hex{05726172827152057261667166} @ar <R @af f>>
annotation6: <Test #hex{82057261727152057261667166} <@ar R @af f>>
annotation7:
@"Stop reading symbols at @ -- this test has three separate annotations"
<Test #hex{05716105716205716390} @a@b@c[]>
bytes1: <StreamingTest #hex{26626865626c6c616f04} #"hello">
bytes2: <Test #hex{6568656c6c6f} #"hello">
bytes2a: <Test @"Internal whitespace is allowed, including commas!" #hex{65, 68, 65, 6c, 6c, 6f} #"hello">
bytes3: <Test #hex{63414243} #"ABC">
bytes4: <Test #hex{63414243} #hex{414243}>
bytes5: <Test #hex{63414a4e} #hex{ 41 4A 4e }>
bytes6: @"Bytes must be 2-digits entire" <ParseError "#hex{414 243}">
bytes7: <Test #"\x66corymb" #base64{Y29yeW1i}>
bytes8: <Test #"\x66corymb" #base64{Y29 yeW 1i}>
bytes9: <Test #"\x62Hi" #base64{SGk=}>
bytes10: <Test #"\x62Hi" #base64{SGk}>
bytes11: <Test #"\x62Hi" #base64{S G k}>
bytes12: @"Bytes syntax only supports \\x, not \\u" <ParseError "#\"\\u6c34\"">
bytes13: <Test #hex{6f 11 61 62 63 6c 34 f0 5c 2f 22 08 0c 0a 0d 09 78 79 7a} #"abc\x6c\x34\xf0\\/\"\b\f\n\r\txyz">
dict0: <Test #hex{b0} {}>
dict1: <NondeterministicTest #hex{b8 5162 01 7161 31 93313233 6163 b2 7a66697273742d6e616d65 59456c697a6162657468 b2 777375726e616d65 59426c61636b77656c6c} { a: 1 "b": #true [1 2 3]: #"c" { first-name: "Elizabeth" }: { surname: "Blackwell" } }>
dict2: @"Missing close brace" <ParseShort "{ a: b, c: d ">
dict2a: @"Missing close brace" <ParseShort "{">
dict3: @"Duplicate key" <ParseError "{ a: 1, a: 2 }">
dict4: @"Unexpected close brace" <ParseError "}">
dict5: @"Missing value" <DecodeError #hex{b3 31 32 33}>
double1: <Test #hex{033ff0000000000000} 1.0>
double2: <Test #hex{03fe3cb7b759bf0426} -1.202e300>
float1: <Test #hex{023f800000} 1.0f>
int-257: <Test #hex{42feff} -257>
int-256: <Test #hex{42ff00} -256>
int-255: <Test #hex{42ff01} -255>
int-254: <Test #hex{42ff02} -254>
int-129: <Test #hex{42ff7f} -129>
int-128: <Test #hex{4180} -128>
int-127: <Test #hex{4181} -127>
int-4: <Test #hex{41fc} -4>
int-3: <Test #hex{3d} -3>
int-2: <Test #hex{3e} -2>
int-1: <Test #hex{3f} -1>
int0: <Test #hex{30} 0>
int1: <Test #hex{31} 1>
int12: <Test #hex{3c} 12>
int13: <Test #hex{410d} 13>
int127: <Test #hex{417f} 127>
int128: <Test #hex{420080} 128>
int255: <Test #hex{4200ff} 255>
int256: <Test #hex{420100} 256>
int32767: <Test #hex{427fff} 32767>
int32768: <Test #hex{43008000} 32768>
int65535: <Test #hex{4300ffff} 65535>
int65536: <Test #hex{43010000} 65536>
int131072: <Test #hex{43020000} 131072>
list0: <Test #hex{90} []>
list1: <StreamingTest #hex{293132333404} [1 2 3 4]>
list2: <StreamingTest #hex{2925636162630425636465660404} ["abc" "def"]>
list3: <StreamingTest #hex{2992516131925162329251633304} [["a" 1] ["b" 2] ["c" 3]]>
list4: <Test #hex{9431323334} [1 2 3 4]>
list4a: <Test #hex{9431323334} [1, 2, 3, 4]>
list5: <Test #hex{943e3f3031} [-2 -1 0 1]>
list6: <Test #hex{97 5568656c6c6f 757468657265 65776f726c64 90 a0 01 00} ["hello" there #"world" [] #set{} #true #false]>
list7: <Test #hex{93 73616263 732e2e2e 73646566} [abc ... def]>
list8: @"Missing close bracket" <ParseShort "[">
list9: @"Unexpected close bracket" <ParseError "]">
noop0: <DecodeTest #hex{ff10} discard>
noop1: <DecodeTest #hex{ff31} 1>
noop2: <DecodeTest #hex{ffffff42ff00} -256>
noop3: <DecodeTest #hex{ff05ff53616263ff42ff00} @"abc" -256>
noop4: @"No-ops must be followed by something" <DecodeShort #hex{ffffff}>
noop5: @"No input at all is considered short" <DecodeShort #hex{}>
placeholder0: <Test #hex{10} discard>
placeholder1: <Test #hex{11} capture>
placeholder2: <Test #hex{12} observe>
record1: <Test #hex{82118110} <capture <discard>>>
record2: <Test #hex{82 12 83 75737065616b 81 10 82 11 81 10} <observe <speak <discard>, <capture <discard>>>>>
record3: <Test #hex{85 95 767469746c6564 76706572736f6e 32 757468696e67 31 4165 59426c61636b77656c6c 84 7464617465 42071d 32 33 524472} <[titled person 2 thing 1] 101 "Blackwell" <date 1821 2 3> "Dr">>
record4: <Test #hex{8110} <discard>>
record5: <Test #hex{823790} <7[]>>
record6: <Test #hex{8210787375727072697365} <discard surprise>>
record7: <Test #hex{835761537472696e673334} <"aString" 3 4>>
record8: <Test #hex{8381103334} <<discard> 3 4>>
record9: @"Missing record label" <ParseError "<>">
record10: @"Missing close-angle-bracket" <ParseShort "<">
record11: @"Unexpected close-angle-bracket" <ParseError ">">
set0: <Test #hex{a0} #set{}>
set1: <NondeterministicTest #hex{a3313233} {1 2 3}>
set1a: <NondeterministicTest #hex{a3313233} #set{1 2 3}>
set2: @"Missing close brace" <ParseShort "#set{ 1 2 3 ">
set2a: @"Missing close brace" <ParseShort "#set{">
set3: @"Duplicate value" <ParseError "#set{a a}">
stream1: @"Chunk must be bytes" <DecodeError #hex{25516104}>
stream2: @"Chunk must be bytes" <DecodeError #hex{25716104}>
stream3: @"Chunk must be bytes" <DecodeError #hex{26516104}>
stream4: @"Chunk must be bytes" <DecodeError #hex{26716104}>
stream5: @"Chunk must be bytes" <DecodeError #hex{27516104}>
stream6: @"Chunk must be bytes" <DecodeError #hex{27716104}>
stream7: @"Missing end byte" <DecodeShort #hex{290000}>
stream8: @"Missing element" <DecodeShort #hex{930000}>
stream9: @"Unexpected end stream byte" <DecodeError #hex{04}>
string0: <Test #hex{50} "">
string0a: <StreamingTest #hex{2504} "">
string1: <StreamingTest #hex{25626865626c6c616f04} "hello">
string2: <StreamingTest #hex{25626865636c6c6f04} "hello">
string3: <Test #hex{5568656c6c6f} "hello">
string4: <Test #hex{5f 14 616263e6b0b4e6b0b45c2f22080c0a0d0978797a} "abc\u6c34\u6C34\\/\"\b\f\n\r\txyz">
string5: <Test #hex{54f09d849e} "\uD834\uDD1E">
symbol0: <Test #hex{70} ||>
symbol1: <StreamingTest #hex{27626865626c6c616f04} hello>
symbol2: <Test #hex{7568656c6c6f} hello>
whitespace0: @"Leading spaces have to eventually yield something" <ParseShort " ">
whitespace1: @"No input at all is considered short" <ParseShort "">
value1: <Test #"\x66corymb" #value#"fcorymb">
value2: <Test #"\x01" #value#"\x01">
value3: <Test #"\x01" #value#base64{AQ}>
value4: <Test #"\x01" #value#base64{AQ==}>
value5: <Test #"\x01" #value #base64{AQ==}>
value6: <Test #hex{93313233} #value#hex{93313233}>
dict0: <Test #hex{b0} {}>
dict1: <NondeterministicTest #hex{b8 5162 01 7161 31 93313233 6163 b2 7a66697273742d6e616d65 59456c697a6162657468 b2 777375726e616d65 59426c61636b77656c6c} { a: 1 "b": #true [1 2 3]: #"c" { first-name: "Elizabeth" }: { surname: "Blackwell" } }>
dict2: @"Missing close brace" <ParseShort "{ a: b, c: d ">
dict2a: @"Missing close brace" <ParseShort "{">
dict3: @"Duplicate key" <ParseError "{ a: 1, a: 2 }">
dict4: @"Unexpected close brace" <ParseError "}">
dict5: @"Missing value" <DecodeError #hex{b3 31 32 33}>
double1: <Test #hex{033ff0000000000000} 1.0>
double2: <Test #hex{03fe3cb7b759bf0426} -1.202e300>
float1: <Test #hex{023f800000} 1.0f>
int-257: <Test #hex{42feff} -257>
int-256: <Test #hex{42ff00} -256>
int-255: <Test #hex{42ff01} -255>
int-254: <Test #hex{42ff02} -254>
int-129: <Test #hex{42ff7f} -129>
int-128: <Test #hex{4180} -128>
int-127: <Test #hex{4181} -127>
int-4: <Test #hex{41fc} -4>
int-3: <Test #hex{3d} -3>
int-2: <Test #hex{3e} -2>
int-1: <Test #hex{3f} -1>
int0: <Test #hex{30} 0>
int1: <Test #hex{31} 1>
int12: <Test #hex{3c} 12>
int13: <Test #hex{410d} 13>
int127: <Test #hex{417f} 127>
int128: <Test #hex{420080} 128>
int255: <Test #hex{4200ff} 255>
int256: <Test #hex{420100} 256>
int32767: <Test #hex{427fff} 32767>
int32768: <Test #hex{43008000} 32768>
int65535: <Test #hex{4300ffff} 65535>
int65536: <Test #hex{43010000} 65536>
int131072: <Test #hex{43020000} 131072>
list0: <Test #hex{90} []>
list1: <StreamingTest #hex{293132333404} [1 2 3 4]>
list2: <StreamingTest #hex{2925636162630425636465660404} ["abc" "def"]>
list3: <StreamingTest #hex{2992516131925162329251633304} [["a" 1] ["b" 2] ["c" 3]]>
list4: <Test #hex{9431323334} [1 2 3 4]>
list4a: <Test #hex{9431323334} [1, 2, 3, 4]>
list5: <Test #hex{943e3f3031} [-2 -1 0 1]>
list6: <Test #hex{97 5568656c6c6f 757468657265 65776f726c64 90 a0 01 00} ["hello" there #"world" [] #set{} #true #false]>
list7: <Test #hex{93 73616263 732e2e2e 73646566} [abc ... def]>
list8: @"Missing close bracket" <ParseShort "[">
list9: @"Unexpected close bracket" <ParseError "]">
noop0: <DecodeTest #hex{ff7764697363617264} discard>
noop1: <DecodeTest #hex{ff31} 1>
noop2: <DecodeTest #hex{ffffff42ff00} -256>
noop3: <DecodeTest #hex{ff05ff53616263ff42ff00} @"abc" -256>
noop4: @"No-ops must be followed by something" <DecodeShort #hex{ffffff}>
noop5: @"No input at all" <DecodeEOF #hex{}>
placeholder0: @"Placeholders are no longer supported" <DecodeError #hex{10}>
placeholder1: @"Placeholders are no longer supported" <DecodeError #hex{8110}>
record1: <Test #hex{827763617074757265817764697363617264} <capture <discard>>>
record2: <Test #hex{82 776f627365727665 83 75737065616b 81 7764697363617264 82 7763617074757265 81 7764697363617264} <observe <speak <discard>, <capture <discard>>>>>
record3: <Test #hex{85 95 767469746c6564 76706572736f6e 32 757468696e67 31 4165 59426c61636b77656c6c 84 7464617465 42071d 32 33 524472} <[titled person 2 thing 1] 101 "Blackwell" <date 1821 2 3> "Dr">>
record4: <Test #hex{817764697363617264} <discard>>
record5: <Test #hex{823790} <7[]>>
record6: <Test #hex{827764697363617264787375727072697365} <discard surprise>>
record7: <Test #hex{835761537472696e673334} <"aString" 3 4>>
record8: <Test #hex{838177646973636172643334} <<discard> 3 4>>
record9: @"Missing record label" <ParseError "<>">
record10: @"Missing close-angle-bracket" <ParseShort "<">
record11: @"Unexpected close-angle-bracket" <ParseError ">">
set0: <Test #hex{a0} #set{}>
set1: <NondeterministicTest #hex{a3313233} {1 2 3}>
set1a: <NondeterministicTest #hex{a3313233} #set{1 2 3}>
set2: @"Missing close brace" <ParseShort "#set{ 1 2 3 ">
set2a: @"Missing close brace" <ParseShort "#set{">
set3: @"Duplicate value" <ParseError "#set{a a}">
stream1: @"Chunk must be bytes" <DecodeError #hex{25516104}>
stream2: @"Chunk must be bytes" <DecodeError #hex{25716104}>
stream3: @"Chunk must be bytes" <DecodeError #hex{26516104}>
stream4: @"Chunk must be bytes" <DecodeError #hex{26716104}>
stream5: @"Chunk must be bytes" <DecodeError #hex{27516104}>
stream6: @"Chunk must be bytes" <DecodeError #hex{27716104}>
stream7: @"Missing end byte" <DecodeShort #hex{290000}>
stream8: @"Missing element" <DecodeShort #hex{930000}>
stream9: @"Unexpected end stream byte" <DecodeError #hex{04}>
stream10: @"Empty chunks forbidden" <DecodeError #hex{25616160616104}>
stream11: @"Empty chunks forbidden" <DecodeError #hex{26616160616104}>
stream12: @"Empty chunks forbidden" <DecodeError #hex{27616160616104}>
string0: <Test #hex{50} "">
string0a: <StreamingTest #hex{2504} "">
string1: <StreamingTest #hex{25626865626c6c616f04} "hello">
string2: <StreamingTest #hex{25626865636c6c6f04} "hello">
string3: <Test #hex{5568656c6c6f} "hello">
string4: <Test #hex{5f 14 616263e6b0b4e6b0b45c2f22080c0a0d0978797a} "abc\u6c34\u6C34\\/\"\b\f\n\r\txyz">
string5: <Test #hex{54f09d849e} "\uD834\uDD1E">
symbol0: <Test #hex{70} ||>
symbol1: <StreamingTest #hex{27626865626c6c616f04} hello>
symbol2: <Test #hex{7568656c6c6f} hello>
whitespace0: @"Leading spaces have to eventually yield something" <ParseShort " ">
whitespace1: @"No input at all" <ParseEOF "">
value1: <Test #"\x66corymb" #value#"fcorymb">
value2: <Test #"\x01" #value#"\x01">
value3: <Test #"\x01" #value#base64{AQ}>
value4: <Test #"\x01" #value#base64{AQ==}>
value5: <Test #"\x01" #value #base64{AQ==}>
value6: <Test #hex{93313233} #value#hex{93313233}>
longlist14: <Test #hex{9e0000000000000000000000000000}
[#false #false #false #false #false
#false #false #false #false #false
#false #false #false #false]>
longlist15: <Test #hex{9f0f000000000000000000000000000000}
[#false #false #false #false #false
#false #false #false #false #false
#false #false #false #false #false]>
longlist100:
<Test #hex{9f64
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000}
[#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]>
longlist200:
<Test #hex{9fc801
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000}
[#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]>
longlist14: <Test #hex{9e0000000000000000000000000000}
[#false #false #false #false #false
#false #false #false #false #false
#false #false #false #false]>
longlist15: <Test #hex{9f0f000000000000000000000000000000}
[#false #false #false #false #false
#false #false #false #false #false
#false #false #false #false #false]>
longlist100:
<Test #hex{9f64
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000}
[#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]>
longlist200:
<Test #hex{9fc801
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000}
[#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]>
rfc8259-example1: <NondeterministicTest
#hex{b2 55 496d616765
bc 58 416e696d61746564
75 66616c7365
56 486569676874
42 0258
53 494473
94 41 74
42 03af
42 00ea
43 009789
59 5468756d626e61696c
b6 56 486569676874
41 7d
53 55726c
5f26 687474703a2f2f7777772e6578616d706c652e636f6d2f696d6167652f343831393839393433
55 5769647468
41 64
55 5469746c65
5f14 566965772066726f6d203135746820466c6f6f72
55 5769647468
42 0320}
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": 100
},
"Animated" : false,
"IDs": [116, 943, 234, 38793]
}
}>
rfc8259-example1: <NondeterministicTest
#hex{b2 55 496d616765
bc 58 416e696d61746564
75 66616c7365
56 486569676874
42 0258
53 494473
94 41 74
42 03af
42 00ea
43 009789
59 5468756d626e61696c
b6 56 486569676874
41 7d
53 55726c
5f26 687474703a2f2f7777772e6578616d706c652e636f6d2f696d6167652f343831393839393433
55 5769647468
41 64
55 5469746c65
5f14 566965772066726f6d203135746820466c6f6f72
55 5769647468
42 0320}
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": 100
},
"Animated" : false,
"IDs": [116, 943, 234, 38793]
}
}>
rfc8259-example2: <NondeterministicTest
#hex{92 bf10 57 41646472657373 50
54 43697479 5d 53414e204652414e434953434f
57 436f756e747279 52 5553
58 4c61746974756465 03 4042e226809d4952
59 4c6f6e676974756465 03 c05e99566cf41f21
55 5374617465 52 4341
53 5a6970 55 3934313037
59 707265636973696f6e 53 7a6970
bf10 57 41646472657373 50
54 43697479 59 53554e4e5956414c45
57 436f756e747279 52 5553
58 4c61746974756465 03 4042af9d66adb403
59 4c6f6e676974756465 03 c05e81aa4fca42af
55 5374617465 52 4341
53 5a6970 55 3934303835
59 707265636973696f6e 53 7a6970}
[
{
"precision": "zip",
"Latitude": 37.7668,
"Longitude": -122.3959,
"Address": "",
"City": "SAN FRANCISCO",
"State": "CA",
"Zip": "94107",
"Country": "US"
},
{
"precision": "zip",
"Latitude": 37.371991,
"Longitude": -122.026020,
"Address": "",
"City": "SUNNYVALE",
"State": "CA",
"Zip": "94085",
"Country": "US"
}
]>
rfc8259-example2: <NondeterministicTest
#hex{92 bf10 57 41646472657373 50
54 43697479 5d 53414e204652414e434953434f
57 436f756e747279 52 5553
58 4c61746974756465 03 4042e226809d4952
59 4c6f6e676974756465 03 c05e99566cf41f21
55 5374617465 52 4341
53 5a6970 55 3934313037
59 707265636973696f6e 53 7a6970
bf10 57 41646472657373 50
54 43697479 59 53554e4e5956414c45
57 436f756e747279 52 5553
58 4c61746974756465 03 4042af9d66adb403
59 4c6f6e676974756465 03 c05e81aa4fca42af
55 5374617465 52 4341
53 5a6970 55 3934303835
59 707265636973696f6e 53 7a6970}
[
{
"precision": "zip",
"Latitude": 37.7668,
"Longitude": -122.3959,
"Address": "",
"City": "SAN FRANCISCO",
"State": "CA",
"Zip": "94107",
"Country": "US"
},
{
"precision": "zip",
"Latitude": 37.371991,
"Longitude": -122.026020,
"Address": "",
"City": "SUNNYVALE",
"State": "CA",
"Zip": "94085",
"Country": "US"
}
]>
}
}
>