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

Function getTestsForPowerOfTwo

math/checkisnumberpoweroftwo_test.go:13–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11)
12
13func getTestsForPowerOfTwo() []struct {
14 name string
15 a int
16 missing bool
17} {
18 var tests = []struct {
19 name string
20 a int
21 missing bool
22 }{
23 {"Is 64 a power of 2? - YES", 64, true},
24 {"Is 1 a power of 2? - YES", 1, true},
25 {"Is 2 a power of 2? - YES", 2, true},
26 {"Is 5 a power of 2? - NO", 5, false},
27 {"Is 1023 a power of 2? - NO", 1023, false},
28 {"Is 1024 a power of 2? - YES", 1024, true},
29 {"Is 0 a power of 2? - NO", 0, false},
30 {"Is 9223372036854775807 a power of 2? - NO", math.MaxInt64, false},
31 {"Is 9223372036854775806 a power of 2? - NO", math.MaxInt64, false},
32 {"Is 4611686018427387904 a power of 2? - YES", 4611686018427387904, true},
33 }
34 return tests
35}
36
37func TestIsPowOfTwoUseLog(t *testing.T) {
38 tests := getTestsForPowerOfTwo()

Callers 1

TestIsPowOfTwoUseLogFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected