Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix benchmarktests #557

Merged
merged 1 commit into from
Jan 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions models/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,29 @@ func BenchmarkGetCommitGraph(b *testing.B) {
b.Error("Could not open repository")
}

graph, err := GetCommitGraph(currentRepo)
if err != nil {
b.Error("Could get commit graph")
}

if len(graph) < 100 {
b.Error("Should get 100 log lines.")
for i := 0; i < b.N; i++ {
graph, err := GetCommitGraph(currentRepo)
if err != nil {
b.Error("Could get commit graph")
}

if len(graph) < 100 {
b.Error("Should get 100 log lines.")
}
}
}

func BenchmarkParseCommitString(b *testing.B) {
testString := "* DATA:||4e61bacab44e9b4730e44a6615d04098dd3a8eaf|2016-12-20 21:10:41 +0100|Kjell Kvinge|[email protected]|4e61bac|Add route for graph"

graphItem, err := graphItemFromString(testString, nil)
if err != nil {
b.Error("could not parse teststring")
}
for i := 0; i < b.N; i++ {
graphItem, err := graphItemFromString(testString, nil)
if err != nil {
b.Error("could not parse teststring")
}

if graphItem.Author != "Kjell Kvinge" {
b.Error("Did not get expected data")
if graphItem.Author != "Kjell Kvinge" {
b.Error("Did not get expected data")
}
}
}