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

Function TestIsPowerOfTwo

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

Source from the content-addressed store, hash-verified

36}
37
38func TestIsPowerOfTwo(t *testing.T) {
39 tests := getTestsForPowerOfTwo()
40 for _, tv := range tests {
41 t.Run(tv.name, func(t *testing.T) {
42 result := IsPowerOfTwo(tv.a)
43 t.Log(tv.a, " ", result)
44 if result != tv.missing {
45 t.Errorf("Wrong result! Expected:%v, returned:%v ", tv.missing, result)
46 }
47 })
48 }
49}
50
51func TestIsPowerOfTwoLeftShift(t *testing.T) {
52 tests := getTestsForPowerOfTwo()

Callers

nothing calls this directly

Calls 2

IsPowerOfTwoFunction · 0.85
getTestsForPowerOfTwoFunction · 0.70

Tested by

no test coverage detected