示例#1
0
func TestSet(t *testing.T) {
	for i := 0; i < 256; i++ {
		if int(bits.SetU32(uint32(i))) != bits.Hamming(i, 0) {
			t.Errorf("Error in set: wanted %v for %v, got %v",
				bits.Hamming(i, 0), i, bits.SetU32(uint32(i)))
		}
	}
}
示例#2
0
func BenchmarkSetU32(b *testing.B) {
	for i := 0; i < b.N; i++ {
		bits.SetU32(uint32(i))
	}
}