Rebase.
[official-gcc.git] / libgo / go / crypto / cipher / xor_test.go
blobcc1c9d72d5591d8130920f34bd6b29f14bb83020
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package cipher
7 import (
8 "bytes"
9 "testing"
12 func TestXOR(t *testing.T) {
13 for alignP := 0; alignP < 2; alignP++ {
14 for alignQ := 0; alignQ < 2; alignQ++ {
15 for alignD := 0; alignD < 2; alignD++ {
16 p := make([]byte, 1024)[alignP:]
17 q := make([]byte, 1024)[alignQ:]
18 d1 := make([]byte, 1024+alignD)[alignD:]
19 d2 := make([]byte, 1024+alignD)[alignD:]
20 xorBytes(d1, p, q)
21 safeXORBytes(d2, p, q)
22 if bytes.Compare(d1, d2) != 0 {
23 t.Error("not equal")