-
Notifications
You must be signed in to change notification settings - Fork 2
/
symsquare_test.go
50 lines (43 loc) · 1.13 KB
/
symsquare_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
// See LICENSE.txt for licensing information.
// Tests the basics of the framework on a concrete Generator.
package ricons
import "testing"
func TestSymsquarePresent(t *testing.T) {
if gen, exist := Registry["symsquare"]; !exist {
t.Fatal("couldn't find 'symsquare' generator")
} else {
g = gen
}
}
func TestSymsquareStringer(t *testing.T) {
if g.String() != "symsquare: symmetric square-based icons" {
t.Errorf("stringer mismatch: %v != %v", "symsquare: symmetric square-based icons", g.String())
return
}
}
func BenchmarkSymsquare16x16(b *testing.B) {
g, ok := Registry["symsquare"]
if !ok {
b.Fatal("couldn't find 'symsquare' generator")
}
ic := NewIcon(16, 16)
b.ResetTimer()
for i := 0; i < b.N; i++ {
if err := g.Generate(ic); err != nil {
b.Fatalf("(%d) error generating icon: %s", i+1, err)
}
}
}
func BenchmarkSymsquare32x32(b *testing.B) {
g, ok := Registry["symsquare"]
if !ok {
b.Fatal("couldn't find 'symsquare' generator")
}
ic := NewIcon(32, 32)
b.ResetTimer()
for i := 0; i < b.N; i++ {
if err := g.Generate(ic); err != nil {
b.Fatalf("(%d) error generating icon: %s", i+1, err)
}
}
}