blob: 3d467f2278d00d88de186c6250192866217cf8b2 [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
success("EmptyStruct") {
value = EmptyStruct{},
bytes = {
v2 = [
0x00, padding:7,
],
},
}
decode_failure("EmptyStructNonZeroBytes") {
type = EmptyStruct,
bytes = {
v2 = [
0x01, padding:7,
],
},
err = INVALID_EMPTY_STRUCT,
}
success("AnEmptyStructInStruct") {
value = AnEmptyStructInStruct{
v: EmptyStruct{},
},
bytes = {
v2 = [
0x00, padding:7,
],
},
}
decode_failure("AnEmptyStructInStructNonZeroBytes") {
bindings_denylist = [llcpp, hlcpp],
type = AnEmptyStructInStruct,
bytes = {
v2 = [
0x01, padding:7,
],
},
err = INVALID_EMPTY_STRUCT,
}
success("TwoEmptyStructsInStruct") {
value = TwoEmptyStructsInStruct{
a: EmptyStruct{},
b: EmptyStruct{},
},
bytes = {
v2 = [
0x00, 0x00, padding:6,
],
},
}
decode_failure("TwoEmptyStructsInStructNonZeroBytes") {
bindings_denylist = [llcpp, hlcpp],
type = TwoEmptyStructsInStruct,
bytes = {
v2 = [
0x00, 0x01, padding:6,
],
},
err = INVALID_EMPTY_STRUCT,
}
success("EmptyStructsInArrayInStruct") {
value = EmptyStructsInArrayInStruct{
v: [
EmptyStruct{},
EmptyStruct{},
EmptyStruct{},
EmptyStruct{},
],
},
bytes = {
v2 = [
0x00, 0x00, 0x00, 0x00, padding:4,
],
},
}
decode_failure("EmptyStructsInArrayInStructNonZeroBytes") {
bindings_denylist = [llcpp, hlcpp],
type = EmptyStructsInArrayInStruct,
bytes = {
v2 = [
0x00, 0x00, 0x00, 0x01, padding:4,
],
},
err = INVALID_EMPTY_STRUCT,
}
// Bindings that use iovec with vectors may have special handling.
success("EmptyStructsInVectorInStruct") {
value = EmptyStructsInVectorInStruct{
v: [
EmptyStruct{},
EmptyStruct{},
EmptyStruct{},
EmptyStruct{},
],
},
bytes = {
v2 = [
num(4):8,
repeat(0xff):8,
0x00, 0x00, 0x00, 0x00, padding:4,
],
},
}
// Bindings that use iovec with vectors may have special handling.
decode_failure("EmptyStructsInVectorInStructNonZeroBytes") {
bindings_denylist = [llcpp, hlcpp],
type = EmptyStructsInVectorInStruct,
bytes = {
v2 = [
num(4):8,
repeat(0xff):8,
0x00, 0x00, 0x00, 0x01, padding:4,
],
},
err = INVALID_EMPTY_STRUCT,
}
// Bindings that use iovec with vectors may have special handling.
success("TwoEmptyStructsInStructInVectorInStruct") {
value = TwoEmptyStructsInStructInVectorInStruct{
v: [
TwoEmptyStructsInStruct{
a: EmptyStruct{},
b: EmptyStruct{},
},
TwoEmptyStructsInStruct{
a: EmptyStruct{},
b: EmptyStruct{},
},
TwoEmptyStructsInStruct{
a: EmptyStruct{},
b: EmptyStruct{},
},
],
},
bytes = {
v2 = [
num(3):8,
repeat(0xff):8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, padding:2,
],
},
}
// Bindings that use iovec with vectors may have special handling.
decode_failure("TwoEmptyStructsInStructInVectorInStructNonZeroBytes") {
bindings_denylist = [llcpp, hlcpp],
type = TwoEmptyStructsInStructInVectorInStruct,
bytes = {
v2 = [
num(3):8,
repeat(0xff):8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, padding:2,
],
},
err = INVALID_EMPTY_STRUCT,
}
success("OptionalEmptyStructPresent") {
value = OptionalEmptyStructWrapper{
s: EmptyStruct{},
},
bytes = {
v2 = [
repeat(0xff):8,
0x00, padding:7,
],
},
}
success("OptionalEmptyStructAbsent") {
value = OptionalEmptyStructWrapper{},
bytes = {
v2 = [
repeat(0x00):8,
],
},
}
decode_failure("OptionalEmptyStructInvalidPresenceIndicator") {
bindings_denylist = [dart],
bytes = {
v2 = [
repeat(0xab):8,
],
},
type = OptionalEmptyStructWrapper,
err = INVALID_PRESENCE_INDICATOR,
}
success("RecursiveEmptyStruct") {
value = RecursiveEmptyStruct{ // 0
inner: RecursiveEmptyStruct{ // 1
inner: null,
},
},
bytes = {
v2 = [
repeat(0xff):8, // 0
repeat(0x00):8, // 1
],
},
}
success("RecursiveEmptyStructArrayWrapper") {
// gidl-format off
value = RecursiveEmptyStructArrayWrapper { // 0
arr: [ // 0
RecursiveEmptyStruct { // 0
inner: RecursiveEmptyStruct { // 1
inner: null,
}
}
]
},
// gidl-format on
bytes = {
v2 = [
repeat(0xff):8, // 0
repeat(0x00):8, // 1
],
},
}
success("RecursiveEmptyStructVectorWrapper") {
value = RecursiveEmptyStructVectorWrapper{ // 0
vec: [
RecursiveEmptyStruct{ // 1
inner: null,
},
],
},
bytes = {
v2 = [
num(1):8, // vector count
repeat(0xff):8, // vector data
repeat(0x00):8, // 1
],
},
}