From 54bea46d19ca12e79ef9b85107a7173ec69ec3b8 Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Thu, 10 Jan 2019 14:51:20 -0800 Subject: [PATCH] bench outputs expected result --- cmd/bench/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/bench/main.go b/cmd/bench/main.go index 316e7fd..6787b1a 100644 --- a/cmd/bench/main.go +++ b/cmd/bench/main.go @@ -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)