aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding_test.go
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@gmail.com>2023-11-09 17:07:58 +0100
committerAleksandr Nogikh <nogikh@google.com>2023-11-13 13:40:05 +0000
commitb531ad31dfd413ccc5ed21116a0556f3bd0107ae (patch)
tree6bc1dfba5d4b4b1d1f0fc037c8787d77834fbf51 /prog/encoding_test.go
parentb941cfc45894745b4b99d06c762cd78d3c6beca5 (diff)
prog, sys: test cases for struct AUTO
This commit adds a few test cases for the support of AUTO for structs. It covers: - A simple struct with only const and len types. - A nested struct case. - An error case when a struct has an int type field. Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'prog/encoding_test.go')
-rw-r--r--prog/encoding_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/prog/encoding_test.go b/prog/encoding_test.go
index daa2ac0cb..677375d7f 100644
--- a/prog/encoding_test.go
+++ b/prog/encoding_test.go
@@ -261,6 +261,18 @@ func TestDeserialize(t *testing.T) {
Err: `wrong type *prog.IntType for AUTO`,
},
{
+ In: `test$auto1(AUTO, &AUTO=AUTO, AUTO, 0x0)`,
+ Out: `test$auto1(0x42, &(0x7f0000000040)={0xc, 0x43, 0x0}, 0xc, 0x0)`,
+ },
+ {
+ In: `test$auto2(AUTO, &AUTO=AUTO, AUTO, 0x0)`,
+ Out: `test$auto2(0x42, &(0x7f0000000040)={0x10, {0xc, 0x43, 0x0}}, 0x10, 0x0)`,
+ },
+ {
+ In: `test$auto0(AUTO, &AUTO=AUTO, AUTO, 0x0)`,
+ Err: `wrong type *prog.IntType for AUTO`,
+ },
+ {
In: `test$str0(&AUTO="303100090a0d7022273a")`,
Out: `test$str0(&(0x7f0000000040)='01\x00\t\n\rp\"\':')`,
},