From cfc42b9ca72a0ca5df173e832d279719533fb566 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 29 Mar 2024 21:19:58 +0000 Subject: [PATCH] Make test less obscure as per PR discussion --- kaitai/struct_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kaitai/struct_test.go b/kaitai/struct_test.go index 59deca3..9c98dba 100644 --- a/kaitai/struct_test.go +++ b/kaitai/struct_test.go @@ -27,20 +27,20 @@ func (s *twoStruct) Kaitai_IO() *Stream { func WorkWithStruct(s Struct, t *testing.T, expectedSize int) { actualSize, err := s.Kaitai_IO().Size() - assert.Equal(t, actualSize, int64(expectedSize)) assert.Nil(t, err) + assert.Equal(t, actualSize, int64(expectedSize)) } func TestKaitaiStruct(t *testing.T) { // Instantiate streams for the structs - oneStream := NewStream(bytes.NewReader([]byte("a"))) - twoStream := NewStream(bytes.NewReader([]byte("ab"))) + oneStream := NewStream(bytes.NewReader([]byte("a quick"))) + twoStream := NewStream(bytes.NewReader([]byte("brown fox"))) // Instantiate the structs - one := oneStruct{1, oneStream} - two := twoStruct{2, twoStream} + one := oneStruct{111, oneStream} + two := twoStruct{222, twoStream} // Check if the structs implement the Struct interface - WorkWithStruct(&one, t, 1) - WorkWithStruct(&two, t, 2) + WorkWithStruct(&one, t, 7) + WorkWithStruct(&two, t, 9) }