MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestIsPowOfTwoUseLog

Function TestIsPowOfTwoUseLog

math/binary/checkisnumberpoweroftwo_test.go:64–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestIsPowOfTwoUseLog(t *testing.T) {
65 tests := getTestsForPowerOfTwo()
66 for _, tv := range tests {
67 t.Run(tv.name, func(t *testing.T) {
68 result := math2.IsPowOfTwoUseLog(float64(tv.a))
69 t.Log(tv.a, " ", result)
70 if result != tv.missing {
71 t.Errorf("Wrong result! Expected:%v, returned:%v ", tv.missing, result)
72 }
73 })
74 }
75}
76
77func BenchmarkIsPowerOfTwoBinaryMethod(b *testing.B) {
78 for i := 0; i < b.N; i++ {

Callers

nothing calls this directly

Calls 1

getTestsForPowerOfTwoFunction · 0.70

Tested by

no test coverage detected