github.com/la5nta/wl2k-go@v0.11.8/fbb/proposal_test.go (about) 1 // Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved. 2 // Use of this source code is governed by the MIT-license that can be 3 // found in the LICENSE file. 4 5 package fbb 6 7 import ( 8 "reflect" 9 "testing" 10 ) 11 12 func TestParseProposal(t *testing.T) { 13 tests := map[string]Proposal{ 14 "FC EM TJKYEIMMHSRB 527 123 0": Proposal{ 15 code: Wl2kProposal, 16 msgType: "EM", 17 mid: "TJKYEIMMHSRB", 18 offset: 0, 19 size: 527, 20 compressedSize: 123, 21 }, 22 } 23 24 for input, expected := range tests { 25 got := Proposal{} 26 err := parseProposal(input, &got) 27 if err != nil { 28 t.Errorf("Got unexpected error while parsing proposal '%s': %s", input, err) 29 } else if !reflect.DeepEqual(got, expected) { 30 t.Errorf("Got %#v, expected %#v while parsing '%s'", got, expected, input) 31 } 32 } 33 }