# # [DRAFT] Annotated TJSON examples intended for testing TJSON parsers # # Revision: 24 (bump this when making changes to this file) # # Syntax used in this file: # # - Any line beginning with a '#' is a comment and should be ignored # - Examples are delimited by a line containing only '-----' (5 hyphen characters) # - This file should begin/end with '-----' with only comments allowed before/after # the leading and trailing '-----' respectively (i.e. this comment block) # - Each example consists of TOML metadata and an example, separated by a blank line # # Example metadata syntax: # # - name = "Name of this example" # - description = "A more extended description of what this example tests" # - result = "success" | "error" # ----- name = "Empty Object" description = "Objects are allowed as a toplevel value and can be empty" result = "success" {} ----- name = "Object with UTF-8 String Key" description = "Strings are allowed as names of object members" result = "success" {"example:s":"foobar"} ----- name = "Invalid Object with Untagged Name" description = "All strings in TJSON must be tagged" result = "error" {"example":"foobar"} ----- name = "Invalid Object with Empty Tag" description = "All strings in TJSON must be tagged" result = "error" {"example:":"foobar"} ----- name = "Invalid Object with Repeated Member Names" description = "Names of the members of objects must be distinct" result = "error" {"example:i":"1","example:i":"2"} ----- name = "Invalid Object with Repeated Member Names and Values" description = "Names of the members of objects must be distinct" result = "error" {"example:i":"1","example:i":"1"} ----- name = "Invalid Object with Trailing Comma" description = "Trailing commas are explicitly allowed in JSON, let alone TJSON" result = "error" {"example1:i":"1","example2:i":"2",} ----- name = "Invalid Toplevel Array" description = "Arrays are NOT allowed as a toplevel value" result = "error" [] ----- name = "Array of integers" description = "Arrays are parameterized by the types of their contents" result = "success" {"example:A": ["1", "2", "3"]} ----- name = "Array of objects" description = "Objects are the only allowed terminal non-scalar" result = "success" {"example:A": [{"a:i": "1"}, {"b:i": "2"}]} ----- name = "Empty array" description = "Empty arrays are allowed to omit the type parameter" result = "success" {"example:A<>": []} ----- name = "Array with missing type parameter" description = "Type parameters are mandatory for non-empty arrays" result = "error" {"example:A<>": ["1", "2", "3"]} ----- name = "Multidimensional array of integers" description = "Arrays can contain other arrays" result = "success" {"example:A>": [["1", "2"], ["3", "4"], ["5", "6"]]} ----- name = "Set of integers" description = "Sets are parameterized by the types of their contents" result = "success" {"example:S": ["1", "2", "3"]} ----- name = "Invalid set of integers with duplicate members" description = "The members of sets MUST be unique or the parser MUST reject the document" result = "error" {"example:S": ["1", "1"]} ----- name = "Set of objects" description = "Objects are the only allowed terminal non-scalar" result = "success" {"example:A": [{"a:i": "1"}, {"b:i": "2"}]} ----- name = "Invalid set of duplicate objects" description = "The members of sets MUST be unique or the parser MUST reject the document" result = "error" {"example:S": [{"a:i": "1"}, {"a:i": "1"}]} ----- name = "Empty set" description = "Empty sets are allowed to omit the type parameter" result = "success" {"example:S<>": []} ----- name = "Set with missing type parameter" description = "Type parameters are mandatory for non-empty sets" result = "error" {"example:S<>": ["1", "2", "3"]} ----- name = "Set containing arrays of integers" description = "Sets can contain arrays" result = "success" {"example:S>": [["1", "2"], ["3", "4"], ["5", "6"]]} ----- name = "Invalid set containing duplicate arrays" description = "Sets containing arrays must contain unique arrays" result = "error" {"example:S>": [["1", "2"], ["1", "2"]]} ----- name = "Base16 Binary Data" description = "Base16 data begins with the 'b16:' prefix" result = "success" {"example:d16":"48656c6c6f2c20776f726c6421"} ----- name = "Invalid Base16 Binary Data with bad case" description = "Base16 data MUST be lower case" result = "error" {"example:d16":"48656C6C6F2C20776F726C6421"} ----- name = "Invalid Base16 Binary Data" description = "Base16 data must be valid hexadecimal" result = "error" {"example:d16":"This is not a valid hexadecimal string"} ----- name = "Base32 Binary Data" description = "Base32 data begins with the 'b32:' prefix" result = "success" {"example:d32":"jbswy3dpfqqho33snrscc"} ----- name = "Invalid Base32 Binary Data with bad case" description = "Base32 data MUST be lower case" result = "error" {"example:d32":"JBSWY3DPFQQHO33SNRSCC"} ----- name = "Invalid Base32 Binary Data with padding" description = "Base64 data MUST NOT include padding" result = "error" {"example:d32":"jbswy3dpfqqho33snrscc==="} ----- name = "Invalid Base32 Binary Data" description = "Base32 data must be valid" result = "error" {"example:d32":"This is not a valid base32 string"} ----- name = "Base64url Binary Data" description = "Base64 data begins with the 'b64:' prefix" result = "success" {"example:d64":"SGVsbG8sIHdvcmxkIQ"} ----- name = "Invalid Base64url Binary Data with padding" description = "Base64 data MUST NOT include padding" result = "error" {"example:d64":"SGVsbG8sIHdvcmxkIQ=="} ----- name = "Invalid Base64url Binary Data with non-URL safe characters" description = "Traditional Base64 is expressly disallowed" result = "error" {"example:d64":"+/+/"} ----- name = "Invalid Base64url Binary Data" description = "Garbage data MUST be rejected" result = "error" {"example:d64":"This is not a valid base64url string"} ----- name = "Signed Integer" description = "Signed integers are represented as tagged strings" result = "success" {"example:i":"42"} ----- name = "Signed Integer Range Test" description = "Signed integers should support the full 64-bit range" result = "success" {"min:i":"-9223372036854775808", "max:i":"9223372036854775807"} ----- name = "Oversized Signed Integer Test" description = "Values larger than can be represented by a signed 64-bit integer MUST be rejected" result = "error" {"oversize:i":"9223372036854775808"} ----- name = "Undersized Signed Integer Test" description = "Values smaller than can be represented by a signed 64-bit integer MUST be rejected" result = "error" {"undersize:i":"-9223372036854775809"} ----- name = "Invalid Signed Integer" description = "Garbage data after the integer tag should be rejected" result = "error" {"invalid:i":"This is not a valid integer"} ----- name = "Unsigned Integer" description = "Unsigned integers are represented as tagged strings" result = "success" {"example:u":"42"} ----- name = "Unsigned Integer Range Test" description = "Unsigned integers should support the full 64-bit range" result = "success" {"maxint:u":"18446744073709551615"} ----- name = "Oversized Unsigned Integer Test" description = "Values larger than can be represented by an unsigned 64-bit integer MUST be rejected" result = "error" {"oversized:u":"18446744073709551616"} ----- name = "Negative Unsigned Integer Test" description = "Unsigned integers cannot be negative" result = "error" {"negative:u":"-1"} ----- name = "Invalid Unsigned Integer" description = "Garbage data after the integer tag should be rejected" result = "error" {"invalid:u":"This is not a valid integer"} ----- name = "Floating Point" description = "A valid floating point" result = "success" {"float:f":1.23} ----- name = "Invalid Quoted Floating Point" description = "Floating point values MUST NOT be quoted" result = "error" {"float:f":"1.23"} ----- name = "Timestamp" description = "A valid RFC3339 timestamp example" result = "success" {"example:t":"2016-10-02T07:31:51Z"} ----- name = "Timestamp With Invalid Time Zone" description = "All timestamps must be in the UTC ('Z') time zone" result = "error" {"invalid:t":"2016-10-02T07:31:51-08:00"} ----- name = "Invalid Timestamp" description = "Garbage data after the timestamp tag MUST be rejected" result = "error" {"invalid:t":"This is not a valid timestamp"} ----- name = "True Boolean Value" description = "True is allowed as a TJSON value" result = "success" {"example:b": true} ----- name = "False Boolean Value" description = "False is allowed as a TJSON value" result = "success" {"example:b": false} ----- name = "Null Boolean Value" description = "Null is disallowed as a TJSON value" result = "error" {"example:b": null} ----- name = "Null Object" description = "Null is disallowed as a TJSON object" result = "error" {"example:O": null} ----- name = "Null Array" description = "Null is disallowed as a TJSON array" result = "error" {"example:A": [null]} ----- name = "Null String" description = "Null is disallowed as a TJSON string" result = "error" {"example:s": null} ----- name = "Null Binary Data" description = "Null is disallowed as a TJSON binary" result = "error" {"example:d": null} ----- name = "Null Integer" description = "Null is disallowed as a TJSON integer" result = "error" {"example:i": null} ----- name = "Null Floating Point" description = "Null is disallowed as a TJSON floating point" result = "error" {"example:f": null} ----- name = "Null Unsigned" description = "Null is disallowed as a TJSON unsigned integer" result = "error" {"example:u": null} ----- name = "Null Timestamp" description = "Null is disallowed as a TJSON timestamp" result = "error" {"example:t": null} -----