Skip to content
Permalink
Browse files

make test function names consistent

  • Loading branch information...
paulmach committed Feb 24, 2018
1 parent 829a6f8 commit ff7b0750ae54894deef1edaabd1cf3fc0fdedfd2
@@ -8,7 +8,7 @@ import (
"github.com/paulmach/osm"
)

func TestEdgeCase_ChildCreatedAfterParent(t *testing.T) {
func TestEdgeCase_childCreatedAfterParent(t *testing.T) {
// example: way 43680701, node 370250076
// way 4708608, node 29974559
// Way's first version is 4 days after node's first version.
@@ -139,7 +139,7 @@ func TestEdgeCase_ChildCreatedAfterParent(t *testing.T) {
})
}

func TestEdgeCase_NodeDeletedBetweenParents(t *testing.T) {
func TestEdgeCase_nodeDeletedBetweenParents(t *testing.T) {
// example: node 321452894, way 28831147

nodes := osm.Nodes{
@@ -182,7 +182,7 @@ func TestEdgeCase_NodeDeletedBetweenParents(t *testing.T) {
}
}

func TestEdgeCase_NodeRedacted(t *testing.T) {
func TestEdgeCase_nodeRedacted(t *testing.T) {
// example: way 159081205, node 376130526
// Oh the license change. Nodes have 1 non-visible version.

@@ -49,7 +49,7 @@ func TestChildFirstOrdering(t *testing.T) {
}
}

func TestChildFirstOrdering_Cycle(t *testing.T) {
func TestChildFirstOrdering_cycle(t *testing.T) {
relations := osm.Relations{
{ID: 1, Version: 1, Members: osm.Members{
{Type: osm.TypeRelation, Ref: 2},
@@ -200,7 +200,7 @@ func TestChildFirstOrdering_Walk(t *testing.T) {
}
}

func TestChildFirstOrdering_MissingRelation(t *testing.T) {
func TestChildFirstOrdering_missingRelation(t *testing.T) {
relations := osm.Relations{
{ID: 2, Members: osm.Members{
{Type: osm.TypeRelation, Ref: 3},
@@ -47,7 +47,7 @@ func TestRelation(t *testing.T) {
}
}

func TestRelation_Reverse(t *testing.T) {
func TestRelation_reverse(t *testing.T) {
ways := osm.Ways{
{
ID: 1, Version: 1, Visible: true, Nodes: osm.WayNodes{
@@ -136,7 +136,7 @@ func TestRelation_Reverse(t *testing.T) {
})
}

func TestRelation_Polygon(t *testing.T) {
func TestRelation_polygon(t *testing.T) {
ways := osm.Ways{
{
ID: 1,
@@ -242,7 +242,7 @@ func TestRelation_Polygon(t *testing.T) {
}
}

func TestRelation_Circular(t *testing.T) {
func TestRelation_circular(t *testing.T) {
relations := osm.Relations{
&osm.Relation{ID: 1, Version: 1, Visible: true, Timestamp: time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
Members: osm.Members{
@@ -325,7 +325,7 @@ func TestRelation_Circular(t *testing.T) {
}
}

func TestRelation_SelfCircular(t *testing.T) {
func TestRelation_selfCircular(t *testing.T) {
rs := osm.Relations{
{ID: 1, Version: 1, Visible: true, Timestamp: time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
Members: osm.Members{
@@ -373,7 +373,7 @@ func TestRelation_SelfCircular(t *testing.T) {
}
}

func BenchmarkRelation(b *testing.B) {
func BenchmarkRelations(b *testing.B) {
id := osm.RelationID(2714790)
filename := fmt.Sprintf("testdata/relation_%d.osm", id)

@@ -41,7 +41,7 @@ func TestWays(t *testing.T) {
}
}

func TestWays_ChildFilter(t *testing.T) {
func TestWays_childFilter(t *testing.T) {
nodes := osm.Nodes{
{ID: 1, Version: 1, Lat: 1, Lon: 1, Visible: true},
{ID: 1, Version: 2, Lat: 2, Lon: 2, Visible: true},
@@ -45,6 +45,16 @@ func (c *Changeset) ObjectID() ObjectID {
return c.ID.ObjectID()
}

// Bounds returns the bounds of the changeset as a bounds object.
func (c *Changeset) Bounds() *Bounds {
return &Bounds{
MinLat: c.MinLat,
MaxLat: c.MaxLat,
MinLon: c.MinLon,
MaxLon: c.MaxLon,
}
}

// Comment is a helper and returns the changeset comment from the tag.
func (c *Changeset) Comment() string {
return c.Tags.Find("comment")
@@ -131,7 +131,7 @@ func TestChangeset(t *testing.T) {
}
}

func TestChangesetOpen(t *testing.T) {
func TestChangeset_open(t *testing.T) {
data := []byte(`
<changeset id="40309372" user="Bahntech" uid="3619264" created_at="2016-06-26T21:26:41Z" open="true" min_lat="51.484563" min_lon="12.0995042" max_lat="51.484563" max_lon="12.0995042" comments_count="0">
<tag k="comment" v="updated fire hydrant details with OsmHydrant"/>
@@ -149,7 +149,7 @@ func TestChangesetOpen(t *testing.T) {
}
}

func TestChangesetTags(t *testing.T) {
func TestChangeset_tags(t *testing.T) {
data := []byte(`
<changeset id="123123">
<tag k="comment" v="changeset comment"/>
@@ -196,7 +196,7 @@ func TestChangesetTags(t *testing.T) {
}
}

func TestChangesetBound(t *testing.T) {
func TestChangeset_bounds(t *testing.T) {
data := []byte(`
<changeset id="36947173" created_at="2016-02-01T22:00:56Z" closed_at="2016-02-01T23:05:06Z" open="false" num_changes="9" user="florijn11" uid="1319603" min_lat="51.5871887" max_lat="51.6032569" min_lon="5.3214071" max_lon="5.33106" comments_count="0">
<tag k="version" v="2.4"/>
@@ -210,9 +210,25 @@ func TestChangesetBound(t *testing.T) {
if err != nil {
t.Fatalf("unmarshal error: %v", err)
}

if v := c.MinLat; v != 51.5871887 {
t.Errorf("incorrect value, got %v", v)
}

if v := c.MaxLat; v != 51.6032569 {
t.Errorf("incorrect value, got %v", v)
}

if v := c.MinLon; v != 5.3214071 {
t.Errorf("incorrect value, got %v", v)
}

if v := c.MaxLon; v != 5.33106 {
t.Errorf("incorrect value, got %v", v)
}
}

func TestChangesetComment(t *testing.T) {
func TestChangeset_comments(t *testing.T) {
data := []byte(`
<changeset id="40303151" user="Glen Bundrick" uid="4173877" created_at="2016-06-26T15:37:47Z" closed_at="2016-06-26T15:37:48Z" open="false" min_lat="34.6591676" min_lon="-81.8789825" max_lat="34.6594167" max_lon="-81.8788142" comments_count="3">
<tag k="comment" v="Recent Doublewide addition"/>
@@ -262,7 +278,7 @@ func TestChangesetComment(t *testing.T) {
}
}

func TestChangesetMarshalXML(t *testing.T) {
func TestChangeset_MarshalXML(t *testing.T) {
cs := Changeset{
ID: 123,
}
@@ -6,7 +6,7 @@ import (
"testing"
)

func TestElementID_ParseElementID(t *testing.T) {
func TestParseElementID(t *testing.T) {
cases := []struct {
name string
string string
@@ -63,7 +63,7 @@ func TestElementID_ParseElementID(t *testing.T) {
}
}

func TestElementImplementations(t *testing.T) {
func TestElement_implementations(t *testing.T) {
var _ Element = &Node{}
var _ Element = &Way{}
var _ Element = &Relation{}
@@ -43,7 +43,7 @@ func TestFeature_String(t *testing.T) {
}
}

func TestFeatureID_ParseFeatureID(t *testing.T) {
func TestParseFeatureID(t *testing.T) {
cases := []struct {
name string
id FeatureID
@@ -83,7 +83,7 @@ func TestJoin(t *testing.T) {
}
}

func TestJoinLineString_SinglePointLine(t *testing.T) {
func TestJoin_lineString_singlePointLine(t *testing.T) {
cases := []struct {
name string
input []Segment
@@ -135,7 +135,7 @@ func TestJoinLineString_SinglePointLine(t *testing.T) {
}
}

func TestJoinLineString_DanglingLine(t *testing.T) {
func TestJoin_lineString_danglingLine(t *testing.T) {
cases := []struct {
name string
input []Segment
@@ -6,7 +6,7 @@ import (
"github.com/paulmach/orb"
)

func TestMultiSegmentToRing_NoAnnotation(t *testing.T) {
func TestMultiSegment_ToRing_noAnnotation(t *testing.T) {
cases := []struct {
name string
orientation orb.Orientation
@@ -68,7 +68,7 @@ func TestMultiSegmentToRing_NoAnnotation(t *testing.T) {
}
}

func TestMultiSegmentToRing_Annotation(t *testing.T) {
func TestMultiSegment_ToRing_annotation(t *testing.T) {
cases := []struct {
name string
orientation orb.Orientation
@@ -11,7 +11,7 @@ import (
"time"
)

func TestMarshal_Node(t *testing.T) {
func TestNode_Marshal(t *testing.T) {
c := loadChange(t, "testdata/changeset_38162210.osc")
n := c.Create.Nodes[12]

@@ -32,7 +32,7 @@ func TestMarshal_Node(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_NodeRoundoff(t *testing.T) {
func TestNode_Marshal_roundoff(t *testing.T) {
c := loadChange(t, "testdata/changeset_38162210.osc")
n := c.Create.Nodes[194]

@@ -42,7 +42,7 @@ func TestMarshal_NodeRoundoff(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_Nodes(t *testing.T) {
func TestNodes_Marshal(t *testing.T) {
c := loadChange(t, "testdata/changeset_38162210.osc")
ns1 := c.Create.Nodes

@@ -57,7 +57,7 @@ func TestMarshal_Nodes(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_Way(t *testing.T) {
func TestWay_Marshal(t *testing.T) {
c := loadChange(t, "testdata/changeset_38162210.osc")
w := c.Create.Ways[5]

@@ -72,7 +72,7 @@ func TestMarshal_Way(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_WayUpdates(t *testing.T) {
func TestWay_Marshal_updates(t *testing.T) {
o := loadOSM(t, "testdata/way-updates.osm")
checkMarshal(t, o)

@@ -81,7 +81,7 @@ func TestMarshal_WayUpdates(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_Relation(t *testing.T) {
func TestRelation_Marshal(t *testing.T) {
c := loadChange(t, "testdata/changeset_38162206.osc")
r := c.Create.Relations[0]

@@ -96,7 +96,7 @@ func TestMarshal_Relation(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_RelationUpdates(t *testing.T) {
func TestRelation_Marshal_updates(t *testing.T) {
o := loadOSM(t, "testdata/relation-updates.osm")
checkMarshal(t, o)

@@ -105,7 +105,7 @@ func TestMarshal_RelationUpdates(t *testing.T) {
checkMarshal(t, o)
}

func TestMarshal_RelationMemberLocation(t *testing.T) {
func TestRelation_Marshal_memberLocation(t *testing.T) {
o := &OSM{
Relations: Relations{
{
@@ -121,7 +121,7 @@ func TestMarshal_RelationMemberLocation(t *testing.T) {
checkMarshal(t, o)
}

func TestProtobufRelation_Orientation(t *testing.T) {
func TestRelation_Marshal_protobufOrientation(t *testing.T) {
o := &OSM{
Relations: Relations{
{
@@ -140,7 +140,7 @@ func TestProtobufRelation_Orientation(t *testing.T) {
checkMarshal(t, o)
}

func BenchmarkMarshalXML(b *testing.B) {
func BenchmarkChange_MarshalXML(b *testing.B) {
filename := "testdata/changeset_38162206.osc"
data := readFile(b, filename)

@@ -160,7 +160,7 @@ func BenchmarkMarshalXML(b *testing.B) {
}
}

func BenchmarkMarshalProto(b *testing.B) {
func BenchmarkChangeSet_Marshal(b *testing.B) {
cs := &Changeset{
ID: 38162206,
UserID: 2744209,
@@ -178,7 +178,7 @@ func BenchmarkMarshalProto(b *testing.B) {
}
}

func BenchmarkMarshalWayUpdates(b *testing.B) {
func BenchmarkUnmarshalWays(b *testing.B) {
o := loadOSM(b, "testdata/way-updates.osm")
ways := o.Ways

@@ -190,7 +190,7 @@ func BenchmarkMarshalWayUpdates(b *testing.B) {
}
}

func BenchmarkMarshalRelationUpdates(b *testing.B) {
func BenchmarkUnmarshalRelations(b *testing.B) {
o := loadOSM(b, "testdata/relation-updates.osm")
relations := o.Relations

@@ -202,7 +202,7 @@ func BenchmarkMarshalRelationUpdates(b *testing.B) {
}
}

func BenchmarkMarshalProtoGZIP(b *testing.B) {
func BenchmarkChangeset_Marshal_gzip(b *testing.B) {
cs := &Changeset{
ID: 38162206,
UserID: 2744209,
@@ -231,7 +231,7 @@ func BenchmarkMarshalProtoGZIP(b *testing.B) {
}
}

func BenchmarkUnmarshalXML(b *testing.B) {
func BenchmarkChangeset_UnmarshalXML(b *testing.B) {
filename := "testdata/changeset_38162206.osc"
data := readFile(b, filename)

@@ -246,7 +246,7 @@ func BenchmarkUnmarshalXML(b *testing.B) {
}
}

func BenchmarkUnmarshalProto(b *testing.B) {
func BenchmarkUnmarshalChangeset(b *testing.B) {
cs := &Changeset{
ID: 38162206,
UserID: 2744209,
@@ -268,7 +268,7 @@ func BenchmarkUnmarshalProto(b *testing.B) {
}
}
}
func BenchmarkUnmarshalProtoGZIP(b *testing.B) {
func BenchmarkUnmarshalChangeset_gzip(b *testing.B) {
cs := &Changeset{
ID: 38162206,
UserID: 2744209,

0 comments on commit ff7b075

Please sign in to comment.
You can’t perform that action at this time.