package network

import (
	"testing"
)

func TestBigEndian_BitSplit(t *testing.T) {
	u := String("0x30 0x10 0x20 0x10 0x10 0x10 0x00 0x10").Hex()
	if u == nil {
		t.Error()
		return
	}
	t.Log(u.HexTo())
	b, err := BigEndian.BitSplit(u)
	if err != nil {
		t.Error(err)
		return
	}
	t.Log(b)
}

func TestBigEndian_BitSplit_Single(t *testing.T) {
	n := uint8(36)
	bs, err := BigEndian.BitSplit([]byte{n})
	if err != nil {
		t.Error(err)
		return
	}
	t.Log(bs)
	t.Log(bs.Is1(2))
	t.Log(bs.Is0(1))
	t.Log(bs.Is0(7))
	t.Log(bs.Is1(7))
}

func TestLittleEndian_BitSplit(t *testing.T) {
	u := String("0x10 0x00 0x10 0x10 0x10 0x20 0x10 0x30").Hex()
	if u == nil {
		t.Error()
		return
	}
	t.Log(u.HexTo())
	b, err := LittleEndian.BitSplit(u)
	if err != nil {
		t.Error(err)
		return
	}
	t.Log(b)
}
