File: utils_test.go

package info (click to toggle)
golang-github-zeebo-blake3 0.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 616 kB
  • sloc: asm: 3,013; python: 67; makefile: 29
file content (25 lines) | stat: -rw-r--r-- 402 bytes parent folder | download
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
package utils

import (
	"testing"
	"unsafe"

	"github.com/zeebo/assert"
	"github.com/zeebo/blake3/internal/consts"
)

func TestBytesToWords(t *testing.T) {
	if !consts.OptimizeLittleEndian {
		t.SkipNow()
	}

	var bytes [64]uint8
	for i := range bytes {
		bytes[i] = byte(i)
	}

	var words [16]uint32
	BytesToWords(&bytes, &words)

	assert.Equal(t, *(*[16]uint32)(unsafe.Pointer(&bytes[0])), words)
}