-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add support for GOMODULES This repo follows a modified version of semver, where the major version of this repository tracks the major version of the C core repository. This doesn't play well with GOMODULES by default, so we create our first major version go module that is just a duplication of master version. Solves #24
- Loading branch information
Joseph Gilley
authored
Feb 28, 2020
1 parent
fd8ceb4
commit b6b8cf0
Showing
44 changed files
with
9,195 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/uber/h3-go | ||
|
||
go 1.13 | ||
|
||
require github.com/stretchr/testify v1.4.0 |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= | ||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package h3 | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
// buckets for preventing compiler optimizing out calls | ||
var ( | ||
geo = GeoCoord{ | ||
Latitude: 37, | ||
Longitude: -122, | ||
} | ||
h3idx = FromGeo(geo, 15) | ||
h3addr = ToString(h3idx) | ||
geoBndry GeoBoundary | ||
h3idxs []H3Index | ||
) | ||
|
||
func BenchmarkToString(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
h3addr = ToString(h3idx) | ||
} | ||
} | ||
|
||
func BenchmarkFromString(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
h3idx = FromString("850dab63fffffff") | ||
} | ||
} | ||
|
||
func BenchmarkToGeoRes15(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
geo = ToGeo(h3idx) | ||
} | ||
} | ||
|
||
func BenchmarkFromGeoRes15(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
h3idx = FromGeo(geo, 15) | ||
} | ||
} | ||
|
||
func BenchmarkToGeoBndryRes15(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
geoBndry = ToGeoBoundary(h3idx) | ||
} | ||
} | ||
|
||
func BenchmarkHexRange(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
h3idxs, _ = HexRange(h3idx, 10) | ||
} | ||
} | ||
|
||
func BenchmarkPolyfill(b *testing.B) { | ||
for n := 0; n < b.N; n++ { | ||
h3idxs = Polyfill(validGeopolygonWithHoles, 6) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package h3 | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func ExampleFromGeo() { | ||
geo := GeoCoord{ | ||
Latitude: 37.775938728915946, | ||
Longitude: -122.41795063018799, | ||
} | ||
resolution := 9 | ||
fmt.Printf("%#x\n", FromGeo(geo, resolution)) | ||
// Output: | ||
// 0x8928308280fffff | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/uber/h3-go/v3 | ||
|
||
go 1.13 | ||
|
||
require github.com/stretchr/testify v1.4.0 |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= | ||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
Oops, something went wrong.