Add parser tests

This commit is contained in:
Richard Patel
2018-12-18 15:31:09 +01:00
parent f90bf94a44
commit 4b8275c7bf
4 changed files with 4913 additions and 5 deletions

21
crawl_test.go Normal file
View File

@@ -0,0 +1,21 @@
package main
import (
"github.com/terorie/od-database-crawler/fasturl"
"testing"
)
func BenchmarkParseDir(b *testing.B) {
for n := 0; n < b.N; n++ {
var u fasturl.URL
err := u.Parse("http://archive.ubuntu.com/ubuntu/indices/")
if err != nil {
b.Fatal("Failed to parse URL", err)
}
_, err = ParseDir([]byte(apache2Listing), &u)
if err != nil {
b.Fatal("Failed to extract links", err)
}
}
}