Skip to content

Commit 4f3821e

Browse files
committed
clean-up tests
1 parent 89e9f9f commit 4f3821e

File tree

2 files changed

+15
-91
lines changed

2 files changed

+15
-91
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
work/
2-
micro
3-
main
2+
ms

microsmith/program_test.go

Lines changed: 14 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,7 @@ import (
1111

1212
const WorkDir = "work"
1313

14-
var allTypes = []microsmith.Type{
15-
microsmith.BasicType{"bool"},
16-
microsmith.BasicType{"byte"},
17-
microsmith.BasicType{"int"},
18-
microsmith.BasicType{"int8"},
19-
microsmith.BasicType{"int16"},
20-
microsmith.BasicType{"int32"},
21-
microsmith.BasicType{"int64"},
22-
microsmith.BasicType{"uint"},
23-
microsmith.BasicType{"float32"},
24-
microsmith.BasicType{"float64"},
25-
microsmith.BasicType{"complex128"},
26-
microsmith.BasicType{"rune"},
27-
microsmith.BasicType{"string"},
28-
}
29-
30-
var TestConfigurations = map[string]microsmith.ProgramConf{
31-
"small": {
32-
MultiPkg: false,
33-
},
34-
35-
"medium": {
36-
MultiPkg: false,
37-
},
38-
39-
"big": {
40-
MultiPkg: false,
41-
},
42-
"huge": {
43-
MultiPkg: false,
44-
},
45-
}
46-
47-
// check n generated programs with go/types (in-memory)
14+
// check n generated programs with go/types
4815
func testProgramGoTypes(t *testing.T, n int, conf microsmith.ProgramConf) {
4916
for i := 0; i < n; i++ {
5017
gp := microsmith.NewProgram(conf)
@@ -59,68 +26,26 @@ func testProgramGoTypes(t *testing.T, n int, conf microsmith.ProgramConf) {
5926
}
6027
}
6128

62-
func TestRandConf(t *testing.T) {
63-
n := 10
29+
func TestNewProgram(t *testing.T) {
30+
n := 50
6431
if testing.Short() {
65-
n = 5
66-
}
67-
for i := 0; i < 10; i++ {
68-
// no multipkg, no typeparams
69-
testProgramGoTypes(t, n, microsmith.ProgramConf{})
32+
n = 10
7033
}
34+
testProgramGoTypes(t, n, microsmith.ProgramConf{})
7135
}
7236

73-
func TestRandConfTypeParams(t *testing.T) {
74-
n := 10
37+
func TestNewProgramTP(t *testing.T) {
38+
n := 50
7539
if testing.Short() {
76-
n = 5
77-
}
78-
for i := 0; i < 10; i++ {
79-
testProgramGoTypes(
80-
t, n,
81-
microsmith.ProgramConf{
82-
MultiPkg: false,
83-
TypeParams: true,
84-
})
40+
n = 10
8541
}
86-
}
87-
88-
func TestSmall(t *testing.T) {
89-
lim := 100
90-
if testing.Short() {
91-
lim = 10
92-
}
93-
testProgramGoTypes(t, lim, TestConfigurations["small"])
94-
}
95-
96-
func TestMedium(t *testing.T) {
97-
lim := 100
98-
if testing.Short() {
99-
lim = 10
100-
}
101-
testProgramGoTypes(t, lim, TestConfigurations["medium"])
102-
}
10342

104-
func TestBig(t *testing.T) {
105-
lim := 10
106-
if testing.Short() {
107-
lim = 2
108-
}
109-
testProgramGoTypes(t, lim, TestConfigurations["big"])
110-
}
111-
112-
func TestHuge(t *testing.T) {
113-
lim := 5
114-
if testing.Short() {
115-
lim = 1
116-
}
117-
testProgramGoTypes(t, lim, TestConfigurations["huge"])
118-
}
119-
120-
func TestTypeParams(t *testing.T) {
121-
conf := TestConfigurations["medium"]
122-
conf.TypeParams = true
123-
testProgramGoTypes(t, 50, conf)
43+
testProgramGoTypes(
44+
t, n,
45+
microsmith.ProgramConf{
46+
MultiPkg: false,
47+
TypeParams: true,
48+
})
12449
}
12550

12651
func GetToolchain() string {

0 commit comments

Comments
 (0)