-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7be02d9
commit 4b0974e
Showing
1 changed file
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
} | ||
} | ||
} |