Added more tests
This commit is contained in:
@ -10,16 +10,31 @@ import (
|
||||
"git.akyoto.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestPrograms(t *testing.T) {
|
||||
var tests = []struct {
|
||||
Name string
|
||||
ExpectedOutput string
|
||||
ExpectedExitCode int
|
||||
}{
|
||||
{"successive-calls.q", "", 9},
|
||||
}
|
||||
var programs = []struct {
|
||||
Name string
|
||||
ExpectedOutput string
|
||||
ExpectedExitCode int
|
||||
}{
|
||||
{"empty.q", "", 0},
|
||||
{"square-sum.q", "", 25},
|
||||
{"multi-calls.q", "", 9},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
func BenchmarkPrograms(b *testing.B) {
|
||||
for _, test := range programs {
|
||||
b.Run(test.Name, func(b *testing.B) {
|
||||
compiler := build.New(filepath.Join("programs", test.Name))
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := compiler.Run()
|
||||
assert.Nil(b, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrograms(t *testing.T) {
|
||||
for _, test := range programs {
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
run(t, filepath.Join("programs", test.Name), test.ExpectedOutput, test.ExpectedExitCode)
|
||||
})
|
||||
|
Reference in New Issue
Block a user