From 20de37f24b52a39e22c967ecbef02dce9a3e8395 Mon Sep 17 00:00:00 2001 From: Tristan Morgan Date: Sat, 1 Jun 2024 19:49:58 +1000 Subject: [PATCH] Fix Benchmark tests. --- parser/execute_test.go | 4 ++-- parser/tokenise_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parser/execute_test.go b/parser/execute_test.go index 1cb6288..01a58a6 100644 --- a/parser/execute_test.go +++ b/parser/execute_test.go @@ -67,11 +67,11 @@ func BenchmarkExecute(b *testing.B) { b.Errorf("error opening program: err:") } buff := bufio.NewReader(sourceFile) - inputBuf := bufio.NewReader(strings.NewReader("80\n")) - outputBuf := bufio.NewWriter(&bufferWriter{}) program, _ := Tokenise(buff) b.ResetTimer() for i := 0; i < b.N; i++ { + inputBuf := bufio.NewReader(strings.NewReader("80\n")) + outputBuf := bufio.NewWriter(&bufferWriter{}) startdata := make([]int, 65536) Execute(startdata, program, inputBuf, outputBuf) } diff --git a/parser/tokenise_test.go b/parser/tokenise_test.go index eadb189..7c0c37a 100644 --- a/parser/tokenise_test.go +++ b/parser/tokenise_test.go @@ -157,9 +157,9 @@ func BenchmarkTokenise(b *testing.B) { if err != nil { b.Errorf("error opening program: err:") } - buff := bufio.NewReader(sourceFile) b.ResetTimer() for i := 0; i < b.N; i++ { + buff := bufio.NewReader(sourceFile) Tokenise(buff) } }