@@ -27,14 +27,26 @@ func TestElementID_ids(t *testing.T) {
2727 t .Errorf ("incorrect id: %v" , v )
2828 }
2929
30+ if v := NodeID (- 1 ).ElementID (1 ).NodeID (); v != - 1 {
31+ t .Errorf ("incorrect id: %v" , v )
32+ }
33+
3034 if v := NodeID (1 ).ElementID (1 ).NodeID (); v != 1 {
3135 t .Errorf ("incorrect id: %v" , v )
3236 }
3337
38+ if v := WayID (- 1 ).ElementID (1 ).WayID (); v != - 1 {
39+ t .Errorf ("incorrect id: %v" , v )
40+ }
41+
3442 if v := WayID (1 ).ElementID (1 ).WayID (); v != 1 {
3543 t .Errorf ("incorrect id: %v" , v )
3644 }
3745
46+ if v := RelationID (- 1 ).ElementID (1 ).RelationID (); v != - 1 {
47+ t .Errorf ("incorrect id: %v" , v )
48+ }
49+
3850 if v := RelationID (1 ).ElementID (1 ).RelationID (); v != 1 {
3951 t .Errorf ("incorrect id: %v" , v )
4052 }
@@ -79,6 +91,10 @@ func TestParseElementID(t *testing.T) {
7991 string string
8092 id ElementID
8193 }{
94+ {
95+ name : "negative id" ,
96+ id : NodeID (- 1 ).ElementID (1 ),
97+ },
8298 {
8399 name : "node" ,
84100 id : NodeID (0 ).ElementID (1 ),
@@ -232,6 +248,7 @@ func TestElements_Sort(t *testing.T) {
232248 es := Elements {
233249 & Node {ID : 1 , Version : 4 },
234250 & Node {ID : 1 , Version : 5 },
251+ & Node {ID : - 1 , Version : 5 },
235252 & Way {ID : 2 , Version : 6 },
236253 & Relation {ID : 3 , Version : 7 },
237254 & Way {ID : 2 , Version : 5 },
@@ -240,6 +257,7 @@ func TestElements_Sort(t *testing.T) {
240257 es .Sort ()
241258
242259 expected := ElementIDs {
260+ NodeID (- 1 ).ElementID (5 ),
243261 NodeID (1 ).ElementID (4 ),
244262 NodeID (1 ).ElementID (5 ),
245263 NodeID (4 ).ElementID (8 ),
@@ -279,12 +297,16 @@ func TestElementIDs_Sort(t *testing.T) {
279297 ids := ElementIDs {
280298 RelationID (1 ).ElementID (1 ),
281299 NodeID (1 ).ElementID (2 ),
300+ NodeID (- 1 ).ElementID (3 ),
301+ NodeID (- 1 ).ElementID (2 ),
282302 WayID (2 ).ElementID (3 ),
283303 WayID (1 ).ElementID (2 ),
284304 WayID (1 ).ElementID (1 ),
285305 }
286306
287307 expected := ElementIDs {
308+ NodeID (- 1 ).ElementID (2 ),
309+ NodeID (- 1 ).ElementID (3 ),
288310 NodeID (1 ).ElementID (2 ),
289311 WayID (1 ).ElementID (1 ),
290312 WayID (1 ).ElementID (2 ),
0 commit comments