Skip to content

Commit

Permalink
renamed directory tests to testdata and added a benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
dchenk committed Jan 29, 2018
1 parent 4260fa1 commit 167a9d7
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func TestRender(t *testing.T) {

for _, n := range pairNames {

ops, err := ioutil.ReadFile("./tests/" + n + ".json")
ops, err := ioutil.ReadFile("./testdata/" + n + ".json")
if err != nil {
t.Errorf("could not read %s.json; %s", n, err)
t.FailNow()
}

html, err := ioutil.ReadFile("./tests/" + n + ".html")
html, err := ioutil.ReadFile("./testdata/" + n + ".html")
if err != nil {
t.Errorf("could not read %s.html; %s", n, err)
t.FailNow()
Expand All @@ -85,3 +85,18 @@ func TestRender(t *testing.T) {
}

}

func BenchmarkRender_ops1(b *testing.B) {
bts, err := ioutil.ReadFile("./testdata/ops1.json")
if err != nil {
b.Fatalf("could not read ops file: %s", err)
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
bts, err := Render(bts)
if err != nil {
b.Errorf("error rendering: %s", err)
}
_ = bts
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 167a9d7

Please sign in to comment.