From 93005de00e6fc3ae0ef9cbedb7403d703e86d796 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 5 Jun 2017 11:01:15 -0700 Subject: [PATCH] Fix duplicate attribute detection for lists and hashes --- mvt.cpp | 5 ++++- tests/object/in.json | 5 +++-- tests/object/out/-z0.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mvt.cpp b/mvt.cpp index 2f4f923..4fdcf00 100644 --- a/mvt.cpp +++ b/mvt.cpp @@ -416,7 +416,10 @@ bool mvt_value::operator<(const mvt_value &o) const { (type == mvt_int && numeric_value.int_value < o.numeric_value.int_value) || (type == mvt_uint && numeric_value.uint_value < o.numeric_value.uint_value) || (type == mvt_sint && numeric_value.sint_value < o.numeric_value.sint_value) || - (type == mvt_bool && numeric_value.bool_value < o.numeric_value.bool_value)) { + (type == mvt_bool && numeric_value.bool_value < o.numeric_value.bool_value) || + (type == mvt_list && list_value < o.list_value) || + (type == mvt_hash && list_value < o.list_value) || + (type == mvt_null && numeric_value.int_value < o.numeric_value.int_value)) { return true; } } diff --git a/tests/object/in.json b/tests/object/in.json index 6191450..01eeb4a 100644 --- a/tests/object/in.json +++ b/tests/object/in.json @@ -7,7 +7,8 @@ "true": true, "false": false, "array": [ - "string", 10, null, true, false - ] + "string", 10, null, true, false, [ 1, 2, 3 ], { "this": "that" } + ], + "nest": { "something": "else" } } }, "geometry": { "type": "Point", "coordinates": [ 0,0 ]} } diff --git a/tests/object/out/-z0.json b/tests/object/out/-z0.json index 09a6770..b35e680 100644 --- a/tests/object/out/-z0.json +++ b/tests/object/out/-z0.json @@ -12,7 +12,7 @@ }, "features": [ { "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [ { "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ -{ "type": "Feature", "properties": { "compound": {"string":"string","number":10,"null":null,"true":true,"false":false,"array":["string",10,null,true,false]} }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } } +{ "type": "Feature", "properties": { "compound": {"string":"string","number":10,"null":null,"true":true,"false":false,"array":["string",10,null,true,false,[1,2,3],{"this":"that"}],"nest":{"something":"else"}} }, "geometry": { "type": "Point", "coordinates": [ 0.000000, 0.000000 ] } } ] } ] } ] }