]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/news_test.go
Fix broken io.Reader implementations
[rbdr/mobius] / hotline / news_test.go
index 02e11a9e5ec29456cd429f5d5fc6af697a27d12b..a2102b23c79959147d0446252857fffcc2de0c5d 100644 (file)
@@ -1,21 +1,20 @@
 package hotline
 
 import (
-       "bytes"
        "reflect"
        "testing"
 )
 
 func TestNewsCategoryListData15_MarshalBinary(t *testing.T) {
        type fields struct {
-               Type     []byte
+               Type     [2]byte
                Name     string
                Articles map[uint32]*NewsArtData
                SubCats  map[string]NewsCategoryListData15
                Count    []byte
-               AddSN    []byte
-               DeleteSN []byte
-               GUID     []byte
+               AddSN    [4]byte
+               DeleteSN [4]byte
+               GUID     [16]byte
        }
        tests := []struct {
                name     string
@@ -26,7 +25,7 @@ func TestNewsCategoryListData15_MarshalBinary(t *testing.T) {
                {
                        name: "returns expected bytes when type is a bundle",
                        fields: fields{
-                               Type: []byte{0x00, 0x02},
+                               Type: [2]byte{0x00, 0x02},
                                Articles: map[uint32]*NewsArtData{
                                        uint32(1): {
                                                Title:  "",
@@ -47,7 +46,7 @@ func TestNewsCategoryListData15_MarshalBinary(t *testing.T) {
                {
                        name: "returns expected bytes when type is a category",
                        fields: fields{
-                               Type: []byte{0x00, 0x03},
+                               Type: [2]byte{0x00, 0x03},
                                Articles: map[uint32]*NewsArtData{
                                        uint32(1): {
                                                Title:  "",
@@ -76,13 +75,12 @@ func TestNewsCategoryListData15_MarshalBinary(t *testing.T) {
                                Name:     tt.fields.Name,
                                Articles: tt.fields.Articles,
                                SubCats:  tt.fields.SubCats,
-                               Count:    tt.fields.Count,
                                AddSN:    tt.fields.AddSN,
                                DeleteSN: tt.fields.DeleteSN,
                                GUID:     tt.fields.GUID,
                        }
                        gotData, err := newscat.MarshalBinary()
-                       if bytes.Equal(newscat.Type, []byte{0, 3}) {
+                       if newscat.Type == [2]byte{0, 3} {
                                // zero out the random GUID before comparison
                                for i := 4; i < 20; i++ {
                                        gotData[i] = 0