use t.Run for tests

This commit is contained in:
Joel Wetzell
2026-02-27 22:30:52 -06:00
parent 0b20f3ffb9
commit eb8c6aba19
26 changed files with 208 additions and 273 deletions
@@ -1,7 +1,6 @@
package decoders
import (
"fmt"
"reflect"
"testing"
@@ -32,18 +31,17 @@ func TestGoodDataTrackerTimestampChunk(t *testing.T) {
for _, testCase := range testCases {
actual, err := DecodeDataTrackerTimestampChunk(testCase.bytes)
t.Run(testCase.description, func(t *testing.T) {
actual, err := DecodeDataTrackerTimestampChunk(testCase.bytes)
if err != nil {
t.Errorf("Test '%s' failed to decode chunk properly", testCase.description)
fmt.Println(err)
}
if err != nil {
t.Errorf("failed to decode chunk properly, error: %v", err)
}
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("Test '%s' failed to decode chunk properly", testCase.description)
fmt.Printf("expected: %v\n", testCase.expected)
fmt.Printf("actual: %v\n", actual)
}
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("failed to decode chunk properly, expected: %+v, actual: %+v", testCase.expected, actual)
}
})
}
}