]>
Commit | Line | Data |
---|---|---|
6988a057 JH |
1 | package hotline |
2 | ||
3 | import ( | |
92a7e455 JH |
4 | "fmt" |
5 | "github.com/stretchr/testify/assert" | |
6988a057 JH |
6 | "testing" |
7 | ) | |
8 | ||
050407a3 JH |
9 | func TestFlatFileInformationFork_UnmarshalBinary(t *testing.T) { |
10 | type args struct { | |
11 | b []byte | |
12 | } | |
13 | tests := []struct { | |
14 | name string | |
15 | args args | |
16 | wantErr assert.ErrorAssertionFunc | |
17 | }{ | |
18 | { | |
19 | name: "when zero length comment size is omitted (Nostalgia client behavior)", | |
20 | args: args{ | |
21 | b: []byte{ | |
22 | 0x41, 0x4d, 0x41, 0x43, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x62, 0x65, 0x61, 0x72, 0x2e, 0x74, 0x69, 0x66, 0x66, | |
23 | }, | |
24 | }, | |
25 | wantErr: assert.NoError, | |
26 | }, | |
27 | { | |
28 | name: "when zero length comment size is included", | |
29 | args: args{ | |
30 | b: []byte{ | |
31 | 0x41, 0x4d, 0x41, 0x43, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x62, 0x65, 0x61, 0x72, 0x2e, 0x74, 0x69, 0x66, 0x66, 0x00, 0x00, | |
32 | }, | |
33 | }, | |
34 | wantErr: assert.NoError, | |
35 | }, | |
36 | } | |
37 | for _, tt := range tests { | |
38 | t.Run(tt.name, func(t *testing.T) { | |
39 | ffif := &FlatFileInformationFork{} | |
40 | tt.wantErr(t, ffif.UnmarshalBinary(tt.args.b), fmt.Sprintf("UnmarshalBinary(%v)", tt.args.b)) | |
050407a3 JH |
41 | }) |
42 | } | |
43 | } |