aboutsummaryrefslogtreecommitdiff
path: root/ber/bitstring_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/bitstring_test.go')
-rw-r--r--ber/bitstring_test.go73
1 files changed, 0 insertions, 73 deletions
diff --git a/ber/bitstring_test.go b/ber/bitstring_test.go
deleted file mode 100644
index 3c67228..0000000
--- a/ber/bitstring_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package ber
-
-import (
- "bytes"
- "testing"
-)
-
-type bitTest struct {
- bytes []byte
- bits BitString
-}
-
-var bitTestData = []bitTest{
- {
- []byte{0, 8, 0},
- BitString{
- false, false, false, false, true, false, false, false,
- false, false, false, false, false, false, false, false,
- },
- },
- {
- []byte{7, 0x80},
- BitString{true},
- },
- {
- []byte{4, 0x20},
- BitString{false, false, true, false},
- },
-}
-
-func bitsEqual(a, b BitString) bool {
- if len(a) != len(b) {
- return false
- }
- for i := range a {
- if a[i] != b[i] {
- return false
- }
- }
- return true
-}
-
-func TestBitString(t *testing.T) {
- for _, test := range bitTestData {
- bi := UnmarshalBitString(test.bytes)
- if !bitsEqual(bi, test.bits) {
- t.Error(test.bytes, "expexted", test.bits, "got", bi)
- }
- by := MarshalBitString(test.bits)
- if !bytes.Equal(by, test.bytes) {
- t.Error(test.bits, "expexted", test.bytes, "got", by)
- }
- }
-}
-
-func TestSet(t *testing.T) {
- bs := BitString{true, false}
- bs.Set(4)
- ex := BitString{true, false, false, false, true, false, false, false}
- if !bs.Equal(ex) {
- t.Error("expexted", ex, "got", bs)
- }
- bs = bs[:4]
- bs.Set(3)
- ex = BitString{true, false, false, true}
- if !bs.Equal(ex) {
- t.Error("expexted", ex, "got", bs)
- }
- bs.Clear(0)
- if bs.IsSet(0) {
- t.Error("got", bs)
- }
-}