File: proposal_test.go

package info (click to toggle)
golang-github-la5nta-wl2k-go 0.11.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,856 kB
  • sloc: ansic: 14; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved.
// Use of this source code is governed by the MIT-license that can be
// found in the LICENSE file.

package fbb

import (
	"reflect"
	"testing"
)

func TestParseProposal(t *testing.T) {
	tests := map[string]Proposal{
		"FC EM TJKYEIMMHSRB 527 123 0": Proposal{
			code:           Wl2kProposal,
			msgType:        "EM",
			mid:            "TJKYEIMMHSRB",
			offset:         0,
			size:           527,
			compressedSize: 123,
		},
	}

	for input, expected := range tests {
		got := Proposal{}
		err := parseProposal(input, &got)
		if err != nil {
			t.Errorf("Got unexpected error while parsing proposal '%s': %s", input, err)
		} else if !reflect.DeepEqual(got, expected) {
			t.Errorf("Got %#v, expected %#v while parsing '%s'", got, expected, input)
		}
	}
}