Example #1
0
func TestSublist(t *testing.T) {
	lst := []byte{1, 2, 3, 4}
	expected := [][]byte{{1, 2}, {3, 4}}
	sublists := list.Sublist(lst, 2)
	for i := range expected {
		assert.AssertBytesEquals(t, expected[i], sublists[i])
	}
}
Example #2
0
func TestHexaToBytes(t *testing.T) {
	assert.AssertBytesEquals(t, HexaToBytes("0f"), []byte{0x0f})
}
Example #3
0
func TestGroupBySize(t *testing.T) {
	res := groupBySix([]byte("Man"))
	assert.AssertBytesEquals(t, res, []byte{0x13, 0x16, 0x05, 0x2e})
}
Example #4
0
func TestXor(t *testing.T) {
	src := hexa.HexaToBytes("1c0111001f010100061a024b53535009181c")
	xor := hexa.HexaToBytes("686974207468652062756c6c277320657965")
	expected := hexa.HexaToBytes("746865206b696420646f6e277420706c6179")
	assert.AssertBytesEquals(t, Xor(src, xor), expected)
}