# Tensor DType, non-jobj, should fail
i8[*,*,*]
"hello"

# Tensor DType, non-tensor jobj, should fail
i8[*,*,*]
{"shape": [2, 2, 2], "jobj": "A"}

# Tensor DType, shape not provided, should fail
i8[*,*]
{"jobj": [[1, 2], [3, 4]]}

# Tensor DType, value not provided, should fail
i8[*,*]
{"shape": [2, 2]}

# Tensor DType, mismatched rank, should fail
i8[*,*,*]
{"shape": [2, 2], "jobj": [[1, 2], [3, 4]]}

# Tensor DType, bad shape, should fail
i8[]
{"shape": true, "jobj": 5}

# Tensor DType, all good
i8[]
{"shape": [], "jobj": 5}

# Tensor DType, all good
s[]
{"shape": [], "jobj": "x"}

# Tensor DType, bad value, should fail
i8[]
{"shape": [], "jobj": 5.5}

# Tensor DType, bad value, should fail
s[]
{"shape": [], "jobj": true}

# Tensor DType, bad shape, should fail
i8[*,*]
{"shape": true, "jobj": [[1, 2]]}

# Tensor DType, bad shape, should fail
i8[*,*]
{"shape": [2, true], "jobj": [[1, 2]]}

# Tensor DType, bad shape, should fail
i8[*,*]
{"shape": [2, 2.7], "jobj": [[1, 2]]}

# Tensor DType, jobj array too shallow, should fail
i8[*,*,*]
{"shape": [2, 2, 2], "jobj": [[1, 2], [3, 4]]}

# Tensor DType, dimension does not match shape, should fail
i8[*,*]
{"shape": [2, 2], "jobj": [[1, 2, 3], [4, 5, 6]]}

# Tensor DType, dimension does not match shape, should fail
i8[*,*]
{"shape": [2, 2], "jobj": [[1, 2], [4, 5, 6]]}

# Tensor DType, dimension does not match shape, should fail
i8[*,*]
{"shape": [2, 2], "jobj": [[1, 2], [3, 4], [5, 6]]}

# Tensor DType, bad item, should fail
i8[*,*]
{"shape": [2, 2], "jobj": [[1, 2], [3, true]]}

# Tensor DType, all good
i8[*,*]
{"shape": [2, "2"], "jobj": [[1, 2], [3, 4]]}

# Tensor DType, all good
s[*,*]
{"shape": [2, 2], "jobj": [["x1", "x2"], ["x3", "x4"]]}

# Tensor DType, mismatched item DType, should fail
{Field1:s}[*]
{"shape": [2], "jobj": [1, 2]}

# Tensor DType, success
r8[*,*]
{"shape": [2, 3], "jobj": [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]}

# Bad string contents for numeric values; should fail
i8
"X"

i4
"X"

i2
"X"

i1
"X"

u8
"X"

u4
"X"

u2
"X"

u1
"X"

ia
"X"

r8
"X"

r4
"X"

# Mismatched token types for numeric values; should fail
i8
true

i4
true

i2
true

i1
true

u8
true

u4
true

u2
true

u1
true

ia
true

r8
true

r4
true

# Floating point values parsed from either integer or floating point values should succeed
r8
1234

r8
1234.5678

r4
1234

r4
1234.5678

# Mismatched token type for Guid; should fail
G
123

# Mismatched token type for strings; should fail
s
123

s
true

# Mismatched token type for boolean; should fail
b
"abc"

b
1

# Deserialize a malformed Guid; should fail
G
"this is not a guid"

# Deserialize an integer value that overflows; should fail
i1
128

i2
32768

i4
2147483648

i8
9223372036854775808

u1
256

u2
65536

u4
4294967296

u8
18446744073709551616

# Deserialize a float value that overflows; should succeed as infinity
r4
3.4028235E+39

r8
1.7976931348623157E+309

# Null value for an optional type, should succeed
r4?
null

# Null value for an required type, should fail
r4
null

# Deserialize a large integer (larger than long) as a float; should succeed
r4
10000000000000000000

# Deserialize a string that is a valid float as a float; should succeed
r4
"123.45"

# Deserialize a string that overflows as a float; should succeed
r4
"3.4028235E+39"

# Deserialize a string that is a valid integer as an integer; should succeed
i1
"123"

i2
"123"

i4
"123"

i8
"123"

u1
"123"

u2
"123"

u4
"123"

u8
"123"

ia
"123"

# Deserialize a float that is a valid integer as an integer; should fail
i1
123.0

i2
123.0

i4
123.0

i8
123.0

u1
123.0

u2
123.0

u4
123.0

u8
123.0

ia
123.0

# Deserialize an string as an integer value that overflows; should fail
i1
"128"

i2
"32768"

i4
"2147483648"

i8
"9223372036854775808"

u1
"256"

u2
"65536"

u4
"4294967296"

u8
"18446744073709551616"

# Base 64 encoded tensor with garbage string; should fail
i8[*,*]
{"shape": [2, 2], "type": "i8", "base64": "garbage"}

# Base 64 encoded tensor for type that doesn't support base64; should fail
s[*,*]
{"shape": [2, 2], "type": "s", "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}

# Base 64 encoded tensor with non-string base64; should fail
i8[*,*]
{"shape": [2, 2], "type": "i8", "base64": 123}

# Base 64 encoded tensor with non-string type; should fail
i8[*,*]
{"shape": [2, 2], "type": 123, "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}

# Base 64 encoded tensor with missing type; should fail
i8[*,*]
{"shape": [2, 2], "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}

# Base 64 encoded tensor with mismatched type; should fail
i8[*,*]
{"shape": [2, 2], "type": "i4", "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}

# Base 64 encoded tensor with wrong size buffer; should fail
i8[*,*]
{"shape": [2, 2], "type": "i8", "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}

# Base 64 encoded tensor with invalid shape; should fail
i8[*,*]
{"shape": [2, -1], "type": "i8", "base64": "AAABAAIAAwAEAAUABgAHAAgACQAKAAsA"}
