Files
psn-go/internal/encoders/data_tracker_status_chunk_test.go
T

39 lines
786 B
Go

package encoders
import (
"fmt"
"reflect"
"testing"
"github.com/jwetzell/psn-go/internal/chunks"
)
func TestDataTrackerStatusChunkEncoding(t *testing.T) {
testCases := []struct {
description string
expected []byte
data chunks.DataTrackerStatusChunkData
}{
{
description: "basic status",
expected: []byte{
3, 0, 4, 0, 0, 0, 128, 63,
},
data: chunks.DataTrackerStatusChunkData{
Validity: 1,
},
},
}
for _, testCase := range testCases {
actual := EncodeDataTrackerStatusChunk(testCase.data.Validity)
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("Test '%s' failed to encode chunk properly", testCase.description)
fmt.Printf("expected: %v\n", testCase.expected)
fmt.Printf("actual: %v\n", actual)
}
}
}