-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgsc_test.go
49 lines (46 loc) · 947 Bytes
/
gsc_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
package sprites
import (
"os"
"testing"
)
func BenchmarkSprites(B *testing.B) {
f, err := os.Open("games/en/crystal.gbc")
if err != nil {
B.Skip("couldn't open crystal.gbc:", err)
}
defer f.Close()
rip, err := NewRipper(f)
if err != nil {
B.Fatal("couldn't open ripper:", err)
}
for i := 0; i < B.N; i++ {
for n := 1; n <= 251; n++ {
_, err := rip.Pokemon(n)
if err != nil {
B.Errorf("error while ripping sprite %d: %s", n, err)
}
}
}
}
func BenchmarkAnimations(B *testing.B) {
f, err := os.Open("games/en/crystal.gbc")
if err != nil {
B.Skip("couldn't open crystal.gbc:", err)
}
defer f.Close()
rip, err := NewRipper(f)
if err != nil {
B.Fatal("couldn't open ripper:", err)
}
for i := 0; i < B.N; i++ {
for n := 1; n <= 251; n++ {
if n == 201 {
continue
}
_, err := rip.PokemonAnimation(n)
if err != nil {
B.Errorf("error while ripping animation %d: %s", n, err)
}
}
}
}