-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_test.go
52 lines (45 loc) · 1.13 KB
/
benchmark_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"math/rand"
"testing"
"time"
)
func BenchmarkSimulation(b *testing.B) {
rand.Seed(time.Now().UnixNano())
rueel := newRueelBuilder().
startWith(100_000).
use(halfOnYellowStrategy).
stopIfScrapsReach(1_000_000_000_000_000_000).
stopIfNIterationIs(1_000_000).
build()
// rueel := rueel{
// scraps: 1000,
// scrapsGoal: 1_000_000,
// strategy: halfOnYellowStrategy,
// maxIteration: 1,
// nIteration: 0,
// analytics: analytics{
// outcomeDistribution: map[color]int{YELLOW: 0, GREEN: 0, BLUE: 0, PURPLE: 0, RED: 0},
// },
// }
for i := 0; i < b.N; i++ {
// rueel := newRueelBuilder().
// startWith(1000).
// use(halfOnYellowStrategy).
// stopIfScrapsReach(1_000_000).
// stopIfNIterationIs(1).
// build()
// rueel := rueel{
// scraps: 1000,
// scrapsGoal: 1_000_000,
// strategy: halfOnYellowStrategy,
// maxIteration: 1,
// nIteration: 0,
// analytics: analytics{
// outcomeDistribution: map[color]int{YELLOW: 0, GREEN: 0, BLUE: 0, PURPLE: 0, RED: 0},
// },
// }
rueel.simulate()
// fmt.Println(rueel.report())
}
}