forked from DHowett/go-plist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
text_test.go
40 lines (35 loc) · 824 Bytes
/
text_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package plist
import (
"bytes"
"io/ioutil"
"testing"
)
func BenchmarkOpenStepGenerate(b *testing.B) {
for i := 0; i < b.N; i++ {
d := newTextPlistGenerator(ioutil.Discard, OpenStepFormat)
d.generateDocument(plistValueTree)
}
}
func BenchmarkOpenStepParse(b *testing.B) {
buf := bytes.NewReader([]byte(plistValueTreeAsOpenStep))
b.ResetTimer()
for i := 0; i < b.N; i++ {
b.StartTimer()
d := newTextPlistParser(buf)
d.parseDocument()
b.StopTimer()
buf.Seek(0, 0)
}
}
func BenchmarkGNUStepParse(b *testing.B) {
buf := bytes.NewReader([]byte(plistValueTreeAsGNUStep))
b.ResetTimer()
for i := 0; i < b.N; i++ {
b.StartTimer()
d := newTextPlistParser(buf)
d.parseDocument()
b.StopTimer()
buf.Seek(0, 0)
}
}
// The valid text test cases have been merged into the common/global test cases.