@@ -6,16 +6,16 @@ import (
66
77 "github.com/stretchr/testify/assert"
88
9- new51degrees "github.com/IncSW/go-51degrees"
10- old51degrees "github.com/IncSW/go-51degrees/test/51degrees"
9+ go51degrees "github.com/IncSW/go-51degrees"
10+ cgo51degrees "github.com/IncSW/go-51degrees/test/51degrees"
1111)
1212
1313func TestReader (t * testing.T ) {
14- reader , err := new51degrees .NewReaderFromFile ("./51Degrees-EnterpriseV3.4.trie" )
14+ reader , err := go51degrees .NewReaderFromFile ("./51Degrees-EnterpriseV3.4.trie" )
1515 if err != nil {
1616 t .Fatal (err )
1717 }
18- provider := old51degrees .NewProvider ("./51Degrees-EnterpriseV3.4.trie" )
18+ provider := cgo51degrees .NewProvider ("./51Degrees-EnterpriseV3.4.trie" )
1919
2020 for i , userAgent := range userAgents {
2121 device := reader .MatchDevice (userAgent )
@@ -28,19 +28,19 @@ func TestReader(t *testing.T) {
2828 ! assert .Equal (t , device .GetValue ("BrowserVersion" ), match .GetValue ("BrowserVersion" ), userAgent ) ||
2929 ! assert .Equal (t , device .GetValue ("IsCrawler" ), match .GetValue ("IsCrawler" ), userAgent ) ||
3030 ! assert .Equal (t , device .GetValue ("DeviceType" ), match .GetValue ("DeviceType" ), userAgent ) {
31- old51degrees .DeleteMatch (match )
31+ cgo51degrees .DeleteMatch (match )
3232 return
3333 }
34- old51degrees .DeleteMatch (match )
34+ cgo51degrees .DeleteMatch (match )
3535 }
3636}
3737
3838func BenchmarkReader (b * testing.B ) {
39- reader , err := new51degrees .NewReaderFromFile ("./51Degrees-EnterpriseV3.4.trie" )
39+ reader , err := go51degrees .NewReaderFromFile ("./51Degrees-EnterpriseV3.4.trie" )
4040 if err != nil {
4141 b .Fatal (err )
4242 }
43- provider := old51degrees .NewProvider ("./51Degrees-EnterpriseV3.4.trie" )
43+ provider := cgo51degrees .NewProvider ("./51Degrees-EnterpriseV3.4.trie" )
4444
4545 b .Log ("fixed ua:" , userAgents [0 ])
4646 b .ReportAllocs ()
@@ -105,7 +105,7 @@ func BenchmarkReader(b *testing.B) {
105105 })
106106 })
107107
108- b .Run ("c " , func (b * testing.B ) {
108+ b .Run ("cgo " , func (b * testing.B ) {
109109 b .Run ("fixed" , func (b * testing.B ) {
110110 for i := 0 ; i < b .N ; i ++ {
111111 match := provider .GetMatch (userAgents [0 ])
@@ -117,7 +117,7 @@ func BenchmarkReader(b *testing.B) {
117117 match .GetValue ("BrowserVersion" )
118118 match .GetValue ("IsCrawler" )
119119 match .GetValue ("DeviceType" )
120- old51degrees .DeleteMatch (match )
120+ cgo51degrees .DeleteMatch (match )
121121 }
122122 })
123123 b .Run ("fixed-parallel" , func (b * testing.B ) {
@@ -132,7 +132,7 @@ func BenchmarkReader(b *testing.B) {
132132 match .GetValue ("BrowserVersion" )
133133 match .GetValue ("IsCrawler" )
134134 match .GetValue ("DeviceType" )
135- old51degrees .DeleteMatch (match )
135+ cgo51degrees .DeleteMatch (match )
136136 }
137137 })
138138 })
@@ -147,7 +147,7 @@ func BenchmarkReader(b *testing.B) {
147147 match .GetValue ("BrowserVersion" )
148148 match .GetValue ("IsCrawler" )
149149 match .GetValue ("DeviceType" )
150- old51degrees .DeleteMatch (match )
150+ cgo51degrees .DeleteMatch (match )
151151 }
152152 })
153153 b .Run ("range-parallel" , func (b * testing.B ) {
@@ -163,7 +163,7 @@ func BenchmarkReader(b *testing.B) {
163163 match .GetValue ("BrowserVersion" )
164164 match .GetValue ("IsCrawler" )
165165 match .GetValue ("DeviceType" )
166- old51degrees .DeleteMatch (match )
166+ cgo51degrees .DeleteMatch (match )
167167 }
168168 })
169169 })
0 commit comments