-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add expression test for distance expression
update ignore list
- Loading branch information
Showing
27 changed files
with
4,589 additions
and
1 deletion.
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
55 changes: 55 additions & 0 deletions
55
test/integration/expression-tests/distance/invalid-geometry-input/test.json
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,55 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "Unknown", | ||
"coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] | ||
}], | ||
"inputs": [[{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [6, 6] | ||
} | ||
}], [{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [2, 2] | ||
} | ||
}], [{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[3, 3], [4, 1]] | ||
} | ||
}]], | ||
"expected": { | ||
"compiled": { | ||
"errors": [{ | ||
"error": "Unknown not yet implemented", | ||
"key": "" | ||
}, { | ||
"key": "", | ||
"error": "'distance' expression needs to be an array with format [\"distance\", GeoJSONObj]." | ||
}], | ||
"result": "error" | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
test/integration/expression-tests/distance/line-to-line-distance/test.json
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,86 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "Feature", | ||
"properties": { | ||
"stroke": "#d7d47e", | ||
"stroke-width": 2, | ||
"stroke-opacity": -1, | ||
"value": true | ||
}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] | ||
} | ||
}], | ||
"inputs": [[{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.90637397766113, 1.3406817398811269], [103.90603065490723, 1.334331999436213]] | ||
} | ||
}]], | ||
"expected": { | ||
"outputs": [530.029, 1841.19, 4894.16, 0], | ||
"serialized": ["distance", { | ||
"properties": { | ||
"stroke-opacity": -1, | ||
"value": true, | ||
"stroke-width": 2, | ||
"stroke": "#d7d47e" | ||
}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] | ||
}, | ||
"type": "Feature" | ||
}], | ||
"compiled": { | ||
"type": "number", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
test/integration/expression-tests/distance/line-to-lines-distance/test.json
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,40 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] | ||
} | ||
}], | ||
"inputs": [[{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] | ||
} | ||
}]], | ||
"expected": { | ||
"outputs": [530.029], | ||
"serialized": ["distance", { | ||
"properties": {}, | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] | ||
}, | ||
"type": "Feature" | ||
}], | ||
"compiled": { | ||
"type": "number", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
test/integration/expression-tests/distance/lines-to-lines-distance/test.json
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,40 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]] | ||
} | ||
}], | ||
"inputs": [[{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] | ||
} | ||
}]], | ||
"expected": { | ||
"outputs": [17.2408], | ||
"serialized": ["distance", { | ||
"properties": {}, | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]] | ||
}, | ||
"type": "Feature" | ||
}], | ||
"compiled": { | ||
"type": "number", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
test/integration/expression-tests/distance/lines-to-polygons-distance/test.json
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,76 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "MultiPolygon", | ||
"coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] | ||
} | ||
}], | ||
"inputs": [[{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "MultiLineString", | ||
"coordinates": [[[103.91040802001953, 1.3602886044036287], [103.91023635864258, 1.351021484651125], [103.91504287719727, 1.348618892268445]], [[103.89379978179932, 1.3396949569719253], [103.89431476593018, 1.3355762066278836], [103.89268398284912, 1.3316719681575607]]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.92019271850586, 1.3529092341423024], [103.91701698303223, 1.3336884437452606]] | ||
} | ||
}], [{ | ||
"zoom": 13, | ||
"canonicalID": { | ||
"z": 13, | ||
"x": 6460, | ||
"y": 4065 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [[103.88586044311522, 1.3379788118355014], [103.88628959655762, 1.3329161766939824]] | ||
} | ||
}]], | ||
"expected": { | ||
"outputs": [0, 23.6932, 0, 0], | ||
"serialized": ["distance", { | ||
"properties": {}, | ||
"geometry": { | ||
"type": "MultiPolygon", | ||
"coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] | ||
}, | ||
"type": "Feature" | ||
}], | ||
"compiled": { | ||
"type": "number", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ts/distance/non-supported-feature-geometry/test.json~fef0ecd44... Update expression tests
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,34 @@ | ||
{ | ||
"expression": ["distance", { | ||
"type": "LineString", | ||
"coordinates": [[0, 0], [0, 5], [5, 5], [5, 0]] | ||
}, "kilometers"], | ||
"inputs": [[{ | ||
"zoom": 3, | ||
"canonicalID": { | ||
"z": 3, | ||
"x": 3, | ||
"y": 3 | ||
} | ||
}, { | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[[3, 3], [6, 6], [3, 3]]] | ||
} | ||
}]], | ||
"expected": { | ||
"outputs": [{ | ||
"error": "distance expression currently only evaluates Point/LineString geometries." | ||
}], | ||
"serialized": ["distance", { | ||
"coordinates": [[0, 0], [0, 5], [5, 5], [5, 0]], | ||
"type": "LineString" | ||
}, "kilometers"], | ||
"compiled": { | ||
"type": "number", | ||
"isFeatureConstant": false, | ||
"isZoomConstant": true, | ||
"result": "success" | ||
} | ||
} | ||
} |
Oops, something went wrong.