good morning!!!!

Skip to content
Snippets Groups Projects
Commit 6006b0de authored by Garet Halliday's avatar Garet Halliday
Browse files

add lexer bench

parent cb33badc
No related branches found
Tags v0.0.10
No related merge requests found
......@@ -2,9 +2,7 @@ package pg3p
import "testing"
func TestParser_Lex(t *testing.T) {
const test = `
const TestQuery1 = `
-- single line comment
/*
multi
......@@ -50,9 +48,18 @@ wow
;||/;
`
func TestParser_Lex(t *testing.T) {
parser := NewParser()
lexed := parser.Lex(test)
lexed := parser.Lex(TestQuery1)
if len(lexed) != 13 {
t.Errorf("expected 13 tokens! (got %#v)", lexed)
}
}
func BenchmarkParser_Lex(b *testing.B) {
b.ReportAllocs()
parser := NewParser()
for i := 0; i < b.N; i++ {
parser.Lex(TestQuery1)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment