mirror of
https://github.com/golang/go
synced 2024-11-18 19:34:41 -07:00
math/bits: move tests into their own package
This makes math/bits not have any explicit imports even when compiling tests and thereby avoids import cycles when dependencies of testing want to import math/bits. Change-Id: I95eccae2f5c4310e9b18124abfa85212dfbd9daa Reviewed-on: https://go-review.googlesource.com/110479 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7f6105f138
commit
8c4170b2c9
@ -2,9 +2,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package bits
|
package bits_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
. "math/bits"
|
||||||
"testing"
|
"testing"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@ -83,7 +84,7 @@ func TestLeadingZeros(t *testing.T) {
|
|||||||
// Exported (global) variable serving as input for some
|
// Exported (global) variable serving as input for some
|
||||||
// of the benchmarks to ensure side-effect free calls
|
// of the benchmarks to ensure side-effect free calls
|
||||||
// are not optimized away.
|
// are not optimized away.
|
||||||
var Input uint64 = deBruijn64
|
var Input uint64 = DeBruijn64
|
||||||
|
|
||||||
// Exported (global) variable to store function results
|
// Exported (global) variable to store function results
|
||||||
// during benchmarking to ensure side-effect free calls
|
// during benchmarking to ensure side-effect free calls
|
||||||
@ -333,7 +334,7 @@ func BenchmarkOnesCount64(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRotateLeft(t *testing.T) {
|
func TestRotateLeft(t *testing.T) {
|
||||||
var m uint64 = deBruijn64
|
var m uint64 = DeBruijn64
|
||||||
|
|
||||||
for k := uint(0); k < 128; k++ {
|
for k := uint(0); k < 128; k++ {
|
||||||
x8 := uint8(m)
|
x8 := uint8(m)
|
||||||
|
7
src/math/bits/export_test.go
Normal file
7
src/math/bits/export_test.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package bits
|
||||||
|
|
||||||
|
const DeBruijn64 = deBruijn64
|
Loading…
Reference in New Issue
Block a user