aboutsummaryrefslogtreecommitdiff
path: root/ber/bool_test.go
blob: 360c3b995930f4d3040830b3db37477de2a05f1d (plain)
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
package ber

import "testing"

type boolTest struct {
	in  bool
	out byte
}

var boolTestData = []boolTest{
	{true, 0xFF},
	{false, 0x00},
}

func TestBool(t *testing.T) {
	for _, test := range boolTestData {
		a := MarshalBool(test.in)
		if a != test.out {
			t.Error(test.in, "expected", test.out, "got", a)
		}
		n := UnmarshalBool(test.out)
		if n != test.in {
			t.Error(test.out, "expected", test.in, "got", n)
		}
	}
}