aboutsummaryrefslogtreecommitdiff
path: root/ber/bool_test.go
blob: 7471a332f42567b80ccdd868141e992ebce97ad1 (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)
		}
	}
}