Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more fixtures! #29

Merged
merged 22 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions FIXTURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ id|description|valid v1|valid v2
007|[layer:keys] has a key value encoded as an integer instead of a string - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L63) - recommended error handling `fatal`|:x:|:x:
008|[layer:extent] the layer extent field is encoded as a string instead of a uint32 - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L70) - recommended error handling `fatal`|:x:|:x:
009|[layer:extent] the layer extent field is completely missing. The spec says, "A layer MUST contain an extent that describes the width and height of the tile in integer coordinates." - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L70) - recommended error handling `fatal`|:x:|:x:
010|A Layer value property is listed as "string" but encoded as std::int64_t - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md) - recommended error handling `fatal`|:x:|:x:
011|Has a value type not described in the spec. Should be easy for decoders to skip - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md) - recommended error handling `recoverable`|:x:|:x:
012|The layer version is invalid and does not match any current versions of the specification - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L55) - recommended error handling `fatal`|:x:|:x:
013|Has a key property incorrectly encoded as a type std::uint32_t. - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L63) - recommended error handling `fatal`|:x:|:x:
030|Contains two geometry fields when there should only be one - [spec source](https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L46) - recommended error handling `recoverable`|:x:|:x:
10 changes: 10 additions & 0 deletions fixtures/010/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "A Layer value property is listed as \"string\" but encoded as std::int64_t",
"specification_reference": "https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md",
"validity": {
"v1": false,
"v2": false,
"error": "fatal"
},
"proto": "package vector_tile;\n\noption optimize_for = LITE_RUNTIME;\n\nmessage Tile {\n\n // GeomType is described in section 4.3.4 of the specification\n enum GeomType {\n UNKNOWN = 0;\n POINT = 1;\n LINESTRING = 2;\n POLYGON = 3;\n }\n\n // Variant type encoding\n // The use of values is described in section 4.1 of the specification\n message Value {\n // Exactly one of these values must be present in a valid message\n optional uint64 string_value = 1;\n optional float float_value = 2;\n optional double double_value = 3;\n optional int64 int_value = 4;\n optional uint64 uint_value = 5;\n optional sint64 sint_value = 6;\n optional bool bool_value = 7;\n\n extensions 8 to max;\n }\n\n // Features are described in section 4.2 of the specification\n message Feature {\n optional uint64 id = 1 [ default = 0 ];\n\n // Tags of this feature are encoded as repeated pairs of\n // integers.\n // A detailed description of tags is located in sections\n // 4.2 and 4.4 of the specification\n repeated uint32 tags = 2 [ packed = true ];\n\n // The type of geometry stored in this feature.\n optional GeomType type = 3 [ default = UNKNOWN ];\n\n // Contains a stream of commands and parameters (vertices).\n // A detailed description on geometry encoding is located in \n // section 4.3 of the specification.\n repeated uint32 geometry = 4 [ packed = true ];\n }\n\n // Layers are described in section 4.1 of the specification\n message Layer {\n // Any compliant implementation must first read the version\n // number encoded in this message and choose the correct\n // implementation for this version number before proceeding to\n // decode other parts of this message.\n required uint32 version = 15 [ default = 1 ];\n\n required string name = 1;\n\n // The actual features in this tile.\n repeated Feature features = 2;\n\n // Dictionary encoding for keys\n repeated string keys = 3;\n\n // Dictionary encoding for values\n repeated Value values = 4;\n\n // Although this is an \"optional\" field it is required by the specification.\n // See https://github.com/mapbox/vector-tile-spec/issues/47\n optional uint32 extent = 5 [ default = 4096 ];\n\n extensions 16 to max;\n }\n\n repeated Layer layers = 3;\n\n extensions 16 to 8191;\n}\n"
}
29 changes: 29 additions & 0 deletions fixtures/010/tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"layers": [
{
"version": 2,
"name": "hello",
"features": [
{
"id": 1,
"tags": [],
"type": 1,
"geometry": [
9,
50,
34
]
}
],
"keys": [
"key1"
],
"values": [
{
"string_value": 1234567890123456
}
],
"extent": 4096
}
]
}
Binary file added fixtures/010/tile.mvt
Binary file not shown.
10 changes: 10 additions & 0 deletions fixtures/011/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "Has a value type not described in the spec. Should be easy for decoders to skip",
"specification_reference": "https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md",
"validity": {
"v1": false,
"v2": false,
"error": "recoverable"
},
"proto": "\npackage vector_tile;\n\noption optimize_for = LITE_RUNTIME;\n\nmessage Tile {\n\n // GeomType is described in section 4.3.4 of the specification\n enum GeomType {\n UNKNOWN = 0;\n POINT = 1;\n LINESTRING = 2;\n POLYGON = 3;\n }\n // THIS IS NEW\n message NewMessageInValue {\n required string name = 1;\n }\n\n // Variant type encoding\n // The use of values is described in section 4.1 of the specification\n message Value {\n // Exactly one of these values must be present in a valid message\n optional string string_value = 1;\n optional float float_value = 2;\n optional double double_value = 3;\n optional int64 int_value = 4;\n optional uint64 uint_value = 5;\n optional sint64 sint_value = 6;\n optional bool bool_value = 7;\n optional NewMessageInValue custom_value = 8; // THIS IS NEW\n }\n\n // Features are described in section 4.2 of the specification\n message Feature {\n optional uint64 id = 1 [ default = 0 ];\n\n // Tags of this feature are encoded as repeated pairs of\n // integers.\n // A detailed description of tags is located in sections\n // 4.2 and 4.4 of the specification\n repeated uint32 tags = 2 [ packed = true ];\n\n // The type of geometry stored in this feature.\n optional GeomType type = 3 [ default = UNKNOWN ];\n\n // Contains a stream of commands and parameters (vertices).\n // A detailed description on geometry encoding is located in \n // section 4.3 of the specification.\n repeated uint32 geometry = 4 [ packed = true ];\n }\n\n // Layers are described in section 4.1 of the specification\n message Layer {\n // Any compliant implementation must first read the version\n // number encoded in this message and choose the correct\n // implementation for this version number before proceeding to\n // decode other parts of this message.\n required uint32 version = 15 [ default = 1 ];\n\n required string name = 1;\n\n // The actual features in this tile.\n repeated Feature features = 2;\n\n // Dictionary encoding for keys\n repeated string keys = 3;\n\n // Dictionary encoding for values\n repeated Value values = 4;\n\n // Although this is an \"optional\" field it is required by the specification.\n // See https://github.com/mapbox/vector-tile-spec/issues/47\n optional uint32 extent = 5 [ default = 4096 ];\n\n extensions 16 to max;\n }\n\n repeated Layer layers = 3;\n\n extensions 16 to 8191;\n}\n"
}
34 changes: 34 additions & 0 deletions fixtures/011/tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"layers": [
{
"version": 2,
"name": "hello",
"features": [
{
"id": 1,
"tags": [
0,
1
],
"type": 1,
"geometry": [
9,
50,
34
]
}
],
"keys": [
"hello"
],
"values": [
{
"custom_value": {
"name": "hello"
}
}
],
"extent": 4096
}
]
}
Binary file added fixtures/011/tile.mvt
Binary file not shown.
10 changes: 10 additions & 0 deletions fixtures/012/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "The layer version is invalid and does not match any current versions of the specification",
"specification_reference": "https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L55",
"validity": {
"v1": false,
"v2": false,
"error": "fatal"
},
"proto": "2.1"
}
23 changes: 23 additions & 0 deletions fixtures/012/tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"layers": [
{
"version": 99,
"name": "hello",
"features": [
{
"id": 1,
"tags": [],
"type": 1,
"geometry": [
9,
50,
34
]
}
],
"keys": [],
"values": [],
"extent": 4096
}
]
}
Binary file added fixtures/012/tile.mvt
Binary file not shown.
10 changes: 10 additions & 0 deletions fixtures/013/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "Has a key property incorrectly encoded as a type std::uint32_t.",
"specification_reference": "https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L63",
"validity": {
"v1": false,
"v2": false,
"error": "fatal"
},
"proto": "package vector_tile;\n\noption optimize_for = LITE_RUNTIME;\n\nmessage Tile {\n\n // GeomType is described in section 4.3.4 of the specification\n enum GeomType {\n UNKNOWN = 0;\n POINT = 1;\n LINESTRING = 2;\n POLYGON = 3;\n }\n\n // Variant type encoding\n // The use of values is described in section 4.1 of the specification\n message Value {\n // Exactly one of these values must be present in a valid message\n optional string string_value = 1;\n optional float float_value = 2;\n optional double double_value = 3;\n optional int64 int_value = 4;\n optional uint64 uint_value = 5;\n optional sint64 sint_value = 6;\n optional bool bool_value = 7;\n\n extensions 8 to max;\n }\n\n // Features are described in section 4.2 of the specification\n message Feature {\n optional uint64 id = 1 [ default = 0 ];\n\n // Tags of this feature are encoded as repeated pairs of\n // integers.\n // A detailed description of tags is located in sections\n // 4.2 and 4.4 of the specification\n repeated uint32 tags = 2 [ packed = true ];\n\n // The type of geometry stored in this feature.\n optional GeomType type = 3 [ default = UNKNOWN ];\n\n // Contains a stream of commands and parameters (vertices).\n // A detailed description on geometry encoding is located in \n // section 4.3 of the specification.\n repeated uint32 geometry = 4 [ packed = true ];\n }\n\n // Layers are described in section 4.1 of the specification\n message Layer {\n // Any compliant implementation must first read the version\n // number encoded in this message and choose the correct\n // implementation for this version number before proceeding to\n // decode other parts of this message.\n required uint32 version = 15 [ default = 1 ];\n\n required string name = 1;\n\n // The actual features in this tile.\n repeated Feature features = 2;\n\n // Dictionary encoding for keys\n repeated uint32 keys = 3;\n\n // Dictionary encoding for values\n repeated Value values = 4;\n\n // Although this is an \"optional\" field it is required by the specification.\n // See https://github.com/mapbox/vector-tile-spec/issues/47\n optional uint32 extent = 5 [ default = 4096 ];\n\n extensions 16 to max;\n }\n\n repeated Layer layers = 3;\n\n extensions 16 to 8191;\n}\n"
}
32 changes: 32 additions & 0 deletions fixtures/013/tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"layers": [
{
"version": 2,
"name": "hello",
"features": [
{
"id": 1,
"tags": [
0,
0
],
"type": 1,
"geometry": [
9,
50,
34
]
}
],
"keys": [
1
],
"values": [
{
"string_value": "hello"
}
],
"extent": 4096
}
]
}
Binary file added fixtures/013/tile.mvt
Binary file not shown.
10 changes: 10 additions & 0 deletions fixtures/030/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "Contains two geometry fields when there should only be one",
"specification_reference": "https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto#L46",
"validity": {
"v1": false,
"v2": false,
"error": "recoverable"
},
"proto": "package vector_tile;\n\noption optimize_for = LITE_RUNTIME;\n\nmessage Tile {\n\n // GeomType is described in section 4.3.4 of the specification\n enum GeomType {\n UNKNOWN = 0;\n POINT = 1;\n LINESTRING = 2;\n POLYGON = 3;\n }\n\n // Variant type encoding\n // The use of values is described in section 4.1 of the specification\n message Value {\n // Exactly one of these values must be present in a valid message\n optional string string_value = 1;\n optional float float_value = 2;\n optional double double_value = 3;\n optional int64 int_value = 4;\n optional uint64 uint_value = 5;\n optional sint64 sint_value = 6;\n optional bool bool_value = 7;\n\n extensions 8 to max;\n }\n\n // Features are described in section 4.2 of the specification\n message Feature {\n optional uint64 id = 1 [ default = 0 ];\n\n // Tags of this feature are encoded as repeated pairs of\n // integers.\n // A detailed description of tags is located in sections\n // 4.2 and 4.4 of the specification\n repeated uint32 tags = 2 [ packed = true ];\n\n // The type of geometry stored in this feature.\n optional GeomType type = 3 [ default = UNKNOWN ];\n\n // Contains a stream of commands and parameters (vertices).\n // A detailed description on geometry encoding is located in \n // section 4.3 of the specification.\n repeated uint32 geometry = 4 [ packed = true ];repeated uint32 geometry = 4 [ packed = true ];\n }\n\n // Layers are described in section 4.1 of the specification\n message Layer {\n // Any compliant implementation must first read the version\n // number encoded in this message and choose the correct\n // implementation for this version number before proceeding to\n // decode other parts of this message.\n required uint32 version = 15 [ default = 1 ];\n\n required string name = 1;\n\n // The actual features in this tile.\n repeated Feature features = 2;\n\n // Dictionary encoding for keys\n repeated string keys = 3;\n\n // Dictionary encoding for values\n repeated Value values = 4;\n\n // Although this is an \"optional\" field it is required by the specification.\n // See https://github.com/mapbox/vector-tile-spec/issues/47\n optional uint32 extent = 5 [ default = 4096 ];\n\n extensions 16 to max;\n }\n\n repeated Layer layers = 3;\n\n extensions 16 to 8191;\n}\n"
}
23 changes: 23 additions & 0 deletions fixtures/030/tile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"layers": [
{
"version": 2,
"name": "hello",
"features": [
{
"id": 1,
"tags": [],
"type": 1,
"geometry": [
9,
0,
0
]
}
],
"keys": [],
"values": [],
"extent": 4096
}
]
}
Binary file added fixtures/030/tile.mvt
Binary file not shown.
37 changes: 37 additions & 0 deletions src/010.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const util = require('../lib/util');

module.exports = {
description: 'A Layer value property is listed as "string" but encoded as std::int64_t',
specification_reference: 'https://github.com/mapbox/vector-tile-spec/blob/master/2.1/README.md',
validity: {
v1: false,
v2: false,
error: 'fatal'
},
json: {
layers: [
{
version: 2,
name: 'hello',
features: [
{
id: 1,
tags: [],
type: 1,
geometry: [9, 50, 34]
}
],
keys: ['key1'],
values: [
{ string_value: 1234567890123456 }
],
extent: 4096
}
]
},
proto: util.replace('2.1', 'optional string string_value', 'optional uint64 string_value'),
manipulate: function (buffer) {
// manipulate the buffer here if you need, otherwise you can remove this
return buffer;
}
};
Loading