From 96c8d7924fb2e3e1a0b7e759347f53e16dbdac6d Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 12 Aug 2025 08:21:19 -0400 Subject: [PATCH] tape: Test that integers of a user-defined type can be encoded --- tape/dynamic_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tape/dynamic_test.go b/tape/dynamic_test.go index 8e1e83c..b77655c 100644 --- a/tape/dynamic_test.go +++ b/tape/dynamic_test.go @@ -6,6 +6,8 @@ import "testing" import "reflect" import tu "git.tebibyte.media/sashakoshka/hopp/internal/testutil" +type userDefinedInteger int16 + func TestEncodeAnyInt(test *testing.T) { err := testEncodeAny(test, uint8(0xCA), LI.WithCN(0), tu.S(0xCA)) if err != nil { test.Fatal(err) } @@ -23,7 +25,8 @@ func TestEncodeAnyTable(test *testing.T) { 0xFFFF: []uint16 { 0xBEE5, 0x7777 }, 0x1234: [][]uint16 { []uint16 { 0x5 }, []uint16 { 0x17, 0xAAAA} }, 0x2345: [][]int16 { []int16 { 0x5 }, []int16 { 0x17, -0xAAA } }, - }, KTV.WithCN(0), tu.S(6).AddVar( + 0x3456: userDefinedInteger(0x3921), + }, KTV.WithCN(0), tu.S(7).AddVar( []byte { 0xF3, 0xB9, byte(LSI.WithCN(3)), @@ -62,6 +65,11 @@ func TestEncodeAnyTable(test *testing.T) { 0, 0x17, 0xF5, 0x56, }, + []byte { + 0x34, 0x56, + byte(LSI.WithCN(1)), + 0x39, 0x21, + }, )) if err != nil { test.Fatal(err) } }