Last active
August 29, 2015 14:05
-
-
Save lacolaco/aef7b701d66f21e2a87d to your computer and use it in GitHub Desktop.
bbop in golangのテストコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package la0c | |
import ( | |
"strings" | |
"testing" | |
) | |
func TestCalcMatchCount(t *testing.T) { | |
noMatch := "レ,ド,ッ,ビ,ビ,ッ,レ,・,レ,ビ,ビ,ー,ド,ン" | |
if CalcMatchCount(strings.Split(noMatch, ",")) != 0 { | |
t.Errorf("it's no match") | |
} | |
if CalcMatchCount(strings.Split(ANSWER, ",")) != 9 { | |
t.Errorf("it's perfect match") | |
} | |
} | |
func BenchmarkTryNoSeed(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
TryBBOP("") | |
} | |
} | |
func BenchmarkTryLongSeed(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
TryBBOP("Foooooooooooooooooooooooooooooooooooooooooo") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkTryNoSeed 500000 4096 ns/op | |
BenchmarkTryLongSeed 500000 4844 ns/op |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment