bench outputs expected result

This commit is contained in:
Daniel Kang 2019-01-10 14:51:20 -08:00
parent 8e5657d67c
commit 54bea46d19

View file

@ -23,9 +23,9 @@ func runFib(n int) {
input := `
fib := func(x) {
if(x == 0) {
if x == 0 {
return 0
} else if(x == 1) {
} else if x == 1 {
return 1
} else {
return fib(x-1) + fib(x-2)
@ -42,6 +42,8 @@ fib := func(x) {
panic(fmt.Errorf("wrong result: %d != %d", nativeResult, int(result.(*objects.Int).Value)))
}
fmt.Printf("fib(%d) = %d\n", n, nativeResult)
fmt.Println("-------------------------------------")
fmt.Printf("Go: %s\n", nativeTime)
fmt.Printf("Parser: %s\n", parseTime)
fmt.Printf("Compile: %s\n", compileTime)