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

Function TestMu

math/mobius_test.go:14–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestMu(t *testing.T) {
15 var tests = []struct {
16 n int
17 expected int
18 }{
19 {-1, 1},
20 {0, 1},
21 {2, -1},
22 {3, -1},
23 {95, 1},
24 {97, -1},
25 {98, 0},
26 {99, 0},
27 {100, 0},
28 }
29 for _, test := range tests {
30 result := algmath.Mu(test.n)
31 t.Log(test.n, " ", result)
32 if result != test.expected {
33 t.Errorf("Wrong result! Expected:%v, returned:%v ", test.expected, result)
34 }
35 }
36}
37func BenchmarkMu(b *testing.B) {
38 for i := 0; i < b.N; i++ {
39 algmath.Mu(65536)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected