unify-byte-counts #21

Merged
sashakoshka merged 16 commits from unify-byte-counts into main 2025-10-13 08:49:49 -06:00
Showing only changes of commit 7a03d8d6b5 - Show all commits

View File

@@ -335,3 +335,24 @@ func TestTagAny(test *testing.T) {
}
}
}
func TestDecodeAny(test *testing.T) {
for index, payload := range samplePayloads {
correctValue := sampleValues[index]
data := payload[1:]
decoder := NewDecoder(bytes.NewBuffer(data))
tag := Tag(payload[0])
decoded, n, err := DecodeAny(decoder, tag)
test.Log("n: ", n)
test.Log("tag: ", tag)
test.Log("got: ", tu.Describe(decoded))
test.Log("correct:", tu.Describe(correctValue))
if err != nil { test.Fatal(err) }
if !reflect.DeepEqual(decoded, correctValue) {
test.Fatal("values not equal")
}
if n != len(data) {
test.Fatalf("n not equal: %d != %d", n, len(data))
}
}
}