Skip to content

Commit

Permalink
Fix Benchmark tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmorgan committed Jun 1, 2024
1 parent 1b8ff35 commit 20de37f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions parser/execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion parser/tokenise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 20de37f

Please sign in to comment.