clone

fifteen puzzle games for the terminal, with daily puzzles, weekly ladders and xp, built on bubble tea

skip benchmark on short test

Dami committed 31aba7f
commit
31aba7fdb0740572e0f5f60658a9afa02c33604f
parent
28e7fd57edca7cf472c74e91f3347a7164518cc9
author
Dami <dami.etoile@gmail.com>
9 files changed, +107 -0
Mhashiwokakero/benchmark_test.go11+++++++++++
Mhitori/benchmark_test.go11+++++++++++
Mlightsout/benchmark_test.go11+++++++++++
Mnonogram/nonogram_test.go11+++++++++++
Mnurikabe/nurikabe_test.go11+++++++++++
Mshikaku/benchmark_test.go11+++++++++++
Msudoku/benchmark_test.go19+++++++++++++++++++
Mtakuzu/benchmark_test.go11+++++++++++
Mwordsearch/benchmark_test.go11+++++++++++
M hashiwokakero/benchmark_test.go +11 -0
M hitori/benchmark_test.go +11 -0
M lightsout/benchmark_test.go +11 -0
M nonogram/nonogram_test.go +11 -0
M nurikabe/nurikabe_test.go +11 -0
M shikaku/benchmark_test.go +11 -0
M sudoku/benchmark_test.go +19 -0
@@ -6,6 +6,13 @@ import (
66 "testing"77 )88 9+func skipBenchmarkInShortMode(b *testing.B) {10+ b.Helper()11+ if testing.Short() {12+ b.Skip("skipping benchmark in short mode")13+ }14+}15+916 func benchmarkSudokuModes() []SudokuMode {1017 return []SudokuMode{1118 NewMode("Beginner", "benchmark", 45),
@@ -18,6 +25,8 @@ func benchmarkSudokuModes() []SudokuMode {
1825 }1926 2027 func BenchmarkGenerateProvidedCellsByMode(b *testing.B) {28+ skipBenchmarkInShortMode(b)29+2130 for modeIndex, mode := range benchmarkSudokuModes() {2231 mode := mode2332 modeIndex := modeIndex
@@ -35,6 +44,8 @@ func BenchmarkGenerateProvidedCellsByMode(b *testing.B) {
3544 }3645 3746 func BenchmarkCountSolutionsByDifficulty(b *testing.B) {47+ skipBenchmarkInShortMode(b)48+3849 for modeIndex, mode := range benchmarkSudokuModes() {3950 mode := mode4051 modeIndex := modeIndex
@@ -60,6 +71,8 @@ func BenchmarkCountSolutionsByDifficulty(b *testing.B) {
6071 }6172 6273 func BenchmarkGenerateProvidedCellsSeededStable(b *testing.B) {74+ skipBenchmarkInShortMode(b)75+6376 mode := NewMode("Hard", "benchmark", 27)6477 b.ReportAllocs()6578 for i := 0; i < b.N; i++ {
@@ -72,6 +85,8 @@ func BenchmarkGenerateProvidedCellsSeededStable(b *testing.B) {
7285 }7386 7487 func BenchmarkCountSolutionsFixedPuzzle(b *testing.B) {88+ skipBenchmarkInShortMode(b)89+7590 mode := NewMode("Expert", "benchmark", 22)7691 cells := GenerateProvidedCellsSeeded(mode, rand.New(rand.NewPCG(42, 84)))7792 source := newGrid(cells)
@@ -91,6 +106,8 @@ func BenchmarkCountSolutionsFixedPuzzle(b *testing.B) {
91106 }92107 93108 func BenchmarkIsValidAllCells(b *testing.B) {109+ skipBenchmarkInShortMode(b)110+94111 mode := NewMode("Medium", "benchmark", 32)95112 cells := GenerateProvidedCellsSeeded(mode, rand.New(rand.NewPCG(7, 11)))96113 g := newGrid(cells)
@@ -113,6 +130,8 @@ func BenchmarkIsValidAllCells(b *testing.B) {
113130 }114131 115132 func BenchmarkCountSolutionsModesSummary(b *testing.B) {133+ skipBenchmarkInShortMode(b)134+116135 modes := benchmarkSudokuModes()117136 b.ReportAllocs()118137 for i := 0; i < b.N; i++ {
M takuzu/benchmark_test.go +11 -0
M wordsearch/benchmark_test.go +11 -0