From 52f248fc8c5feedb531b6ccecaed04f8fe323eee Mon Sep 17 00:00:00 2001 From: "Taro Matsuzawa aka. btm" Date: Fri, 24 May 2024 20:08:08 +0900 Subject: [PATCH] #668 remove custom stringify function in test (#670) * #668 remove custom stringify function in test * #668 use 2 space indent * #668 remove from CHANGELOG * #668 replace all json for test via UPDATE=1 npm run jest --- .../integration/expression/expression.test.ts | 3 +- .../expression/tests/abs/basic/test.json | 43 +- .../expression/tests/acos/basic/test.json | 18 +- .../expression/tests/all/arity-0/test.json | 17 +- .../expression/tests/all/arity-1/test.json | 18 +- .../expression/tests/all/basic/test.json | 45 +- .../tests/all/short-circuiting/test.json | 22 +- .../expression/tests/any/arity-0/test.json | 17 +- .../expression/tests/any/arity-1/test.json | 18 +- .../expression/tests/any/basic/test.json | 67 ++- .../tests/any/short-circuiting/test.json | 22 +- .../expression/tests/array/basic/test.json | 29 +- .../tests/array/default-value/test.json | 53 ++- .../tests/array/implicit-1/test.json | 37 +- .../tests/array/implicit-2/test.json | 52 ++- .../tests/array/implicit-3/test.json | 53 ++- .../array/item-type-and-length/test.json | 53 ++- .../tests/array/item-type/test.json | 61 ++- .../expression/tests/asin/basic/test.json | 18 +- .../expression/tests/at/basic/test.json | 88 +++- .../tests/at/infer-array-type/test.json | 22 +- .../expression/tests/atan/basic/test.json | 18 +- .../expression/tests/boolean/basic/test.json | 82 +++- .../tests/boolean/default-value/test.json | 90 +++- .../expression/tests/case/basic/test.json | 74 +++- .../tests/case/infer-array-type/test.json | 32 +- .../tests/case/precedence/test.json | 27 +- .../expression/tests/ceil/basic/test.json | 93 ++++- .../coalesce/argument-type-mismatch/test.json | 28 +- .../expression/tests/coalesce/basic/test.json | 70 +++- .../expression/tests/coalesce/error/test.json | 81 +++- .../tests/coalesce/infer-array-type/test.json | 24 +- .../tests/coalesce/inference/test.json | 67 ++- .../expression/tests/coalesce/null/test.json | 35 +- .../tests/collator/accent-equals-de/test.json | 66 ++- .../tests/collator/accent-lt-en/test.json | 57 ++- .../collator/accent-not-equals-en/test.json | 57 ++- .../collator/base-default-locale/test.json | 59 ++- .../tests/collator/base-equals-en/test.json | 57 ++- .../tests/collator/base-gt-en/test.json | 57 ++- .../tests/collator/case-lteq-en/test.json | 68 ++- .../collator/case-not-equals-en/test.json | 57 ++- .../tests/collator/case-omitted-en/test.json | 70 +++- .../comparison-number-error/test.json | 15 +- .../collator/diacritic-omitted-en/test.json | 63 ++- .../equals-non-string-error/test.json | 15 +- .../tests/collator/non-object-error/test.json | 19 +- .../collator/variant-equals-en/test.json | 57 ++- .../tests/collator/variant-gteq-en/test.json | 68 ++- .../expression/tests/concat/arity-0/test.json | 17 +- .../expression/tests/concat/arity-1/test.json | 18 +- .../expression/tests/concat/basic/test.json | 20 +- .../tests/concat/coercion/test.json | 35 +- .../evaluation-error/test.json | 72 +++- .../to-color-inferred/test.json | 30 +- .../tests/constant-folding/to-color/test.json | 23 +- .../tests/constant-folding/var/test.json | 32 +- .../expression/tests/cos/basic/test.json | 18 +- .../expression/tests/distance/basic/test.json | 77 ++-- .../expression/tests/divide/basic/test.json | 19 +- .../expression/tests/downcase/basic/test.json | 18 +- .../expression/tests/e/basic/test.json | 17 +- .../expression/tests/equal/array/test.json | 16 +- .../tests/equal/collator-value/test.json | 89 +++- .../expression/tests/equal/color/test.json | 14 +- .../expression/tests/equal/mismatch/test.json | 25 +- .../expression/tests/equal/null-lhs/test.json | 33 +- .../expression/tests/equal/null-rhs/test.json | 33 +- .../expression/tests/equal/number/test.json | 53 ++- .../expression/tests/equal/object/test.json | 14 +- .../expression/tests/equal/string/test.json | 53 ++- .../expression/tests/equal/value/test.json | 83 +++- .../expression/tests/floor/basic/test.json | 93 ++++- .../expression/tests/format/basic/test.json | 34 +- .../tests/format/coercion/test.json | 30 +- .../tests/format/data-driven-font/test.json | 31 +- .../tests/format/data-driven-scale/test.json | 26 +- .../tests/format/image-sections/test.json | 35 +- .../tests/format/implicit-assert/test.json | 27 +- .../tests/format/implicit-coerce/test.json | 47 ++- .../tests/format/implicit-omit/test.json | 51 ++- .../tests/format/implicit/test.json | 44 +- .../tests/format/to-string/test.json | 27 +- .../tests/geometry-type/basic/test.json | 29 +- .../expression/tests/get/basic/test.json | 29 +- .../tests/get/from-literal--missing/test.json | 23 +- .../tests/get/from-literal/test.json | 27 +- .../tests/get/from-object-property/test.json | 34 +- .../tests/greater/boolean/test.json | 20 +- .../tests/greater/mismatch/test.json | 25 +- .../expression/tests/greater/null/test.json | 8 +- .../expression/tests/greater/number/test.json | 56 ++- .../tests/greater/string-and-value/test.json | 47 ++- .../expression/tests/greater/string/test.json | 89 +++- .../expression/tests/greater/value/test.json | 54 ++- .../tests/greater_or_equal/boolean/test.json | 20 +- .../tests/greater_or_equal/mismatch/test.json | 25 +- .../tests/greater_or_equal/null/test.json | 8 +- .../tests/greater_or_equal/number/test.json | 56 ++- .../string-and-value/test.json | 47 ++- .../tests/greater_or_equal/string/test.json | 89 +++- .../tests/greater_or_equal/value/test.json | 54 ++- .../expression/tests/has/basic/test.json | 56 ++- .../tests/heatmap-density/basic/test.json | 65 ++- .../expression/tests/id/basic/test.json | 31 +- .../expression/tests/image/basic/test.json | 25 +- .../expression/tests/image/coalesce/test.json | 47 ++- .../expression/tests/image/compound/test.json | 29 +- .../tests/image/implicit-assert/test.json | 27 +- .../tests/in/assert-array/test.json | 91 +++- .../tests/in/assert-string/test.json | 61 ++- .../expression/tests/in/basic-array/test.json | 107 ++++- .../tests/in/basic-string/test.json | 97 ++++- .../tests/in/invalid-haystack/test.json | 47 ++- .../tests/in/invalid-needle/test.json | 41 +- .../tests/index-of/assert-array/test.json | 89 +++- .../tests/index-of/assert-string/test.json | 61 ++- .../tests/index-of/basic-array/test.json | 84 +++- .../tests/index-of/basic-string/test.json | 84 +++- .../tests/index-of/invalid-haystack/test.json | 44 +- .../tests/index-of/invalid-needle/test.json | 38 +- .../tests/index-of/with-from-index/test.json | 149 ++++++- .../tests/interpolate-hcl/linear/test.json | 81 +++- .../tests/interpolate-lab/linear/test.json | 81 +++- .../interpolate/cubic-bezier-3-args/test.json | 17 +- .../interpolate/cubic-bezier-5-args/test.json | 19 +- .../test.json | 18 +- .../tests/interpolate/cubic-bezier/test.json | 117 +++++- .../interpolate/duplicate_stops/test.json | 21 +- .../exponential-number-array/test.json | 99 ++++- .../exponential-single-stop/test.json | 52 ++- .../exponential-string-array/test.json | 34 +- .../test.json | 38 +- .../tests/interpolate/exponential/test.json | 74 +++- .../interpolate/infer-array-type/test.json | 32 +- .../tests/interpolate/linear-color/test.json | 133 +++++- .../interpolate/linear-many-stops/test.json | 96 ++++- .../tests/interpolate/linear/test.json | 78 +++- .../is-supported-script/default/test.json | 33 +- .../categorical/array-default/test.json | 90 +++- .../tests/legacy/categorical/array/test.json | 90 +++- .../categorical/boolean-default/test.json | 62 ++- .../legacy/categorical/boolean/test.json | 62 ++- .../categorical/color-default/test.json | 82 +++- .../tests/legacy/categorical/color/test.json | 82 +++- .../categorical/number-default/test.json | 82 +++- .../tests/legacy/categorical/number/test.json | 82 +++- .../categorical/string-default/test.json | 62 ++- .../tests/legacy/categorical/string/test.json | 62 ++- .../tests/legacy/categorical/tokens/test.json | 64 ++- .../exponential/array-default/test.json | 114 ++++- .../tests/legacy/exponential/array/test.json | 110 ++++- .../tests/legacy/exponential/base/test.json | 38 +- .../exponential/color-default/test.json | 131 +++++- .../legacy/exponential/color-hcl/test.json | 121 +++++- .../legacy/exponential/color-lab/test.json | 121 +++++- .../tests/legacy/exponential/color/test.json | 121 +++++- .../exponential/composite-default/test.json | 127 +++++- .../legacy/exponential/composite/test.json | 121 +++++- .../exponential/duplicate-stops/test.json | 42 +- .../legacy/exponential/implicit/test.json | 89 +++- .../exponential/number-default/test.json | 92 ++++- .../tests/legacy/exponential/number/test.json | 86 +++- .../legacy/identity/array-default/test.json | 71 +++- .../tests/legacy/identity/array/test.json | 61 ++- .../legacy/identity/boolean-default/test.json | 57 ++- .../tests/legacy/identity/boolean/test.json | 49 ++- .../legacy/identity/color-default/test.json | 62 ++- .../tests/legacy/identity/color/test.json | 55 ++- .../legacy/identity/enum-default/test.json | 62 ++- .../tests/legacy/identity/enum/test.json | 58 ++- .../legacy/identity/number-default/test.json | 57 ++- .../tests/legacy/identity/number/test.json | 53 ++- .../legacy/identity/string-default/test.json | 57 ++- .../tests/legacy/identity/string/test.json | 53 ++- .../legacy/interval/array-default/test.json | 114 ++++- .../tests/legacy/interval/array/test.json | 110 ++++- .../legacy/interval/color-default/test.json | 131 +++++- .../tests/legacy/interval/color/test.json | 121 +++++- .../interval/composite-default/test.json | 127 +++++- .../tests/legacy/interval/composite/test.json | 121 +++++- .../legacy/interval/duplicate-stops/test.json | 42 +- .../tests/legacy/interval/implicit/test.json | 89 +++- .../legacy/interval/number-default/test.json | 92 ++++- .../tests/legacy/interval/number/test.json | 86 +++- .../legacy/interval/string-default/test.json | 92 ++++- .../tests/legacy/interval/string/test.json | 86 +++- .../legacy/interval/tokens-property/test.json | 61 ++- .../legacy/interval/tokens-zoom/test.json | 63 ++- .../expression/tests/length/array/test.json | 34 +- .../tests/length/implicit/test.json | 37 +- .../expression/tests/length/invalid/test.json | 14 +- .../expression/tests/length/string/test.json | 28 +- .../expression/tests/less/boolean/test.json | 20 +- .../expression/tests/less/mismatch/test.json | 25 +- .../expression/tests/less/null/test.json | 8 +- .../expression/tests/less/number/test.json | 56 ++- .../tests/less/string-and-value/test.json | 47 ++- .../expression/tests/less/string/test.json | 89 +++- .../expression/tests/less/value/test.json | 54 ++- .../tests/less_or_equal/boolean/test.json | 20 +- .../tests/less_or_equal/mismatch/test.json | 25 +- .../tests/less_or_equal/null/test.json | 8 +- .../tests/less_or_equal/number/test.json | 56 ++- .../less_or_equal/string-and-value/test.json | 47 ++- .../tests/less_or_equal/string/test.json | 89 +++- .../tests/less_or_equal/value/test.json | 54 ++- .../expression/tests/let/basic/test.json | 53 ++- .../tests/let/expected-value/test.json | 56 ++- .../tests/let/invalid-name/test.json | 12 +- .../expression/tests/let/nested/test.json | 49 ++- .../tests/let/property-function/test.json | 37 +- .../expression/tests/let/shadow/test.json | 36 +- .../expression/tests/let/unbound/test.json | 21 +- .../expression/tests/let/zoom/test.json | 54 ++- .../tests/literal/boolean-array/test.json | 24 +- .../expression/tests/literal/empty/test.json | 13 +- .../literal/infer-empty-array-type/test.json | 14 +- .../tests/literal/literal-false/test.json | 18 +- .../tests/literal/literal-null/test.json | 18 +- .../tests/literal/literal-number/test.json | 18 +- .../tests/literal/literal-string/test.json | 18 +- .../tests/literal/literal-true/test.json | 18 +- .../literal/mixed-primitive-array/test.json | 24 +- .../tests/literal/multiple-args/test.json | 15 +- .../tests/literal/nested-array/test.json | 30 +- .../tests/literal/number-array/test.json | 24 +- .../expression/tests/literal/object/test.json | 22 +- .../tests/literal/string-array/test.json | 24 +- .../expression/tests/literal/string/test.json | 13 +- .../tests/literal/u2028u2029/test.json | 15 +- .../expression/tests/ln/basic/test.json | 20 +- .../expression/tests/ln2/basic/test.json | 17 +- .../expression/tests/log10/basic/test.json | 18 +- .../expression/tests/log2/basic/test.json | 18 +- .../expression/tests/match/arity-0/test.json | 11 +- .../expression/tests/match/arity-1/test.json | 12 +- .../expression/tests/match/arity-2/test.json | 20 +- .../expression/tests/match/arity-3/test.json | 21 +- .../expression/tests/match/basic/test.json | 66 ++- .../tests/match/empty-case/test.json | 20 +- .../tests/match/infer-array-type/test.json | 41 +- .../tests/match/label-array/test.json | 15 +- .../tests/match/label-boolean/test.json | 67 ++- .../tests/match/label-non-integer/test.json | 15 +- .../tests/match/label-null/test.json | 24 +- .../tests/match/label-number/test.json | 74 +++- .../tests/match/label-object/test.json | 15 +- .../tests/match/label-overflow/test.json | 10 +- .../label-string-invalid-identifier/test.json | 70 +++- .../tests/match/label-string/test.json | 76 +++- .../tests/match/mismatch-input/test.json | 21 +- .../tests/match/mismatch-label-1/test.json | 12 +- .../tests/match/mismatch-label-2/test.json | 21 +- .../tests/match/mismatch-output/test.json | 21 +- .../tests/match/mixed-type/test.json | 48 ++- .../tests/match/multi-value/test.json | 73 +++- .../match/unreachable-branch-1/test.json | 17 +- .../match/unreachable-branch-2/test.json | 27 +- .../expression/tests/max/arity-0/test.json | 35 +- .../expression/tests/max/arity-1/test.json | 18 +- .../expression/tests/max/basic/test.json | 20 +- .../expression/tests/min/arity-0/test.json | 35 +- .../expression/tests/min/arity-1/test.json | 18 +- .../expression/tests/min/basic/test.json | 20 +- .../expression/tests/minus/arity-0/test.json | 13 +- .../expression/tests/minus/arity-1/test.json | 18 +- .../expression/tests/minus/basic/test.json | 19 +- .../tests/minus/inference-arity-2/test.json | 26 +- .../expression/tests/mod/basic/test.json | 19 +- .../expression/tests/not/basic/test.json | 36 +- .../tests/not_equal/mismatch/test.json | 25 +- .../tests/not_equal/number/test.json | 53 ++- .../tests/not_equal/string/test.json | 53 ++- .../tests/not_equal/value/test.json | 83 +++- .../tests/number-format/currency/test.json | 38 +- .../tests/number-format/default/test.json | 19 +- .../tests/number-format/precision/test.json | 44 +- .../expression/tests/number/basic/test.json | 50 ++- .../tests/number/default-value/test.json | 54 ++- .../expression/tests/object/basic/test.json | 65 ++- .../tests/object/default-value/test.json | 83 +++- .../tests/object/implicit/test.json | 31 +- .../expression/tests/parse/empty/test.json | 2 +- .../tests/parse/non-array/test.json | 12 +- .../tests/parse/non-string/test.json | 7 +- .../tests/parse/unknown-expression/test.json | 17 +- .../expression/tests/pi/basic/test.json | 17 +- .../expression/tests/plus/arity-0/test.json | 17 +- .../expression/tests/plus/arity-1/test.json | 18 +- .../expression/tests/plus/basic/test.json | 21 +- .../expression/tests/pow/basic/test.json | 38 +- .../tests/properties/basic/test.json | 23 +- .../tests/resolved-locale/basic/test.json | 19 +- .../expression/tests/rgb/basic/test.json | 25 +- .../expression/tests/rgba/basic/test.json | 26 +- .../tests/rgba/out-of-bounds/test.json | 58 ++- .../expression/tests/round/basic/test.json | 93 ++++- .../expression/tests/sin/basic/test.json | 18 +- .../tests/slice/array-one-index/test.json | 101 ++++- .../tests/slice/array-two-indexes/test.json | 152 ++++++- .../tests/slice/invalid-inputs/test.json | 74 +++- .../tests/slice/string-one-index/test.json | 61 ++- .../tests/slice/string-two-indexes/test.json | 81 +++- .../expression/tests/sqrt/basic/test.json | 34 +- .../expression/tests/step/basic/test.json | 81 +++- .../tests/step/duplicate_stops/test.json | 19 +- .../expression/tests/string/basic/test.json | 50 ++- .../tests/string/default-value/test.json | 54 ++- .../expression/tests/tan/basic/test.json | 18 +- .../expression/tests/times/arity-0/test.json | 17 +- .../expression/tests/times/arity-1/test.json | 18 +- .../expression/tests/times/basic/test.json | 21 +- .../tests/to-boolean/2-ary/test.json | 28 +- .../tests/to-boolean/basic/test.json | 89 +++- .../expression/tests/to-color/2-ary/test.json | 145 ++++++- .../expression/tests/to-color/basic/test.json | 108 ++++- .../expression/tests/to-color/color/test.json | 29 +- .../tests/to-number/2-ary/test.json | 119 +++++- .../tests/to-number/basic/test.json | 90 +++- .../expression/tests/to-rgba/alpha/test.json | 29 +- .../expression/tests/to-rgba/basic/test.json | 82 +++- .../expression/tests/to-rgba/zero/test.json | 29 +- .../tests/to-string/2-ary/test.json | 28 +- .../tests/to-string/basic/test.json | 78 +++- .../tests/to-string/color/test.json | 24 +- .../tests/to-string/implicit/test.json | 50 ++- .../typecheck/array-invalid-item/test.json | 19 +- .../typecheck/array-item-subtyping/test.json | 19 +- .../test.json | 18 +- .../array-length-subtyping/test.json | 19 +- .../typecheck/array-wrong-length/test.json | 19 +- .../expression/tests/typeof/basic/test.json | 105 ++++- .../expression/tests/upcase/basic/test.json | 18 +- .../tests/within/invalid-geojson/test.json | 87 +++- .../test.json | 314 +++++++++++--- .../test.json | 256 +++++++++--- .../within/line-within-polygon/test.json | 82 +++- .../within/line-within-polygons/test.json | 185 ++++++++- .../within/lines-within-polygon/test.json | 100 ++++- .../within/lines-within-polygons/test.json | 162 +++++++- .../within/meridian-issue-line-1/test.json | 77 +++- .../within/meridian-issue-line-2/test.json | 91 +++- .../within/meridian-issue-point-1/test.json | 90 +++- .../within/meridian-issue-point-2/test.json | 110 ++++- .../tests/within/non-supported/test.json | 57 ++- .../within/point-on-boundary-1/test.json | 388 ++++++++++++++++-- .../within/point-on-boundary-2/test.json | 388 ++++++++++++++++-- .../within/point-on-boundary-3/test.json | 388 ++++++++++++++++-- .../test.json | 227 +++++++++- .../test.json | 176 ++++++-- .../within/point-within-polygon/test.json | 70 +++- .../within/point-within-polygons/test.json | 195 ++++++++- .../within/points-within-polygon/test.json | 81 +++- .../within/points-within-polygons/test.json | 210 +++++++++- .../expression/tests/zoom/basic/test.json | 29 +- .../tests/zoom/invalid-nested-1/test.json | 27 +- .../tests/zoom/invalid-nested-2/test.json | 31 +- .../tests/zoom/invalid-nested-3/test.json | 37 +- .../tests/zoom/invalid-nested-4/test.json | 37 +- .../tests/zoom/invalid-nested-5/test.json | 32 +- .../tests/zoom/invalid-no-curve/test.json | 19 +- .../tests/zoom/nested-coalesce/test.json | 29 +- .../tests/zoom/nested-let/test.json | 42 +- .../style-spec/tests/numbers.output.json | 40 +- .../style-spec/tests/terrain.output.json | 2 +- test/lib/util.ts | 15 - 367 files changed, 17592 insertions(+), 2616 deletions(-) diff --git a/test/integration/expression/expression.test.ts b/test/integration/expression/expression.test.ts index 8dd5b9eda..97b1ad621 100644 --- a/test/integration/expression/expression.test.ts +++ b/test/integration/expression/expression.test.ts @@ -12,7 +12,6 @@ import { import ExpressionParsingError from '../../../src/expression/parsing_error'; import {Result} from '../../../src/util/result'; import {getGeometry} from '../../lib/geometry'; -import {stringify} from '../../lib/util'; import {deepEqual, stripPrecision} from '../../lib/json-diff'; const DECIMAL_SIGNIFICANT_FIGURES = 6; @@ -52,7 +51,7 @@ describe('expression', () => { delete fixture.metadata; const fname = path.join(__dirname, expressionTestFileName); - fs.writeFileSync(fname, `${stringify(fixture)}\n`); + fs.writeFileSync(fname, JSON.stringify(fixture, null, 2)); return; } diff --git a/test/integration/expression/tests/abs/basic/test.json b/test/integration/expression/tests/abs/basic/test.json index fd2c1aed9..7f2c3cf5d 100644 --- a/test/integration/expression/tests/abs/basic/test.json +++ b/test/integration/expression/tests/abs/basic/test.json @@ -1,9 +1,36 @@ { - "expression": ["abs", ["get", "x"]], + "expression": [ + "abs", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": -2}}], - [{}, {"properties": {"x": 2}}], - [{}, {"properties": {"x": -1.1}}] + [ + {}, + { + "properties": { + "x": -2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": -1.1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +39,10 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2, 2, 1.1] + "outputs": [ + 2, + 2, + 1.1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/acos/basic/test.json b/test/integration/expression/tests/acos/basic/test.json index 13e79ee36..4ee2bcb63 100644 --- a/test/integration/expression/tests/acos/basic/test.json +++ b/test/integration/expression/tests/acos/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["acos", 0.5], - "inputs": [[{}, {}]], + "expression": [ + "acos", + 0.5 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1.04719] + "outputs": [ + 1.04719 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/all/arity-0/test.json b/test/integration/expression/tests/all/arity-0/test.json index a8f4660eb..e0b9f9b0b 100644 --- a/test/integration/expression/tests/all/arity-0/test.json +++ b/test/integration/expression/tests/all/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["all"], - "inputs": [[{}, {}]], + "expression": [ + "all" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/all/arity-1/test.json b/test/integration/expression/tests/all/arity-1/test.json index fcc11e10d..1a5c084c9 100644 --- a/test/integration/expression/tests/all/arity-1/test.json +++ b/test/integration/expression/tests/all/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["all", false], - "inputs": [[{}, {}]], + "expression": [ + "all", + false + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/all/basic/test.json b/test/integration/expression/tests/all/basic/test.json index 6798c22d4..b23ee3d6a 100644 --- a/test/integration/expression/tests/all/basic/test.json +++ b/test/integration/expression/tests/all/basic/test.json @@ -1,8 +1,40 @@ { - "expression": ["all", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + "all", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": true, "y": false}}], - [{}, {"properties": {"x": true, "y": true}}] + [ + {}, + { + "properties": { + "x": true, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": true, + "y": true + } + } + ] ], "expected": { "compiled": { @@ -11,6 +43,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true] + "outputs": [ + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/all/short-circuiting/test.json b/test/integration/expression/tests/all/short-circuiting/test.json index 053554042..309a20b60 100644 --- a/test/integration/expression/tests/all/short-circuiting/test.json +++ b/test/integration/expression/tests/all/short-circuiting/test.json @@ -1,6 +1,18 @@ { - "expression": ["all", false, ["error", "unreachable"]], - "inputs": [[{}, {}]], + "expression": [ + "all", + false, + [ + "error", + "unreachable" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +20,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/any/arity-0/test.json b/test/integration/expression/tests/any/arity-0/test.json index e1f0d60b3..76c13d59f 100644 --- a/test/integration/expression/tests/any/arity-0/test.json +++ b/test/integration/expression/tests/any/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["any"], - "inputs": [[{}, {}]], + "expression": [ + "any" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/any/arity-1/test.json b/test/integration/expression/tests/any/arity-1/test.json index 020dc2ad2..adb9c3d0d 100644 --- a/test/integration/expression/tests/any/arity-1/test.json +++ b/test/integration/expression/tests/any/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["any", false], - "inputs": [[{}, {}]], + "expression": [ + "any", + false + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/any/basic/test.json b/test/integration/expression/tests/any/basic/test.json index fe1785c6b..2d7e9c5b6 100644 --- a/test/integration/expression/tests/any/basic/test.json +++ b/test/integration/expression/tests/any/basic/test.json @@ -1,10 +1,58 @@ { - "expression": ["any", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + "any", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": true, "y": true}}], - [{}, {"properties": {"x": true, "y": false}}], - [{}, {"properties": {"x": false, "y": true}}], - [{}, {"properties": {"x": false, "y": false}}] + [ + {}, + { + "properties": { + "x": true, + "y": true + } + } + ], + [ + {}, + { + "properties": { + "x": true, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": false, + "y": true + } + } + ], + [ + {}, + { + "properties": { + "x": false, + "y": false + } + } + ] ], "expected": { "compiled": { @@ -13,6 +61,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, true, false] + "outputs": [ + true, + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/any/short-circuiting/test.json b/test/integration/expression/tests/any/short-circuiting/test.json index 31c3cc1ff..cc248efa5 100644 --- a/test/integration/expression/tests/any/short-circuiting/test.json +++ b/test/integration/expression/tests/any/short-circuiting/test.json @@ -1,6 +1,18 @@ { - "expression": ["any", true, ["error", "unreachable"]], - "inputs": [[{}, {}]], + "expression": [ + "any", + true, + [ + "error", + "unreachable" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +20,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/basic/test.json b/test/integration/expression/tests/array/basic/test.json index 20f94ecf3..f5930e228 100644 --- a/test/integration/expression/tests/array/basic/test.json +++ b/test/integration/expression/tests/array/basic/test.json @@ -1,6 +1,21 @@ { - "expression": ["array", ["literal", [1, 2, 3]]], - "inputs": [[{}, {}]], + "expression": [ + "array", + [ + "literal", + [ + 1, + 2, + 3 + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +23,12 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[1, 2, 3]] + "outputs": [ + [ + 1, + 2, + 3 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/default-value/test.json b/test/integration/expression/tests/array/default-value/test.json index cf538c772..aeb13d22f 100644 --- a/test/integration/expression/tests/array/default-value/test.json +++ b/test/integration/expression/tests/array/default-value/test.json @@ -1,9 +1,42 @@ { - "expression": ["array", "number", null, ["get", "x"], ["literal", [0]]], + "expression": [ + "array", + "number", + null, + [ + "get", + "x" + ], + [ + "literal", + [ + 0 + ] + ] + ], "inputs": [ - [{}, {}], - [{}, {"properties": {"x": []}}], - [{}, {"properties": {"x": ["1"]}}] + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": [] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + "1" + ] + } + } + ] ], "expected": { "compiled": { @@ -12,6 +45,14 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[0], [], [0]] + "outputs": [ + [ + 0 + ], + [], + [ + 0 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/implicit-1/test.json b/test/integration/expression/tests/array/implicit-1/test.json index e5512b66f..b23578586 100644 --- a/test/integration/expression/tests/array/implicit-1/test.json +++ b/test/integration/expression/tests/array/implicit-1/test.json @@ -1,8 +1,33 @@ { - "expression": ["at", 0, ["get", "array"]], + "expression": [ + "at", + 0, + [ + "get", + "array" + ] + ], "inputs": [ - [{}, {"properties": {"array": [0, 1, 2]}}], - [{}, {"properties": {"array": "not"}}] + [ + {}, + { + "properties": { + "array": [ + 0, + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "array": "not" + } + } + ] ], "expected": { "compiled": { @@ -13,7 +38,9 @@ }, "outputs": [ 0, - {"error": "Expected value to be of type array, but found string instead."} + { + "error": "Expected value to be of type array, but found string instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/implicit-2/test.json b/test/integration/expression/tests/array/implicit-2/test.json index a1b3f39f0..540dff236 100644 --- a/test/integration/expression/tests/array/implicit-2/test.json +++ b/test/integration/expression/tests/array/implicit-2/test.json @@ -3,13 +3,48 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["get", "array"], + "expression": [ + "get", + "array" + ], "inputs": [ - [{}, {"properties": {"array": ["a", "b"]}}], - [{}, {"properties": {"array": [1, 2]}}], - [{}, {"properties": {"array": "not"}}] + [ + {}, + { + "properties": { + "array": [ + "a", + "b" + ] + } + } + ], + [ + {}, + { + "properties": { + "array": [ + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "array": "not" + } + } + ] ], "expected": { "compiled": { @@ -19,7 +54,10 @@ "type": "array" }, "outputs": [ - ["a", "b"], + [ + "a", + "b" + ], { "error": "Expected value to be of type array, but found array instead." }, @@ -28,4 +66,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/implicit-3/test.json b/test/integration/expression/tests/array/implicit-3/test.json index 02b357fc1..182f49d80 100644 --- a/test/integration/expression/tests/array/implicit-3/test.json +++ b/test/integration/expression/tests/array/implicit-3/test.json @@ -4,13 +4,49 @@ "value": "number", "length": 2, "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["get", "array"], + "expression": [ + "get", + "array" + ], "inputs": [ - [{}, {"properties": {"array": [1, 2]}}], - [{}, {"properties": {"array": [1, 2, 3]}}], - [{}, {"properties": {"array": "not"}}] + [ + {}, + { + "properties": { + "array": [ + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "array": [ + 1, + 2, + 3 + ] + } + } + ], + [ + {}, + { + "properties": { + "array": "not" + } + } + ] ], "expected": { "compiled": { @@ -20,7 +56,10 @@ "type": "array" }, "outputs": [ - [1, 2], + [ + 1, + 2 + ], { "error": "Expected value to be of type array, but found array instead." }, @@ -29,4 +68,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/item-type-and-length/test.json b/test/integration/expression/tests/array/item-type-and-length/test.json index 00a7f0b32..003fe540b 100644 --- a/test/integration/expression/tests/array/item-type-and-length/test.json +++ b/test/integration/expression/tests/array/item-type-and-length/test.json @@ -1,9 +1,47 @@ { - "expression": ["array", "number", 2, ["get", "x"]], + "expression": [ + "array", + "number", + 2, + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": [1, 0]}}], - [{}, {"properties": {"x": [0]}}], - [{}, {"properties": {"x": [1, 2, 3]}}] + [ + {}, + { + "properties": { + "x": [ + 1, + 0 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2, + 3 + ] + } + } + ] ], "expected": { "compiled": { @@ -13,7 +51,10 @@ "type": "array" }, "outputs": [ - [1, 0], + [ + 1, + 0 + ], { "error": "Expected value to be of type array, but found array instead." }, @@ -22,4 +63,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/array/item-type/test.json b/test/integration/expression/tests/array/item-type/test.json index d540e0a5f..eb04f7281 100644 --- a/test/integration/expression/tests/array/item-type/test.json +++ b/test/integration/expression/tests/array/item-type/test.json @@ -1,10 +1,54 @@ { - "expression": ["array", "string", ["get", "x"]], + "expression": [ + "array", + "string", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": ["a", "b"]}}], - [{}, {"properties": {"x": [1, 2]}}], - [{}, {"properties": {"x": [1, "b"]}}], - [{}, {"properties": {"x": []}}] + [ + {}, + { + "properties": { + "x": [ + "a", + "b" + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + "b" + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [] + } + } + ] ], "expected": { "compiled": { @@ -14,7 +58,10 @@ "type": "array" }, "outputs": [ - ["a", "b"], + [ + "a", + "b" + ], { "error": "Expected value to be of type array, but found array instead." }, @@ -24,4 +71,4 @@ [] ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/asin/basic/test.json b/test/integration/expression/tests/asin/basic/test.json index 03704b678..6f3706158 100644 --- a/test/integration/expression/tests/asin/basic/test.json +++ b/test/integration/expression/tests/asin/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["asin", 0.5], - "inputs": [[{}, {}]], + "expression": [ + "asin", + 0.5 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0.523598] + "outputs": [ + 0.523598 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/at/basic/test.json b/test/integration/expression/tests/at/basic/test.json index e93b9a36e..8668fea0e 100644 --- a/test/integration/expression/tests/at/basic/test.json +++ b/test/integration/expression/tests/at/basic/test.json @@ -1,13 +1,77 @@ { "expression": [ "number", - ["at", ["number", ["get", "i"]], ["array", ["get", "arr"]]] + [ + "at", + [ + "number", + [ + "get", + "i" + ] + ], + [ + "array", + [ + "get", + "arr" + ] + ] + ] ], "inputs": [ - [{}, {"properties": {"i": 1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": -1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 4, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 1.5, "arr": [9, 8, 7]}}] + [ + {}, + { + "properties": { + "i": 1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": -1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 4, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1.5, + "arr": [ + 9, + 8, + 7 + ] + } + } + ] ], "expected": { "compiled": { @@ -18,9 +82,15 @@ }, "outputs": [ 8, - {"error": "Array index out of bounds: -1 < 0."}, - {"error": "Array index out of bounds: 4 > 2."}, - {"error": "Array index must be an integer, but found 1.5 instead."} + { + "error": "Array index out of bounds: -1 < 0." + }, + { + "error": "Array index out of bounds: 4 > 2." + }, + { + "error": "Array index must be an integer, but found 1.5 instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/at/infer-array-type/test.json b/test/integration/expression/tests/at/infer-array-type/test.json index e3e6c2ac1..888ce251f 100644 --- a/test/integration/expression/tests/at/infer-array-type/test.json +++ b/test/integration/expression/tests/at/infer-array-type/test.json @@ -2,9 +2,25 @@ "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["at", 1, ["literal", [1, 2, 3]]], + "expression": [ + "at", + 1, + [ + "literal", + [ + 1, + 2, + 3 + ] + ] + ], "inputs": [], "expected": { "compiled": { @@ -17,4 +33,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/atan/basic/test.json b/test/integration/expression/tests/atan/basic/test.json index 92869fedf..053d00756 100644 --- a/test/integration/expression/tests/atan/basic/test.json +++ b/test/integration/expression/tests/atan/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["atan", 1], - "inputs": [[{}, {}]], + "expression": [ + "atan", + 1 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0.785398] + "outputs": [ + 0.785398 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/boolean/basic/test.json b/test/integration/expression/tests/boolean/basic/test.json index a7a73ad99..0fa8bcab3 100644 --- a/test/integration/expression/tests/boolean/basic/test.json +++ b/test/integration/expression/tests/boolean/basic/test.json @@ -1,14 +1,72 @@ { - "expression": ["boolean", ["get", "x"]], + "expression": [ + "boolean", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {}], - [{}, {"properties": {"x": true}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": ""}}], - [{}, {"properties": {"x": "false"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": null}}] + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": true + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": "" + } + } + ], + [ + {}, + { + "properties": { + "x": "false" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -35,7 +93,9 @@ { "error": "Expected value to be of type boolean, but found number instead." }, - {"error": "Expected value to be of type boolean, but found null instead."} + { + "error": "Expected value to be of type boolean, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/boolean/default-value/test.json b/test/integration/expression/tests/boolean/default-value/test.json index eb3c0822e..239f5dd66 100644 --- a/test/integration/expression/tests/boolean/default-value/test.json +++ b/test/integration/expression/tests/boolean/default-value/test.json @@ -1,14 +1,73 @@ { - "expression": ["boolean", ["get", "x"], false], + "expression": [ + "boolean", + [ + "get", + "x" + ], + false + ], "inputs": [ - [{}, {}], - [{}, {"properties": {"x": true}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": ""}}], - [{}, {"properties": {"x": "false"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": null}}] + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": true + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": "" + } + } + ], + [ + {}, + { + "properties": { + "x": "false" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -17,6 +76,15 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, false, false, false, false, false, false] + "outputs": [ + false, + true, + false, + false, + false, + false, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/case/basic/test.json b/test/integration/expression/tests/case/basic/test.json index 822cdc709..cb02ff0c0 100644 --- a/test/integration/expression/tests/case/basic/test.json +++ b/test/integration/expression/tests/case/basic/test.json @@ -2,15 +2,73 @@ "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["case", ["get", "x"], "x", ["get", "y"], "y", "otherwise"], + "expression": [ + "case", + [ + "get", + "x" + ], + "x", + [ + "get", + "y" + ], + "y", + "otherwise" + ], "inputs": [ - [{}, {"properties": {"x": true, "y": true}}], - [{}, {"properties": {"x": true, "y": false}}], - [{}, {"properties": {"x": false, "y": true}}], - [{}, {"properties": {"x": false, "y": false}}], - [{}, {"properties": {"x": "false", "y": false}}] + [ + {}, + { + "properties": { + "x": true, + "y": true + } + } + ], + [ + {}, + { + "properties": { + "x": true, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": false, + "y": true + } + } + ], + [ + {}, + { + "properties": { + "x": false, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": "false", + "y": false + } + } + ] ], "expected": { "compiled": { @@ -29,4 +87,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/case/infer-array-type/test.json b/test/integration/expression/tests/case/infer-array-type/test.json index a91cf44a5..916bc1acb 100644 --- a/test/integration/expression/tests/case/infer-array-type/test.json +++ b/test/integration/expression/tests/case/infer-array-type/test.json @@ -3,13 +3,35 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, "expression": [ "case", - ["boolean", ["get", "x"]], - ["literal", ["one"]], - ["literal", ["one", "two"]] + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "literal", + [ + "one" + ] + ], + [ + "literal", + [ + "one", + "two" + ] + ] ], "inputs": [], "expected": { @@ -21,4 +43,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/case/precedence/test.json b/test/integration/expression/tests/case/precedence/test.json index 5fd2acdbd..364395378 100644 --- a/test/integration/expression/tests/case/precedence/test.json +++ b/test/integration/expression/tests/case/precedence/test.json @@ -1,6 +1,23 @@ { - "expression": ["boolean", ["all", false, ["case", true, true, true]]], - "inputs": [[{}, {}]], + "expression": [ + "boolean", + [ + "all", + false, + [ + "case", + true, + true, + true + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +25,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/ceil/basic/test.json b/test/integration/expression/tests/ceil/basic/test.json index 85356fdfd..3eb8aacda 100644 --- a/test/integration/expression/tests/ceil/basic/test.json +++ b/test/integration/expression/tests/ceil/basic/test.json @@ -1,14 +1,76 @@ { - "expression": ["ceil", ["get", "x"]], + "expression": [ + "ceil", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": -2.6}}], - [{}, {"properties": {"x": -2.5}}], - [{}, {"properties": {"x": -2.4}}], - [{}, {"properties": {"x": -2}}], - [{}, {"properties": {"x": 2.6}}], - [{}, {"properties": {"x": 2.5}}], - [{}, {"properties": {"x": 2.4}}], - [{}, {"properties": {"x": 2}}] + [ + {}, + { + "properties": { + "x": -2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": -2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ] ], "expected": { "compiled": { @@ -17,6 +79,15 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-2, -2, -2, -2, 3, 3, 3, 2] + "outputs": [ + -2, + -2, + -2, + -2, + 3, + 3, + 3, + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/argument-type-mismatch/test.json b/test/integration/expression/tests/coalesce/argument-type-mismatch/test.json index b10de788b..46aa442ba 100644 --- a/test/integration/expression/tests/coalesce/argument-type-mismatch/test.json +++ b/test/integration/expression/tests/coalesce/argument-type-mismatch/test.json @@ -1,12 +1,32 @@ { - "propertySpec": {"type": "string"}, - "expression": ["coalesce", ["get", "a"], 5], + "propertySpec": { + "type": "string", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, + "expression": [ + "coalesce", + [ + "get", + "a" + ], + 5 + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Expected string but found number instead."} + { + "key": "[2]", + "error": "Expected string but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/basic/test.json b/test/integration/expression/tests/coalesce/basic/test.json index d7530a397..6eb224e41 100644 --- a/test/integration/expression/tests/coalesce/basic/test.json +++ b/test/integration/expression/tests/coalesce/basic/test.json @@ -1,11 +1,59 @@ { - "expression": ["coalesce", ["get", "x"], ["get", "y"], ["get", "z"], 0], + "expression": [ + "coalesce", + [ + "get", + "x" + ], + [ + "get", + "y" + ], + [ + "get", + "z" + ], + 0 + ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 1, "y": 2, "z": 3}}], - [{}, {"properties": {"y": 2}}], - [{}, {"properties": {"z": 3}}], - [{}, {}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2, + "z": 3 + } + } + ], + [ + {}, + { + "properties": { + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "z": 3 + } + } + ], + [ + {}, + {} + ] ], "expected": { "compiled": { @@ -14,6 +62,12 @@ "isZoomConstant": true, "type": "value" }, - "outputs": [1, 1, 2, 3, 0] + "outputs": [ + 1, + 1, + 2, + 3, + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/error/test.json b/test/integration/expression/tests/coalesce/error/test.json index 9b252616b..e27a8dc1f 100644 --- a/test/integration/expression/tests/coalesce/error/test.json +++ b/test/integration/expression/tests/coalesce/error/test.json @@ -1,16 +1,67 @@ { "expression": [ "coalesce", - ["number", ["get", "x"]], - ["number", ["get", "y"]], - ["number", ["get", "z"]] + [ + "number", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ], + [ + "number", + [ + "get", + "z" + ] + ] ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 1, "y": 2, "z": 3}}], - [{}, {"properties": {"y": 2}}], - [{}, {"properties": {"z": 3}}], - [{}, {}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2, + "z": 3 + } + } + ], + [ + {}, + { + "properties": { + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "z": 3 + } + } + ], + [ + {}, + {} + ] ], "expected": { "compiled": { @@ -22,9 +73,15 @@ "outputs": [ 1, 1, - {"error": "Expected value to be of type number, but found null instead."}, - {"error": "Expected value to be of type number, but found null instead."}, - {"error": "Expected value to be of type number, but found null instead."} + { + "error": "Expected value to be of type number, but found null instead." + }, + { + "error": "Expected value to be of type number, but found null instead." + }, + { + "error": "Expected value to be of type number, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/infer-array-type/test.json b/test/integration/expression/tests/coalesce/infer-array-type/test.json index 8661cffed..231b8bb5e 100644 --- a/test/integration/expression/tests/coalesce/infer-array-type/test.json +++ b/test/integration/expression/tests/coalesce/infer-array-type/test.json @@ -3,12 +3,28 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, "expression": [ "coalesce", - ["literal", ["one"]], - ["literal", ["one", "two"]], + [ + "literal", + [ + "one" + ] + ], + [ + "literal", + [ + "one", + "two" + ] + ], null ], "inputs": [], @@ -23,4 +39,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/inference/test.json b/test/integration/expression/tests/coalesce/inference/test.json index df2fbdea3..0bbfaa1e1 100644 --- a/test/integration/expression/tests/coalesce/inference/test.json +++ b/test/integration/expression/tests/coalesce/inference/test.json @@ -1,11 +1,57 @@ { - "propertySpec": {"type": "string"}, - "expression": ["coalesce", ["get", "a"], ["get", "b"]], + "propertySpec": { + "type": "string", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, + "expression": [ + "coalesce", + [ + "get", + "a" + ], + [ + "get", + "b" + ] + ], "inputs": [ - [{}, {"properties": {"a": "one"}}], - [{}, {"properties": {"b": "two"}}], - [{}, {"properties": {"b": 5}}], - [{}, {"properties": {}}] + [ + {}, + { + "properties": { + "a": "one" + } + } + ], + [ + {}, + { + "properties": { + "b": "two" + } + } + ], + [ + {}, + { + "properties": { + "b": 5 + } + } + ], + [ + {}, + { + "properties": {} + } + ] ], "expected": { "compiled": { @@ -14,6 +60,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["one", "two", "5", ""] + "outputs": [ + "one", + "two", + "5", + "" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/coalesce/null/test.json b/test/integration/expression/tests/coalesce/null/test.json index 6429ff240..1a8284c4e 100644 --- a/test/integration/expression/tests/coalesce/null/test.json +++ b/test/integration/expression/tests/coalesce/null/test.json @@ -1,7 +1,31 @@ { "expectExpressionType": null, - "expression": ["coalesce", ["get", "z"], 0], - "inputs": [[{}, {"properties": {"z": 1}}], [{}, {"properties": {"z": null}}]], + "expression": [ + "coalesce", + [ + "get", + "z" + ], + 0 + ], + "inputs": [ + [ + {}, + { + "properties": { + "z": 1 + } + } + ], + [ + {}, + { + "properties": { + "z": null + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -9,6 +33,9 @@ "isZoomConstant": true, "type": "value" }, - "outputs": [1, 0] + "outputs": [ + 1, + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/accent-equals-de/test.json b/test/integration/expression/tests/collator/accent-equals-de/test.json index e0585c80a..872e163e6 100644 --- a/test/integration/expression/tests/collator/accent-equals-de/test.json +++ b/test/integration/expression/tests/collator/accent-equals-de/test.json @@ -7,25 +7,70 @@ "resolved-locale", [ "collator", - {"case-sensitive": true, "diacritic-sensitive": false, "locale": "de"} + { + "case-sensitive": true, + "diacritic-sensitive": false, + "locale": "de" + } ] ], "de" ], [ "==", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": true, "diacritic-sensitive": false, "locale": "de"} + { + "case-sensitive": true, + "diacritic-sensitive": false, + "locale": "de" + } ] ], - ["case", ["==", ["get", "rhs"], "ue"], true, false] + [ + "case", + [ + "==", + [ + "get", + "rhs" + ], + "ue" + ], + true, + false + ] ], "inputs": [ - [{}, {"properties": {"lhs": "ü", "rhs": "ue"}}], - [{}, {"properties": {"lhs": "ü", "rhs": "u"}}] + [ + {}, + { + "properties": { + "lhs": "ü", + "rhs": "ue" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "ü", + "rhs": "u" + } + } + ] ], "expected": { "compiled": { @@ -34,6 +79,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false] + "outputs": [ + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/accent-lt-en/test.json b/test/integration/expression/tests/collator/accent-lt-en/test.json index 81d886d2e..fc7385364 100644 --- a/test/integration/expression/tests/collator/accent-lt-en/test.json +++ b/test/integration/expression/tests/collator/accent-lt-en/test.json @@ -1,17 +1,54 @@ { "expression": [ "<", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": true, "diacritic-sensitive": false, "locale": "en"} + { + "case-sensitive": true, + "diacritic-sensitive": false, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "ä", "rhs": "b"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "b" + } + } + ] ], "expected": { "compiled": { @@ -20,6 +57,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true] + "outputs": [ + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/accent-not-equals-en/test.json b/test/integration/expression/tests/collator/accent-not-equals-en/test.json index bc7c095c8..9b75a07ca 100644 --- a/test/integration/expression/tests/collator/accent-not-equals-en/test.json +++ b/test/integration/expression/tests/collator/accent-not-equals-en/test.json @@ -3,18 +3,55 @@ "!", [ "!=", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": true, "diacritic-sensitive": false, "locale": "en"} + { + "case-sensitive": true, + "diacritic-sensitive": false, + "locale": "en" + } ] ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -23,6 +60,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, false] + "outputs": [ + true, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/base-default-locale/test.json b/test/integration/expression/tests/collator/base-default-locale/test.json index 301b72dd4..cfde1b6f2 100644 --- a/test/integration/expression/tests/collator/base-default-locale/test.json +++ b/test/integration/expression/tests/collator/base-default-locale/test.json @@ -1,14 +1,53 @@ { "expression": [ "==", - ["string", ["get", "lhs"]], - ["get", "rhs"], - ["collator", {"case-sensitive": false, "diacritic-sensitive": false}] + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], + [ + "collator", + { + "case-sensitive": false, + "diacritic-sensitive": false + } + ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "a"}}], - [{}, {"properties": {"lhs": "A", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "a"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "A", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "a" + } + } + ] ], "expected": { "compiled": { @@ -17,6 +56,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false] + "outputs": [ + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/base-equals-en/test.json b/test/integration/expression/tests/collator/base-equals-en/test.json index e22c3c339..e8e9b6cda 100644 --- a/test/integration/expression/tests/collator/base-equals-en/test.json +++ b/test/integration/expression/tests/collator/base-equals-en/test.json @@ -1,17 +1,54 @@ { "expression": [ "==", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": false, "diacritic-sensitive": false, "locale": "en"} + { + "case-sensitive": false, + "diacritic-sensitive": false, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -20,6 +57,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false] + "outputs": [ + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/base-gt-en/test.json b/test/integration/expression/tests/collator/base-gt-en/test.json index da4367570..7aabdd460 100644 --- a/test/integration/expression/tests/collator/base-gt-en/test.json +++ b/test/integration/expression/tests/collator/base-gt-en/test.json @@ -1,17 +1,54 @@ { "expression": [ ">", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": false, "diacritic-sensitive": false, "locale": "en"} + { + "case-sensitive": false, + "diacritic-sensitive": false, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -20,6 +57,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true] + "outputs": [ + false, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/case-lteq-en/test.json b/test/integration/expression/tests/collator/case-lteq-en/test.json index dd2898adf..969d606aa 100644 --- a/test/integration/expression/tests/collator/case-lteq-en/test.json +++ b/test/integration/expression/tests/collator/case-lteq-en/test.json @@ -1,18 +1,63 @@ { "expression": [ "<=", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": false, "diacritic-sensitive": true, "locale": "en"} + { + "case-sensitive": false, + "diacritic-sensitive": true, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "ä", "rhs": "a"}}], - [{}, {"properties": {"lhs": "A", "rhs": "a"}}], - [{}, {"properties": {"lhs": "a", "rhs": "a"}}], - [{}, {"properties": {"lhs": "ä", "rhs": "b"}}] + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "A", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "b" + } + } + ] ], "expected": { "compiled": { @@ -21,6 +66,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, true] + "outputs": [ + false, + true, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/case-not-equals-en/test.json b/test/integration/expression/tests/collator/case-not-equals-en/test.json index 7f420b5bf..01f48626b 100644 --- a/test/integration/expression/tests/collator/case-not-equals-en/test.json +++ b/test/integration/expression/tests/collator/case-not-equals-en/test.json @@ -3,18 +3,55 @@ "!", [ "!=", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": false, "diacritic-sensitive": true, "locale": "en"} + { + "case-sensitive": false, + "diacritic-sensitive": true, + "locale": "en" + } ] ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -23,6 +60,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, false] + "outputs": [ + false, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/case-omitted-en/test.json b/test/integration/expression/tests/collator/case-omitted-en/test.json index f5e7003eb..92fa936ec 100644 --- a/test/integration/expression/tests/collator/case-omitted-en/test.json +++ b/test/integration/expression/tests/collator/case-omitted-en/test.json @@ -1,15 +1,62 @@ { "expression": [ "==", - ["string", ["get", "lhs"]], - ["get", "rhs"], - ["collator", {"diacritic-sensitive": true, "locale": "en"}] + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], + [ + "collator", + { + "diacritic-sensitive": true, + "locale": "en" + } + ] ], "inputs": [ - [{}, {"properties": {"lhs": "ä", "rhs": "a"}}], - [{}, {"properties": {"lhs": "A", "rhs": "a"}}], - [{}, {"properties": {"lhs": "a", "rhs": "a"}}], - [{}, {"properties": {"lhs": "ä", "rhs": "b"}}] + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "A", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "b" + } + } + ] ], "expected": { "compiled": { @@ -18,6 +65,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, false] + "outputs": [ + false, + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/comparison-number-error/test.json b/test/integration/expression/tests/collator/comparison-number-error/test.json index 921caa41d..416e283e2 100644 --- a/test/integration/expression/tests/collator/comparison-number-error/test.json +++ b/test/integration/expression/tests/collator/comparison-number-error/test.json @@ -3,14 +3,23 @@ "<", 1, 2, - ["collator", {"case-sensitive": false, "diacritic-sensitive": false}] + [ + "collator", + { + "case-sensitive": false, + "diacritic-sensitive": false + } + ] ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot use collator to compare non-string types."} + { + "key": "", + "error": "Cannot use collator to compare non-string types." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/diacritic-omitted-en/test.json b/test/integration/expression/tests/collator/diacritic-omitted-en/test.json index 2f5dec234..58741d4d1 100644 --- a/test/integration/expression/tests/collator/diacritic-omitted-en/test.json +++ b/test/integration/expression/tests/collator/diacritic-omitted-en/test.json @@ -1,14 +1,57 @@ { "expression": [ "<", - ["string", ["get", "lhs"]], - ["get", "rhs"], - ["collator", {"case-sensitive": ["==", 1, 1], "locale": "en"}] + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], + [ + "collator", + { + "case-sensitive": [ + "==", + 1, + 1 + ], + "locale": "en" + } + ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "ä", "rhs": "b"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "ä", + "rhs": "b" + } + } + ] ], "expected": { "compiled": { @@ -17,6 +60,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true] + "outputs": [ + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/equals-non-string-error/test.json b/test/integration/expression/tests/collator/equals-non-string-error/test.json index 4d566f90b..b97c7c8a6 100644 --- a/test/integration/expression/tests/collator/equals-non-string-error/test.json +++ b/test/integration/expression/tests/collator/equals-non-string-error/test.json @@ -3,14 +3,23 @@ "==", 1, 2, - ["collator", {"case-sensitive": false, "diacritic-sensitive": false}] + [ + "collator", + { + "case-sensitive": false, + "diacritic-sensitive": false + } + ] ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot use collator to compare non-string types."} + { + "key": "", + "error": "Cannot use collator to compare non-string types." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/non-object-error/test.json b/test/integration/expression/tests/collator/non-object-error/test.json index 148c9f1b5..3884327e8 100644 --- a/test/integration/expression/tests/collator/non-object-error/test.json +++ b/test/integration/expression/tests/collator/non-object-error/test.json @@ -1,11 +1,24 @@ { - "expression": ["==", "foo", "bar", ["collator", ["subexpression"]]], + "expression": [ + "==", + "foo", + "bar", + [ + "collator", + [ + "subexpression" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[3]", "error": "Collator options argument must be an object."} + { + "key": "[3]", + "error": "Collator options argument must be an object." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/variant-equals-en/test.json b/test/integration/expression/tests/collator/variant-equals-en/test.json index 44db50c5a..e0e3502cd 100644 --- a/test/integration/expression/tests/collator/variant-equals-en/test.json +++ b/test/integration/expression/tests/collator/variant-equals-en/test.json @@ -1,17 +1,54 @@ { "expression": [ "==", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": true, "diacritic-sensitive": true, "locale": "en"} + { + "case-sensitive": true, + "diacritic-sensitive": true, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -20,6 +57,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, false] + "outputs": [ + false, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/collator/variant-gteq-en/test.json b/test/integration/expression/tests/collator/variant-gteq-en/test.json index c88077c25..b7cc61b9b 100644 --- a/test/integration/expression/tests/collator/variant-gteq-en/test.json +++ b/test/integration/expression/tests/collator/variant-gteq-en/test.json @@ -1,18 +1,63 @@ { "expression": [ ">=", - ["string", ["get", "lhs"]], - ["get", "rhs"], + [ + "string", + [ + "get", + "lhs" + ] + ], + [ + "get", + "rhs" + ], [ "collator", - {"case-sensitive": true, "diacritic-sensitive": true, "locale": "en"} + { + "case-sensitive": true, + "diacritic-sensitive": true, + "locale": "en" + } ] ], "inputs": [ - [{}, {"properties": {"lhs": "a", "rhs": "ä"}}], - [{}, {"properties": {"lhs": "a", "rhs": "A"}}], - [{}, {"properties": {"lhs": "a", "rhs": "a"}}], - [{}, {"properties": {"lhs": "b", "rhs": "ä"}}] + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "ä" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "A" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "a", + "rhs": "a" + } + } + ], + [ + {}, + { + "properties": { + "lhs": "b", + "rhs": "ä" + } + } + ] ], "expected": { "compiled": { @@ -21,6 +66,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true, true] + "outputs": [ + false, + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/concat/arity-0/test.json b/test/integration/expression/tests/concat/arity-0/test.json index efd9b94a7..ae5a11857 100644 --- a/test/integration/expression/tests/concat/arity-0/test.json +++ b/test/integration/expression/tests/concat/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["concat"], - "inputs": [[{}, {}]], + "expression": [ + "concat" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": [""] + "outputs": [ + "" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/concat/arity-1/test.json b/test/integration/expression/tests/concat/arity-1/test.json index 0681db60d..9492a30ea 100644 --- a/test/integration/expression/tests/concat/arity-1/test.json +++ b/test/integration/expression/tests/concat/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["concat", "foo"], - "inputs": [[{}, {}]], + "expression": [ + "concat", + "foo" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["foo"] + "outputs": [ + "foo" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/concat/basic/test.json b/test/integration/expression/tests/concat/basic/test.json index 6e9285e8d..108d4c6f5 100644 --- a/test/integration/expression/tests/concat/basic/test.json +++ b/test/integration/expression/tests/concat/basic/test.json @@ -1,6 +1,16 @@ { - "expression": ["concat", "a", "b", "c"], - "inputs": [[{}, {}]], + "expression": [ + "concat", + "a", + "b", + "c" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["abc"] + "outputs": [ + "abc" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/concat/coercion/test.json b/test/integration/expression/tests/concat/coercion/test.json index b973448b5..8c4660b24 100644 --- a/test/integration/expression/tests/concat/coercion/test.json +++ b/test/integration/expression/tests/concat/coercion/test.json @@ -1,6 +1,31 @@ { - "expression": ["concat", ["get", "a"], ["get", "1"], ["get", "true"]], - "inputs": [[{}, {"properties": {"1": 1, "a": "a", "true": true}}]], + "expression": [ + "concat", + [ + "get", + "a" + ], + [ + "get", + "1" + ], + [ + "get", + "true" + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "1": 1, + "a": "a", + "true": true + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +33,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["a1true"] + "outputs": [ + "a1true" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/constant-folding/evaluation-error/test.json b/test/integration/expression/tests/constant-folding/evaluation-error/test.json index 1cde4dc35..3a96b8cf2 100644 --- a/test/integration/expression/tests/constant-folding/evaluation-error/test.json +++ b/test/integration/expression/tests/constant-folding/evaluation-error/test.json @@ -2,22 +2,76 @@ "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["step", ["get", "x"], "black", 0, "invalid", 10, "blue"], + "expression": [ + "step", + [ + "get", + "x" + ], + "black", + 0, + "invalid", + 10, + "blue" + ], "inputs": [ - [{}, {"properties": {"x": -1}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 5}}], - [{}, {"properties": {"x": 10}}], - [{}, {"properties": {"x": 11}}] + [ + {}, + { + "properties": { + "x": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 5 + } + } + ], + [ + {}, + { + "properties": { + "x": 10 + } + } + ], + [ + {}, + { + "properties": { + "x": 11 + } + } + ] ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[4]", "error": "Could not parse color from value 'invalid'"} + { + "key": "[4]", + "error": "Could not parse color from value 'invalid'" + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/constant-folding/to-color-inferred/test.json b/test/integration/expression/tests/constant-folding/to-color-inferred/test.json index c25bdc941..718bc318f 100644 --- a/test/integration/expression/tests/constant-folding/to-color-inferred/test.json +++ b/test/integration/expression/tests/constant-folding/to-color-inferred/test.json @@ -1,7 +1,22 @@ { - "propertySpec": {"type": "color"}, + "propertySpec": { + "type": "color", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "expression": "red", - "inputs": [[{}, {}]], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -9,6 +24,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[1, 0, 0, 1]] + "outputs": [ + [ + 1, + 0, + 0, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/constant-folding/to-color/test.json b/test/integration/expression/tests/constant-folding/to-color/test.json index 137387967..ed5e69ecb 100644 --- a/test/integration/expression/tests/constant-folding/to-color/test.json +++ b/test/integration/expression/tests/constant-folding/to-color/test.json @@ -1,6 +1,14 @@ { - "expression": ["to-color", "red"], - "inputs": [[{}, {}]], + "expression": [ + "to-color", + "red" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[1, 0, 0, 1]] + "outputs": [ + [ + 1, + 0, + 0, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/constant-folding/var/test.json b/test/integration/expression/tests/constant-folding/var/test.json index b9820fb1d..50093cf1d 100644 --- a/test/integration/expression/tests/constant-folding/var/test.json +++ b/test/integration/expression/tests/constant-folding/var/test.json @@ -5,9 +5,31 @@ 1, "b", 2, - ["+", ["+", ["var", "a"], ["var", "b"]], ["var", "a"]] + [ + "+", + [ + "+", + [ + "var", + "a" + ], + [ + "var", + "b" + ] + ], + [ + "var", + "a" + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "success", @@ -15,6 +37,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [4] + "outputs": [ + 4 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/cos/basic/test.json b/test/integration/expression/tests/cos/basic/test.json index 661ae95cc..76af077b9 100644 --- a/test/integration/expression/tests/cos/basic/test.json +++ b/test/integration/expression/tests/cos/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["cos", 0], - "inputs": [[{}, {}]], + "expression": [ + "cos", + 0 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/distance/basic/test.json b/test/integration/expression/tests/distance/basic/test.json index 7a8d58045..f39848d83 100644 --- a/test/integration/expression/tests/distance/basic/test.json +++ b/test/integration/expression/tests/distance/basic/test.json @@ -1,33 +1,52 @@ { - "expression": [ - "distance", - { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [3, 3] - } - } - ] - } - ], - "inputs": [ - [ - {"zoom": 20, "canonicalID": {"z": 20, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [3, 3]}} + "expression": [ + "distance", + { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + 3, + 3 + ] + } + } ] - ], - "expected": { - "compiled": { - "result": "success", - "isFeatureConstant": false, - "isZoomConstant": true, - "type": "number" - }, - "outputs": [0.0017018857364025284] } + ], + "inputs": [ + [ + { + "zoom": 20, + "canonicalID": { + "z": 20, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 3, + 3 + ] + } + } + ] + ], + "expected": { + "compiled": { + "result": "success", + "isFeatureConstant": false, + "isZoomConstant": true, + "type": "number" + }, + "outputs": [ + 0.00170188 + ] } - \ No newline at end of file +} \ No newline at end of file diff --git a/test/integration/expression/tests/divide/basic/test.json b/test/integration/expression/tests/divide/basic/test.json index eb34d13e1..ccf991e31 100644 --- a/test/integration/expression/tests/divide/basic/test.json +++ b/test/integration/expression/tests/divide/basic/test.json @@ -1,6 +1,15 @@ { - "expression": ["/", 10, 5], - "inputs": [[{}, {}]], + "expression": [ + "/", + 10, + 5 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +17,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2] + "outputs": [ + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/downcase/basic/test.json b/test/integration/expression/tests/downcase/basic/test.json index 881137d4a..7ff9d114c 100644 --- a/test/integration/expression/tests/downcase/basic/test.json +++ b/test/integration/expression/tests/downcase/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["downcase", "StRiNg"], - "inputs": [[{}, {}]], + "expression": [ + "downcase", + "StRiNg" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["string"] + "outputs": [ + "string" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/e/basic/test.json b/test/integration/expression/tests/e/basic/test.json index e89f276b3..abec7a046 100644 --- a/test/integration/expression/tests/e/basic/test.json +++ b/test/integration/expression/tests/e/basic/test.json @@ -1,6 +1,13 @@ { - "expression": ["e"], - "inputs": [[{}, {}]], + "expression": [ + "e" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2.71828] + "outputs": [ + 2.71828 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/array/test.json b/test/integration/expression/tests/equal/array/test.json index fe28d0798..43d8d4fa4 100644 --- a/test/integration/expression/tests/equal/array/test.json +++ b/test/integration/expression/tests/equal/array/test.json @@ -1,5 +1,17 @@ { - "expression": ["==", ["get", "x"], ["literal", [1]]], + "expression": [ + "==", + [ + "get", + "x" + ], + [ + "literal", + [ + 1 + ] + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +23,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/collator-value/test.json b/test/integration/expression/tests/equal/collator-value/test.json index 64e8afec9..04542292f 100644 --- a/test/integration/expression/tests/equal/collator-value/test.json +++ b/test/integration/expression/tests/equal/collator-value/test.json @@ -1,17 +1,77 @@ { "expression": [ "==", - ["get", "x"], - ["get", "y"], - ["collator", {"case-sensitive": false, "diacritic-sensitive": false}] + [ + "get", + "x" + ], + [ + "get", + "y" + ], + [ + "collator", + { + "case-sensitive": false, + "diacritic-sensitive": false + } + ] ], "inputs": [ - [{}, {"properties": {"x": "a", "y": "A"}}], - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "1", "y": null}}], - [{}, {"properties": {"x": null, "y": null}}], - [{}, {"properties": {"x": 1, "y": "1"}}], - [{}, {"properties": {"x": 1, "y": 1}}] + [ + {}, + { + "properties": { + "x": "a", + "y": "A" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": null + } + } + ], + [ + {}, + { + "properties": { + "x": null, + "y": null + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -20,6 +80,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, false, true, false, true] + "outputs": [ + true, + false, + false, + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/color/test.json b/test/integration/expression/tests/equal/color/test.json index 6e04c7410..1a3b88264 100644 --- a/test/integration/expression/tests/equal/color/test.json +++ b/test/integration/expression/tests/equal/color/test.json @@ -1,5 +1,15 @@ { - "expression": ["==", ["get", "x"], ["to-color", "red"]], + "expression": [ + "==", + [ + "get", + "x" + ], + [ + "to-color", + "red" + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +21,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/mismatch/test.json b/test/integration/expression/tests/equal/mismatch/test.json index a1b440244..265694aa2 100644 --- a/test/integration/expression/tests/equal/mismatch/test.json +++ b/test/integration/expression/tests/equal/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": ["==", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "==", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/null-lhs/test.json b/test/integration/expression/tests/equal/null-lhs/test.json index 86e6f84e6..c46179b04 100644 --- a/test/integration/expression/tests/equal/null-lhs/test.json +++ b/test/integration/expression/tests/equal/null-lhs/test.json @@ -1,6 +1,28 @@ { - "expression": ["==", null, ["get", "x"]], - "inputs": [[{}, {"properties": {}}], [{}, {"properties": {"x": 1}}]], + "expression": [ + "==", + null, + [ + "get", + "x" + ] + ], + "inputs": [ + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +30,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false] + "outputs": [ + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/null-rhs/test.json b/test/integration/expression/tests/equal/null-rhs/test.json index 86e6f84e6..c46179b04 100644 --- a/test/integration/expression/tests/equal/null-rhs/test.json +++ b/test/integration/expression/tests/equal/null-rhs/test.json @@ -1,6 +1,28 @@ { - "expression": ["==", null, ["get", "x"]], - "inputs": [[{}, {"properties": {}}], [{}, {"properties": {"x": 1}}]], + "expression": [ + "==", + null, + [ + "get", + "x" + ] + ], + "inputs": [ + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +30,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false] + "outputs": [ + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/number/test.json b/test/integration/expression/tests/equal/number/test.json index 7d0cef652..e9b5c73f4 100644 --- a/test/integration/expression/tests/equal/number/test.json +++ b/test/integration/expression/tests/equal/number/test.json @@ -1,9 +1,46 @@ { - "expression": ["==", ["number", ["get", "x"]], ["get", "y"]], + "expression": [ + "==", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": 2}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -12,6 +49,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, false] + "outputs": [ + true, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/object/test.json b/test/integration/expression/tests/equal/object/test.json index 97a51854e..67b736016 100644 --- a/test/integration/expression/tests/equal/object/test.json +++ b/test/integration/expression/tests/equal/object/test.json @@ -1,5 +1,15 @@ { - "expression": ["==", ["get", "x"], ["literal", {}]], + "expression": [ + "==", + [ + "get", + "x" + ], + [ + "literal", + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +21,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/string/test.json b/test/integration/expression/tests/equal/string/test.json index 959a39d06..99a726e80 100644 --- a/test/integration/expression/tests/equal/string/test.json +++ b/test/integration/expression/tests/equal/string/test.json @@ -1,9 +1,46 @@ { - "expression": ["==", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + "==", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": 2}}], - [{}, {"properties": {"x": "1", "y": 1}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +49,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, false] + "outputs": [ + true, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/equal/value/test.json b/test/integration/expression/tests/equal/value/test.json index eba997e24..258ce94ed 100644 --- a/test/integration/expression/tests/equal/value/test.json +++ b/test/integration/expression/tests/equal/value/test.json @@ -1,12 +1,70 @@ { - "expression": ["==", ["get", "x"], ["get", "y"]], + "expression": [ + "==", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": 0, "y": 0}}], - [{}, {"properties": {"x": "0", "y": "0"}}], - [{}, {"properties": {"x": 0, "y": false}}], - [{}, {"properties": {"x": 0, "y": "0"}}], - [{}, {"properties": {"x": 0, "y": null}}], - [{}, {"properties": {"x": "0", "y": null}}] + [ + {}, + { + "properties": { + "x": 0, + "y": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": "0", + "y": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": null + } + } + ], + [ + {}, + { + "properties": { + "x": "0", + "y": null + } + } + ] ], "expected": { "compiled": { @@ -15,6 +73,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false, false, false, false] + "outputs": [ + true, + true, + false, + false, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/floor/basic/test.json b/test/integration/expression/tests/floor/basic/test.json index c64f6edaf..2239348cd 100644 --- a/test/integration/expression/tests/floor/basic/test.json +++ b/test/integration/expression/tests/floor/basic/test.json @@ -1,14 +1,76 @@ { - "expression": ["floor", ["get", "x"]], + "expression": [ + "floor", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": -2.6}}], - [{}, {"properties": {"x": -2.5}}], - [{}, {"properties": {"x": -2.4}}], - [{}, {"properties": {"x": -2}}], - [{}, {"properties": {"x": 2.6}}], - [{}, {"properties": {"x": 2.5}}], - [{}, {"properties": {"x": 2.4}}], - [{}, {"properties": {"x": 2}}] + [ + {}, + { + "properties": { + "x": -2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": -2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ] ], "expected": { "compiled": { @@ -17,6 +79,15 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-3, -3, -3, -2, 2, 2, 2, 2] + "outputs": [ + -3, + -3, + -3, + -2, + 2, + 2, + 2, + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/basic/test.json b/test/integration/expression/tests/format/basic/test.json index 415f14cf5..203bcd228 100644 --- a/test/integration/expression/tests/format/basic/test.json +++ b/test/integration/expression/tests/format/basic/test.json @@ -4,13 +4,30 @@ "a", {}, "b", - {"font-scale": 2}, + { + "font-scale": 2 + }, "c", - {"text-font": ["literal", ["a", "b"]]}, + { + "text-font": [ + "literal", + [ + "a", + "b" + ] + ] + }, "d", - {"text-color": "rgb(0, 255, 0)"} + { + "text-color": "rgb(0, 255, 0)" + } + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "success", @@ -47,10 +64,15 @@ "image": null, "scale": null, "fontStack": null, - "textColor": {"r": 0, "g": 1, "b": 0, "a": 1} + "textColor": { + "r": 0, + "g": 1, + "b": 0, + "a": 1 + } } ] } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/coercion/test.json b/test/integration/expression/tests/format/coercion/test.json index c002c9cdd..1e4851022 100644 --- a/test/integration/expression/tests/format/coercion/test.json +++ b/test/integration/expression/tests/format/coercion/test.json @@ -1,14 +1,34 @@ { "expression": [ "format", - ["get", "a"], + [ + "get", + "a" + ], {}, - ["get", "1"], + [ + "get", + "1" + ], {}, - ["get", "true"], + [ + "get", + "true" + ], {} ], - "inputs": [[{}, {"properties": {"1": 1, "a": "a", "true": true}}]], + "inputs": [ + [ + {}, + { + "properties": { + "1": 1, + "a": "a", + "true": true + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -44,4 +64,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/data-driven-font/test.json b/test/integration/expression/tests/format/data-driven-font/test.json index 87555cfc0..25f380e1f 100644 --- a/test/integration/expression/tests/format/data-driven-font/test.json +++ b/test/integration/expression/tests/format/data-driven-font/test.json @@ -1,8 +1,31 @@ { - "expression": ["format", "a", {"font-scale": ["get", "font-scale"]}], + "expression": [ + "format", + "a", + { + "font-scale": [ + "get", + "font-scale" + ] + } + ], "inputs": [ - [{}, {"properties": {"font-scale": 1.5}}], - [{}, {"properties": {"font-scale": 0.5}}] + [ + {}, + { + "properties": { + "font-scale": 1.5 + } + } + ], + [ + {}, + { + "properties": { + "font-scale": 0.5 + } + } + ] ], "expected": { "compiled": { @@ -36,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/data-driven-scale/test.json b/test/integration/expression/tests/format/data-driven-scale/test.json index 86ee0a91f..7646de6fa 100644 --- a/test/integration/expression/tests/format/data-driven-scale/test.json +++ b/test/integration/expression/tests/format/data-driven-scale/test.json @@ -2,9 +2,29 @@ "expression": [ "format", "a", - {"text-font": ["array", ["string", ["get", "text-font"]]]} + { + "text-font": [ + "array", + [ + "string", + [ + "get", + "text-font" + ] + ] + ] + } + ], + "inputs": [ + [ + {}, + { + "properties": { + "text-font": "test" + } + } + ] ], - "inputs": [[{}, {"properties": {"text-font": "test"}}]], "expected": { "compiled": { "result": "error", @@ -16,4 +36,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/image-sections/test.json b/test/integration/expression/tests/format/image-sections/test.json index b9f1ffc4c..7bb844352 100644 --- a/test/integration/expression/tests/format/image-sections/test.json +++ b/test/integration/expression/tests/format/image-sections/test.json @@ -1,6 +1,25 @@ { - "expression": ["format", ["image", "monument-15"], ["image", "beach-11"]], - "inputs": [[{"availableImages": ["monument-15"]}, {}]], + "expression": [ + "format", + [ + "image", + "monument-15" + ], + [ + "image", + "beach-11" + ] + ], + "inputs": [ + [ + { + "availableImages": [ + "monument-15" + ] + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -13,14 +32,20 @@ "sections": [ { "text": "", - "image": {"name": "monument-15", "available": true}, + "image": { + "name": "monument-15", + "available": true + }, "scale": null, "fontStack": null, "textColor": null }, { "text": "", - "image": {"name": "beach-11", "available": false}, + "image": { + "name": "beach-11", + "available": false + }, "scale": null, "fontStack": null, "textColor": null @@ -29,4 +54,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/implicit-assert/test.json b/test/integration/expression/tests/format/implicit-assert/test.json index 1edda1ab1..8aebefe40 100644 --- a/test/integration/expression/tests/format/implicit-assert/test.json +++ b/test/integration/expression/tests/format/implicit-assert/test.json @@ -1,12 +1,31 @@ { - "expression": ["number", ["get", "p"]], - "propertySpec": {"type": "formatted"}, + "expression": [ + "number", + [ + "get", + "p" + ] + ], + "propertySpec": { + "type": "formatted", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected formatted but found number instead."} + { + "key": "", + "error": "Expected formatted but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/implicit-coerce/test.json b/test/integration/expression/tests/format/implicit-coerce/test.json index 96eece538..d365f6ed8 100644 --- a/test/integration/expression/tests/format/implicit-coerce/test.json +++ b/test/integration/expression/tests/format/implicit-coerce/test.json @@ -1,10 +1,45 @@ { - "expression": ["to-string", ["get", "p"]], - "propertySpec": {"type": "formatted"}, + "expression": [ + "to-string", + [ + "get", + "p" + ] + ], + "propertySpec": { + "type": "formatted", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": "a"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ] ], "expected": { "compiled": { @@ -49,4 +84,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/implicit-omit/test.json b/test/integration/expression/tests/format/implicit-omit/test.json index 6f1ca8032..1d253a3e6 100644 --- a/test/integration/expression/tests/format/implicit-omit/test.json +++ b/test/integration/expression/tests/format/implicit-omit/test.json @@ -1,10 +1,49 @@ { - "expression": ["coalesce", ["get", "q"], ["get", "p"]], - "propertySpec": {"type": "formatted"}, + "expression": [ + "coalesce", + [ + "get", + "q" + ], + [ + "get", + "p" + ] + ], + "propertySpec": { + "type": "formatted", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": "a"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ] ], "expected": { "compiled": { @@ -49,4 +88,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/implicit/test.json b/test/integration/expression/tests/format/implicit/test.json index 0e8ed7792..93fe5924b 100644 --- a/test/integration/expression/tests/format/implicit/test.json +++ b/test/integration/expression/tests/format/implicit/test.json @@ -1,10 +1,42 @@ { - "expression": ["get", "p"], - "propertySpec": {"type": "formatted"}, + "expression": [ + "get", + "p" + ], + "propertySpec": { + "type": "formatted", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": "a"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ] ], "expected": { "compiled": { @@ -49,4 +81,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/format/to-string/test.json b/test/integration/expression/tests/format/to-string/test.json index 3f1f8be68..ef9467bac 100644 --- a/test/integration/expression/tests/format/to-string/test.json +++ b/test/integration/expression/tests/format/to-string/test.json @@ -6,12 +6,27 @@ "a", {}, "b", - {"font-scale": 2}, + { + "font-scale": 2 + }, "c", - {"text-font": ["literal", ["a", "b"]]} + { + "text-font": [ + "literal", + [ + "a", + "b" + ] + ] + } + ] + ], + "inputs": [ + [ + {}, + {} ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "success", @@ -19,6 +34,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["abc"] + "outputs": [ + "abc" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/geometry-type/basic/test.json b/test/integration/expression/tests/geometry-type/basic/test.json index b8a2a576a..295e9ed8f 100644 --- a/test/integration/expression/tests/geometry-type/basic/test.json +++ b/test/integration/expression/tests/geometry-type/basic/test.json @@ -1,7 +1,26 @@ { - "expression": ["geometry-type"], + "expression": [ + "geometry-type" + ], "inputs": [ - [{}, {"geometry": {"type": "LineString", "coordinates": [[0, 0], [10, 0]]}}] + [ + {}, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ] + } + } + ] ], "expected": { "compiled": { @@ -10,6 +29,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["LineString"] + "outputs": [ + "LineString" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/get/basic/test.json b/test/integration/expression/tests/get/basic/test.json index a64994480..b9c9b63bd 100644 --- a/test/integration/expression/tests/get/basic/test.json +++ b/test/integration/expression/tests/get/basic/test.json @@ -1,6 +1,25 @@ { - "expression": ["number", ["get", "x"]], - "inputs": [[{}, {}], [{}, {"properties": {"x": 1}}]], + "expression": [ + "number", + [ + "get", + "x" + ] + ], + "inputs": [ + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -9,8 +28,10 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 1 ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/get/from-literal--missing/test.json b/test/integration/expression/tests/get/from-literal--missing/test.json index dcd403efd..49ca31c8a 100644 --- a/test/integration/expression/tests/get/from-literal--missing/test.json +++ b/test/integration/expression/tests/get/from-literal--missing/test.json @@ -1,6 +1,23 @@ { - "expression": ["number", ["get", "x", ["literal", {"y": 0}]]], - "inputs": [[{}, {}]], + "expression": [ + "number", + [ + "get", + "x", + [ + "literal", + { + "y": 0 + } + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +29,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/get/from-literal/test.json b/test/integration/expression/tests/get/from-literal/test.json index eb629fb2c..038491b5a 100644 --- a/test/integration/expression/tests/get/from-literal/test.json +++ b/test/integration/expression/tests/get/from-literal/test.json @@ -1,6 +1,23 @@ { - "expression": ["number", ["get", "x", ["literal", {"x": 0}]]], - "inputs": [[{}, {}]], + "expression": [ + "number", + [ + "get", + "x", + [ + "literal", + { + "x": 0 + } + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +25,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0] + "outputs": [ + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/get/from-object-property/test.json b/test/integration/expression/tests/get/from-object-property/test.json index dabfbb2b2..5662a179c 100644 --- a/test/integration/expression/tests/get/from-object-property/test.json +++ b/test/integration/expression/tests/get/from-object-property/test.json @@ -1,6 +1,30 @@ { - "expression": ["number", ["get", "x", ["object", ["get", "a"]]]], - "inputs": [[{}, {"properties": {"a": {"x": 1}}}]], + "expression": [ + "number", + [ + "get", + "x", + [ + "object", + [ + "get", + "a" + ] + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "a": { + "x": 1 + } + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +32,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/boolean/test.json b/test/integration/expression/tests/greater/boolean/test.json index 0947dcf6e..7fd98b4d7 100644 --- a/test/integration/expression/tests/greater/boolean/test.json +++ b/test/integration/expression/tests/greater/boolean/test.json @@ -1,5 +1,21 @@ { - "expression": [">", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + ">", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/mismatch/test.json b/test/integration/expression/tests/greater/mismatch/test.json index e073c4848..0f8c435ac 100644 --- a/test/integration/expression/tests/greater/mismatch/test.json +++ b/test/integration/expression/tests/greater/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": [">", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + ">", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/null/test.json b/test/integration/expression/tests/greater/null/test.json index 44c8e864d..0853630b0 100644 --- a/test/integration/expression/tests/greater/null/test.json +++ b/test/integration/expression/tests/greater/null/test.json @@ -1,5 +1,9 @@ { - "expression": [">", null, null], + "expression": [ + ">", + null, + null + ], "expected": { "compiled": { "result": "error", @@ -11,4 +15,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/number/test.json b/test/integration/expression/tests/greater/number/test.json index b73a3a790..0a96d802c 100644 --- a/test/integration/expression/tests/greater/number/test.json +++ b/test/integration/expression/tests/greater/number/test.json @@ -1,9 +1,49 @@ { - "expression": [">", ["number", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + ">", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": 2}}], - [{}, {"properties": {"x": 2, "y": 1}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2, + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +52,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true] + "outputs": [ + false, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/string-and-value/test.json b/test/integration/expression/tests/greater/string-and-value/test.json index 3b4a6a2f3..17ea9f3ca 100644 --- a/test/integration/expression/tests/greater/string-and-value/test.json +++ b/test/integration/expression/tests/greater/string-and-value/test.json @@ -1,9 +1,46 @@ { - "expression": [">", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + ">", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "2", "y": "1"}}], - [{}, {"properties": {"x": "2", "y": 1}}], - [{}, {"properties": {"x": 2, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "2", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "2", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 2, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -22,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/string/test.json b/test/integration/expression/tests/greater/string/test.json index fe85fbe81..6f32315d0 100644 --- a/test/integration/expression/tests/greater/string/test.json +++ b/test/integration/expression/tests/greater/string/test.json @@ -1,12 +1,76 @@ { - "expression": [">", ["string", ["get", "x"]], ["string", ["get", "y"]]], + "expression": [ + ">", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "string", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "2", "y": "1"}}], - [{}, {"properties": {"x": "abc", "y": "azz"}}], - [{}, {"properties": {"x": "abc", "y": "aaa"}}], - [{}, {"properties": {"x": "abc", "y": "abc"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "2", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "azz" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "aaa" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "abc" + } + } + ] ], "expected": { "compiled": { @@ -15,6 +79,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true, false, true, false] + "outputs": [ + false, + false, + true, + false, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater/value/test.json b/test/integration/expression/tests/greater/value/test.json index ce620f22c..ce68242e7 100644 --- a/test/integration/expression/tests/greater/value/test.json +++ b/test/integration/expression/tests/greater/value/test.json @@ -1,10 +1,52 @@ { - "expression": [">", ["get", "x"], ["get", "y"]], + "expression": [ + ">", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "2", "y": "10"}}], - [{}, {"properties": {"x": 10, "y": 1}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "2", + "y": "10" + } + } + ], + [ + {}, + { + "properties": { + "x": 10, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -24,4 +66,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/boolean/test.json b/test/integration/expression/tests/greater_or_equal/boolean/test.json index 5ec7d8021..579537278 100644 --- a/test/integration/expression/tests/greater_or_equal/boolean/test.json +++ b/test/integration/expression/tests/greater_or_equal/boolean/test.json @@ -1,5 +1,21 @@ { - "expression": [">=", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + ">=", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/mismatch/test.json b/test/integration/expression/tests/greater_or_equal/mismatch/test.json index 9b2275f0f..fe90daa49 100644 --- a/test/integration/expression/tests/greater_or_equal/mismatch/test.json +++ b/test/integration/expression/tests/greater_or_equal/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": [">=", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + ">=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/null/test.json b/test/integration/expression/tests/greater_or_equal/null/test.json index 4fbf753fc..9b74c34cd 100644 --- a/test/integration/expression/tests/greater_or_equal/null/test.json +++ b/test/integration/expression/tests/greater_or_equal/null/test.json @@ -1,5 +1,9 @@ { - "expression": [">=", null, null], + "expression": [ + ">=", + null, + null + ], "expected": { "compiled": { "result": "error", @@ -11,4 +15,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/number/test.json b/test/integration/expression/tests/greater_or_equal/number/test.json index 564774a4c..d83320225 100644 --- a/test/integration/expression/tests/greater_or_equal/number/test.json +++ b/test/integration/expression/tests/greater_or_equal/number/test.json @@ -1,9 +1,49 @@ { - "expression": [">=", ["number", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + ">=", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": 2}}], - [{}, {"properties": {"x": 2, "y": 1}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2, + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +52,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, true] + "outputs": [ + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/string-and-value/test.json b/test/integration/expression/tests/greater_or_equal/string-and-value/test.json index 9e3c77a5b..d68c30ecc 100644 --- a/test/integration/expression/tests/greater_or_equal/string-and-value/test.json +++ b/test/integration/expression/tests/greater_or_equal/string-and-value/test.json @@ -1,9 +1,46 @@ { - "expression": [">=", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + ">=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -22,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/string/test.json b/test/integration/expression/tests/greater_or_equal/string/test.json index ec2ea062e..c9f4aba2e 100644 --- a/test/integration/expression/tests/greater_or_equal/string/test.json +++ b/test/integration/expression/tests/greater_or_equal/string/test.json @@ -1,12 +1,76 @@ { - "expression": [">=", ["string", ["get", "x"]], ["string", ["get", "y"]]], + "expression": [ + ">=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "string", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "2", "y": "1"}}], - [{}, {"properties": {"x": "abc", "y": "azz"}}], - [{}, {"properties": {"x": "abc", "y": "aaa"}}], - [{}, {"properties": {"x": "abc", "y": "abc"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "2", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "azz" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "aaa" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "abc" + } + } + ] ], "expected": { "compiled": { @@ -15,6 +79,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, true, false, true, true] + "outputs": [ + true, + false, + true, + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/greater_or_equal/value/test.json b/test/integration/expression/tests/greater_or_equal/value/test.json index da32cd356..70ce6c7a4 100644 --- a/test/integration/expression/tests/greater_or_equal/value/test.json +++ b/test/integration/expression/tests/greater_or_equal/value/test.json @@ -1,10 +1,52 @@ { - "expression": [">=", ["get", "x"], ["get", "y"]], + "expression": [ + ">=", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "2", "y": "10"}}], - [{}, {"properties": {"x": 10, "y": 1}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "2", + "y": "10" + } + } + ], + [ + {}, + { + "properties": { + "x": 10, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -24,4 +66,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/has/basic/test.json b/test/integration/expression/tests/has/basic/test.json index 83aa848de..705df5ae6 100644 --- a/test/integration/expression/tests/has/basic/test.json +++ b/test/integration/expression/tests/has/basic/test.json @@ -1,11 +1,45 @@ { - "expression": ["has", "x"], + "expression": [ + "has", + "x" + ], "inputs": [ - [{}, {}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -14,6 +48,12 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, true, true] + "outputs": [ + false, + true, + true, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/heatmap-density/basic/test.json b/test/integration/expression/tests/heatmap-density/basic/test.json index d8086033a..dfa4a5d8f 100644 --- a/test/integration/expression/tests/heatmap-density/basic/test.json +++ b/test/integration/expression/tests/heatmap-density/basic/test.json @@ -3,27 +3,61 @@ "type": "color", "default": { "stops": [ - [0, "rgba(0, 0, 255, 0)"], - [0.1, "royalblue"], - [0.3, "cyan"], - [0.5, "lime"], - [0.7, "yellow"], - [1, "red"] + [ + 0, + "rgba(0, 0, 255, 0)" + ], + [ + 0.1, + "royalblue" + ], + [ + 0.3, + "cyan" + ], + [ + 0.5, + "lime" + ], + [ + 0.7, + "yellow" + ], + [ + 1, + "red" + ] ] }, "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, "expression": [ "interpolate", - ["linear"], - ["heatmap-density"], + [ + "linear" + ], + [ + "heatmap-density" + ], 0, "#000000", 1, "#ff0000" ], - "inputs": [[{"heatmapDensity": 0.5}, {}]], + "inputs": [ + [ + { + "heatmapDensity": 0.5 + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -31,6 +65,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0.5, 0, 0, 1]] + "outputs": [ + [ + 0.5, + 0, + 0, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/id/basic/test.json b/test/integration/expression/tests/id/basic/test.json index dfbccd738..d7eb78f3f 100644 --- a/test/integration/expression/tests/id/basic/test.json +++ b/test/integration/expression/tests/id/basic/test.json @@ -1,6 +1,25 @@ { - "expression": ["id"], - "inputs": [[{}, {}], [{}, {"id": 1}], [{}, {"id": "one"}]], + "expression": [ + "id" + ], + "inputs": [ + [ + {}, + {} + ], + [ + {}, + { + "id": 1 + } + ], + [ + {}, + { + "id": "one" + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +27,10 @@ "isZoomConstant": true, "type": "value" }, - "outputs": [null, 1, "one"] + "outputs": [ + null, + 1, + "one" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/image/basic/test.json b/test/integration/expression/tests/image/basic/test.json index e9da6c460..cc9cea819 100644 --- a/test/integration/expression/tests/image/basic/test.json +++ b/test/integration/expression/tests/image/basic/test.json @@ -1,6 +1,18 @@ { - "expression": ["image", "monument-15"], - "inputs": [[{"availableImages": ["monument-15"]}, {}]], + "expression": [ + "image", + "monument-15" + ], + "inputs": [ + [ + { + "availableImages": [ + "monument-15" + ] + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +20,11 @@ "isZoomConstant": true, "type": "resolvedImage" }, - "outputs": [{"name": "monument-15", "available": true}] + "outputs": [ + { + "name": "monument-15", + "available": true + } + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/image/coalesce/test.json b/test/integration/expression/tests/image/coalesce/test.json index 2ee26e880..9206ea111 100644 --- a/test/integration/expression/tests/image/coalesce/test.json +++ b/test/integration/expression/tests/image/coalesce/test.json @@ -1,12 +1,40 @@ { "expression": [ "coalesce", - ["image", "foo"], - ["image", "bar"], - ["image", "monument-15"] + [ + "image", + "foo" + ], + [ + "image", + "bar" + ], + [ + "image", + "monument-15" + ] + ], + "propertySpec": { + "type": "resolvedImage", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, + "inputs": [ + [ + { + "availableImages": [ + "monument-15" + ] + }, + {} + ] ], - "propertySpec": {"type": "resolvedImage"}, - "inputs": [[{"availableImages": ["monument-15"]}, {}]], "expected": { "compiled": { "result": "success", @@ -14,6 +42,11 @@ "isZoomConstant": true, "type": "resolvedImage" }, - "outputs": [{"name": "monument-15", "available": true}] + "outputs": [ + { + "name": "monument-15", + "available": true + } + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/image/compound/test.json b/test/integration/expression/tests/image/compound/test.json index a9e50f19a..91a057f40 100644 --- a/test/integration/expression/tests/image/compound/test.json +++ b/test/integration/expression/tests/image/compound/test.json @@ -1,9 +1,23 @@ { - "expression": ["image", ["get", "icon"]], + "expression": [ + "image", + [ + "get", + "icon" + ] + ], "inputs": [ [ - {"availableImages": ["monument-15"]}, - {"properties": {"icon": "monument-15"}} + { + "availableImages": [ + "monument-15" + ] + }, + { + "properties": { + "icon": "monument-15" + } + } ] ], "expected": { @@ -13,6 +27,11 @@ "isZoomConstant": true, "type": "resolvedImage" }, - "outputs": [{"name": "monument-15", "available": true}] + "outputs": [ + { + "name": "monument-15", + "available": true + } + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/image/implicit-assert/test.json b/test/integration/expression/tests/image/implicit-assert/test.json index 84288fad3..a8a08000a 100644 --- a/test/integration/expression/tests/image/implicit-assert/test.json +++ b/test/integration/expression/tests/image/implicit-assert/test.json @@ -1,12 +1,31 @@ { - "expression": ["number", ["get", "icon"]], - "propertySpec": {"type": "resolvedImage"}, + "expression": [ + "number", + [ + "get", + "icon" + ] + ], + "propertySpec": { + "type": "resolvedImage", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected resolvedImage but found number instead."} + { + "key": "", + "error": "Expected resolvedImage but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/assert-array/test.json b/test/integration/expression/tests/in/assert-array/test.json index 81784ddbe..00a0395e8 100644 --- a/test/integration/expression/tests/in/assert-array/test.json +++ b/test/integration/expression/tests/in/assert-array/test.json @@ -1,11 +1,84 @@ { - "expression": ["boolean", ["in", ["get", "i"], ["array", ["get", "arr"]]]], + "expression": [ + "boolean", + [ + "in", + [ + "get", + "i" + ], + [ + "array", + [ + "get", + "arr" + ] + ] + ] + ], "inputs": [ - [{}, {"properties": {"i": null, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 9, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": null, "arr": [9, 8, 7, null]}}], - [{}, {"properties": {"i": 1, "arr": null}}] + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 9, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7, + null + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": null + } + } + ] ], "expected": { "compiled": { @@ -19,7 +92,9 @@ false, true, true, - {"error": "Expected value to be of type array, but found null instead."} + { + "error": "Expected value to be of type array, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/assert-string/test.json b/test/integration/expression/tests/in/assert-string/test.json index 01a44628a..88bf59fe7 100644 --- a/test/integration/expression/tests/in/assert-string/test.json +++ b/test/integration/expression/tests/in/assert-string/test.json @@ -1,13 +1,58 @@ { "expression": [ "boolean", - ["in", ["get", "substr"], ["string", ["get", "str"]]] + [ + "in", + [ + "get", + "substr" + ], + [ + "string", + [ + "get", + "str" + ] + ] + ] ], "inputs": [ - [{}, {"properties": {"substr": null, "str": "helloworld"}}], - [{}, {"properties": {"substr": "foo", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": null}}] + [ + {}, + { + "properties": { + "substr": null, + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "foo", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": null + } + } + ] ], "expected": { "compiled": { @@ -20,7 +65,9 @@ false, false, true, - {"error": "Expected value to be of type string, but found null instead."} + { + "error": "Expected value to be of type string, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/basic-array/test.json b/test/integration/expression/tests/in/basic-array/test.json index f9e82b11e..5ac250c3b 100644 --- a/test/integration/expression/tests/in/basic-array/test.json +++ b/test/integration/expression/tests/in/basic-array/test.json @@ -1,15 +1,70 @@ { - "expression": ["boolean", ["in", ["get", "i"], ["get", "arr"]]], + "expression": [ + "boolean", + [ + "in", + [ + "get", + "i" + ], + [ + "get", + "arr" + ] + ] + ], "inputs": [ - [{}, {"properties": {"i": null, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 9, "arr": [9, 8, 7]}}], + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 9, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], [ {}, { "properties": { "i": "foo", - "arr": ["baz", "bar", "hello", "foo", "world"] + "arr": [ + "baz", + "bar", + "hello", + "foo", + "world" + ] } } ], @@ -18,7 +73,15 @@ { "properties": { "i": true, - "arr": ["foo", 123, null, 456, false, {}, true] + "arr": [ + "foo", + 123, + null, + 456, + false, + {}, + true + ] } } ], @@ -27,11 +90,27 @@ { "properties": { "i": null, - "arr": ["foo", 123, null, 456, false, {}, true] + "arr": [ + "foo", + 123, + null, + 456, + false, + {}, + true + ] } } ], - [{}, {"properties": {"i": 1, "arr": null}}] + [ + {}, + { + "properties": { + "i": 1, + "arr": null + } + } + ] ], "expected": { "compiled": { @@ -40,6 +119,14 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true, true, true, true, false] + "outputs": [ + false, + false, + true, + true, + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/basic-string/test.json b/test/integration/expression/tests/in/basic-string/test.json index 5e7ddbda1..f4f5529b1 100644 --- a/test/integration/expression/tests/in/basic-string/test.json +++ b/test/integration/expression/tests/in/basic-string/test.json @@ -1,13 +1,82 @@ { - "expression": ["boolean", ["in", ["get", "substr"], ["get", "str"]]], + "expression": [ + "boolean", + [ + "in", + [ + "get", + "substr" + ], + [ + "get", + "str" + ] + ] + ], "inputs": [ - [{}, {"properties": {"substr": null, "str": "helloworld"}}], - [{}, {"properties": {"substr": "foo", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": "helloworld"}}], - [{}, {"properties": {"substr": true, "str": "falsetrue"}}], - [{}, {"properties": {"substr": false, "str": "falsetrue"}}], - [{}, {"properties": {"substr": 123, "str": "hello123world"}}], - [{}, {"properties": {"substr": "low", "str": null}}] + [ + {}, + { + "properties": { + "substr": null, + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "foo", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": true, + "str": "falsetrue" + } + } + ], + [ + {}, + { + "properties": { + "substr": false, + "str": "falsetrue" + } + } + ], + [ + {}, + { + "properties": { + "substr": 123, + "str": "hello123world" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": null + } + } + ] ], "expected": { "compiled": { @@ -16,6 +85,14 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true, true, true, true, false] + "outputs": [ + false, + false, + true, + true, + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/invalid-haystack/test.json b/test/integration/expression/tests/in/invalid-haystack/test.json index 77fc7a5d7..0b48889ef 100644 --- a/test/integration/expression/tests/in/invalid-haystack/test.json +++ b/test/integration/expression/tests/in/invalid-haystack/test.json @@ -1,9 +1,46 @@ { - "expression": ["boolean", ["in", ["get", "needle"], ["get", "haystack"]]], + "expression": [ + "boolean", + [ + "in", + [ + "get", + "needle" + ], + [ + "get", + "haystack" + ] + ] + ], "inputs": [ - [{}, {"properties": {"needle": 1, "haystack": 123}}], - [{}, {"properties": {"needle": "foo", "haystack": {}}}], - [{}, {"properties": {"needle": "foo", "haystack": null}}] + [ + {}, + { + "properties": { + "needle": 1, + "haystack": 123 + } + } + ], + [ + {}, + { + "properties": { + "needle": "foo", + "haystack": {} + } + } + ], + [ + {}, + { + "properties": { + "needle": "foo", + "haystack": null + } + } + ] ], "expected": { "compiled": { @@ -22,4 +59,4 @@ false ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/in/invalid-needle/test.json b/test/integration/expression/tests/in/invalid-needle/test.json index e7d4b4b1e..e9b1cfb6a 100644 --- a/test/integration/expression/tests/in/invalid-needle/test.json +++ b/test/integration/expression/tests/in/invalid-needle/test.json @@ -1,8 +1,41 @@ { - "expression": ["boolean", ["in", ["get", "needle"], ["get", "haystack"]]], + "expression": [ + "boolean", + [ + "in", + [ + "get", + "needle" + ], + [ + "get", + "haystack" + ] + ] + ], "inputs": [ - [{}, {"properties": {"needle": {}, "haystack": [9, 8, 7]}}], - [{}, {"properties": {"needle": {}, "haystack": "helloworld"}}] + [ + {}, + { + "properties": { + "needle": {}, + "haystack": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "needle": {}, + "haystack": "helloworld" + } + } + ] ], "expected": { "compiled": { @@ -20,4 +53,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/assert-array/test.json b/test/integration/expression/tests/index-of/assert-array/test.json index 71eba9f87..e7db5d5e1 100644 --- a/test/integration/expression/tests/index-of/assert-array/test.json +++ b/test/integration/expression/tests/index-of/assert-array/test.json @@ -1,11 +1,82 @@ { - "expression": ["index-of", ["get", "i"], ["array", ["get", "arr"]]], + "expression": [ + "index-of", + [ + "get", + "i" + ], + [ + "array", + [ + "get", + "arr" + ] + ] + ], "inputs": [ - [{}, {"properties": {"i": null, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": null, "arr": [9, 8, 7, null]}}], - [{}, {"properties": {"i": 1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 9, "arr": [9, 8, 7, 9]}}], - [{}, {"properties": {"i": 1, "arr": null}}] + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7, + null + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 9, + "arr": [ + 9, + 8, + 7, + 9 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": null + } + } + ] ], "expected": { "compiled": { @@ -19,7 +90,9 @@ 3, -1, 0, - {"error": "Expected value to be of type array, but found null instead."} + { + "error": "Expected value to be of type array, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/assert-string/test.json b/test/integration/expression/tests/index-of/assert-string/test.json index 19cf0b12c..a9f94bcea 100644 --- a/test/integration/expression/tests/index-of/assert-string/test.json +++ b/test/integration/expression/tests/index-of/assert-string/test.json @@ -1,10 +1,55 @@ { - "expression": ["index-of", ["get", "substr"], ["string", ["get", "str"]]], + "expression": [ + "index-of", + [ + "get", + "substr" + ], + [ + "string", + [ + "get", + "str" + ] + ] + ], "inputs": [ - [{}, {"properties": {"substr": null, "str": "helloworld"}}], - [{}, {"properties": {"substr": "foo", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": null}}] + [ + {}, + { + "properties": { + "substr": null, + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "foo", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": null + } + } + ] ], "expected": { "compiled": { @@ -17,7 +62,9 @@ -1, -1, 3, - {"error": "Expected value to be of type string, but found null instead."} + { + "error": "Expected value to be of type string, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/basic-array/test.json b/test/integration/expression/tests/index-of/basic-array/test.json index 952af61c6..31904d738 100644 --- a/test/integration/expression/tests/index-of/basic-array/test.json +++ b/test/integration/expression/tests/index-of/basic-array/test.json @@ -1,15 +1,67 @@ { - "expression": ["index-of", ["get", "i"], ["get", "arr"]], + "expression": [ + "index-of", + [ + "get", + "i" + ], + [ + "get", + "arr" + ] + ], "inputs": [ - [{}, {"properties": {"i": null, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 1, "arr": [9, 8, 7]}}], - [{}, {"properties": {"i": 9, "arr": [9, 8, 7]}}], + [ + {}, + { + "properties": { + "i": null, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 1, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "i": 9, + "arr": [ + 9, + 8, + 7 + ] + } + } + ], [ {}, { "properties": { "i": "foo", - "arr": ["baz", "bar", "hello", "foo", "world"] + "arr": [ + "baz", + "bar", + "hello", + "foo", + "world" + ] } } ], @@ -18,11 +70,27 @@ { "properties": { "i": true, - "arr": ["foo", 123, null, 456, false, {}, true] + "arr": [ + "foo", + 123, + null, + 456, + false, + {}, + true + ] } } ], - [{}, {"properties": {"i": 1, "arr": null}}] + [ + {}, + { + "properties": { + "i": 1, + "arr": null + } + } + ] ], "expected": { "compiled": { @@ -42,4 +110,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/basic-string/test.json b/test/integration/expression/tests/index-of/basic-string/test.json index 80852a523..0613630f8 100644 --- a/test/integration/expression/tests/index-of/basic-string/test.json +++ b/test/integration/expression/tests/index-of/basic-string/test.json @@ -1,13 +1,79 @@ { - "expression": ["index-of", ["get", "substr"], ["get", "str"]], + "expression": [ + "index-of", + [ + "get", + "substr" + ], + [ + "get", + "str" + ] + ], "inputs": [ - [{}, {"properties": {"substr": null, "str": "helloworld"}}], - [{}, {"properties": {"substr": "foo", "str": "helloworld"}}], - [{}, {"properties": {"substr": "low", "str": "helloworld"}}], - [{}, {"properties": {"substr": true, "str": "falsetrue"}}], - [{}, {"properties": {"substr": false, "str": "falsetrue"}}], - [{}, {"properties": {"substr": 123, "str": "hello123world"}}], - [{}, {"properties": {"substr": "low", "str": null}}] + [ + {}, + { + "properties": { + "substr": null, + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "foo", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": "helloworld" + } + } + ], + [ + {}, + { + "properties": { + "substr": true, + "str": "falsetrue" + } + } + ], + [ + {}, + { + "properties": { + "substr": false, + "str": "falsetrue" + } + } + ], + [ + {}, + { + "properties": { + "substr": 123, + "str": "hello123world" + } + } + ], + [ + {}, + { + "properties": { + "substr": "low", + "str": null + } + } + ] ], "expected": { "compiled": { @@ -28,4 +94,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/invalid-haystack/test.json b/test/integration/expression/tests/index-of/invalid-haystack/test.json index dbdc084c0..9a78d3fe0 100644 --- a/test/integration/expression/tests/index-of/invalid-haystack/test.json +++ b/test/integration/expression/tests/index-of/invalid-haystack/test.json @@ -1,9 +1,43 @@ { - "expression": ["index-of", ["get", "needle"], ["get", "haystack"]], + "expression": [ + "index-of", + [ + "get", + "needle" + ], + [ + "get", + "haystack" + ] + ], "inputs": [ - [{}, {"properties": {"needle": 1, "haystack": 123}}], - [{}, {"properties": {"needle": "foo", "haystack": {}}}], - [{}, {"properties": {"needle": "foo", "haystack": null}}] + [ + {}, + { + "properties": { + "needle": 1, + "haystack": 123 + } + } + ], + [ + {}, + { + "properties": { + "needle": "foo", + "haystack": {} + } + } + ], + [ + {}, + { + "properties": { + "needle": "foo", + "haystack": null + } + } + ] ], "expected": { "compiled": { @@ -24,4 +58,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/invalid-needle/test.json b/test/integration/expression/tests/index-of/invalid-needle/test.json index 6413ba4e8..2c09a171e 100644 --- a/test/integration/expression/tests/index-of/invalid-needle/test.json +++ b/test/integration/expression/tests/index-of/invalid-needle/test.json @@ -1,8 +1,38 @@ { - "expression": ["index-of", ["get", "needle"], ["get", "haystack"]], + "expression": [ + "index-of", + [ + "get", + "needle" + ], + [ + "get", + "haystack" + ] + ], "inputs": [ - [{}, {"properties": {"needle": {}, "haystack": [9, 8, 7]}}], - [{}, {"properties": {"needle": {}, "haystack": "helloworld"}}] + [ + {}, + { + "properties": { + "needle": {}, + "haystack": [ + 9, + 8, + 7 + ] + } + } + ], + [ + {}, + { + "properties": { + "needle": {}, + "haystack": "helloworld" + } + } + ] ], "expected": { "compiled": { @@ -20,4 +50,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/index-of/with-from-index/test.json b/test/integration/expression/tests/index-of/with-from-index/test.json index 7a668c0fe..bdf3a1b71 100644 --- a/test/integration/expression/tests/index-of/with-from-index/test.json +++ b/test/integration/expression/tests/index-of/with-from-index/test.json @@ -1,16 +1,141 @@ { - "expression": ["index-of", ["get", "needle"], ["get", "hay"], ["get", "i"]], + "expression": [ + "index-of", + [ + "get", + "needle" + ], + [ + "get", + "hay" + ], + [ + "get", + "i" + ] + ], "inputs": [ - [{}, {"properties": {"needle": null, "hay": "helloworld", "i": 0}}], - [{}, {"properties": {"needle": "foo", "hay": "helloworld", "i": 0}}], - [{}, {"properties": {"needle": "low", "hay": "helloworldlow", "i": 4}}], - [{}, {"properties": {"needle": true, "hay": "falsetruetrue", "i": 6}}], - [{}, {"properties": {"needle": false, "hay": "falsetrue", "i": 0}}], - [{}, {"properties": {"needle": 123, "hay": "hello123world", "i": 6}}], - [{}, {"properties": {"needle": "low", "hay": null, "i": 0}}], - [{}, {"properties": {"needle": 7, "hay": [9, 8, 7, 8, 7, 7], "i": 3}}], - [{}, {"properties": {"needle": 9, "hay": [9, 8, 7, 8, 7, 7], "i": 1}}], - [{}, {"properties": {"needle": 8, "hay": [9, 8, 7, 8, 7, 7], "i": 1}}] + [ + {}, + { + "properties": { + "needle": null, + "hay": "helloworld", + "i": 0 + } + } + ], + [ + {}, + { + "properties": { + "needle": "foo", + "hay": "helloworld", + "i": 0 + } + } + ], + [ + {}, + { + "properties": { + "needle": "low", + "hay": "helloworldlow", + "i": 4 + } + } + ], + [ + {}, + { + "properties": { + "needle": true, + "hay": "falsetruetrue", + "i": 6 + } + } + ], + [ + {}, + { + "properties": { + "needle": false, + "hay": "falsetrue", + "i": 0 + } + } + ], + [ + {}, + { + "properties": { + "needle": 123, + "hay": "hello123world", + "i": 6 + } + } + ], + [ + {}, + { + "properties": { + "needle": "low", + "hay": null, + "i": 0 + } + } + ], + [ + {}, + { + "properties": { + "needle": 7, + "hay": [ + 9, + 8, + 7, + 8, + 7, + 7 + ], + "i": 3 + } + } + ], + [ + {}, + { + "properties": { + "needle": 9, + "hay": [ + 9, + 8, + 7, + 8, + 7, + 7 + ], + "i": 1 + } + } + ], + [ + {}, + { + "properties": { + "needle": 8, + "hay": [ + 9, + 8, + 7, + 8, + 7, + 7 + ], + "i": 1 + } + } + ] ], "expected": { "compiled": { @@ -34,4 +159,4 @@ 1 ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate-hcl/linear/test.json b/test/integration/expression/tests/interpolate-hcl/linear/test.json index 228927136..6682af339 100644 --- a/test/integration/expression/tests/interpolate-hcl/linear/test.json +++ b/test/integration/expression/tests/interpolate-hcl/linear/test.json @@ -1,18 +1,58 @@ { "expression": [ "interpolate-hcl", - ["linear"], - ["get", "x"], + [ + "linear" + ], + [ + "get", + "x" + ], 1, "red", 11, - ["get", "color"] + [ + "get", + "color" + ] ], "inputs": [ - [{}, {"properties": {"x": 0, "color": "blue"}}], - [{}, {"properties": {"x": 5, "color": "blue"}}], - [{}, {"properties": {"x": 11, "color": "blue"}}], - [{}, {"properties": {"x": 11, "color": "oops blue"}}] + [ + {}, + { + "properties": { + "x": 0, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "oops blue" + } + } + ] ], "expected": { "compiled": { @@ -22,10 +62,27 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - [1, 0, 0.4251124784649884, 1], - [0, 0, 1, 1], - {"error": "Could not parse color from value 'oops blue'"} + [ + 1, + 0, + 0, + 1 + ], + [ + 1, + 0, + 0.425112, + 1 + ], + [ + 0, + 0, + 1, + 1 + ], + { + "error": "Could not parse color from value 'oops blue'" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate-lab/linear/test.json b/test/integration/expression/tests/interpolate-lab/linear/test.json index 58efec59d..8c99f0d93 100644 --- a/test/integration/expression/tests/interpolate-lab/linear/test.json +++ b/test/integration/expression/tests/interpolate-lab/linear/test.json @@ -1,18 +1,58 @@ { "expression": [ "interpolate-lab", - ["linear"], - ["get", "x"], + [ + "linear" + ], + [ + "get", + "x" + ], 1, "red", 11, - ["get", "color"] + [ + "get", + "color" + ] ], "inputs": [ - [{}, {"properties": {"x": 0, "color": "blue"}}], - [{}, {"properties": {"x": 5, "color": "blue"}}], - [{}, {"properties": {"x": 11, "color": "blue"}}], - [{}, {"properties": {"x": 11, "color": "oops blue"}}] + [ + {}, + { + "properties": { + "x": 0, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "oops blue" + } + } + ] ], "expected": { "compiled": { @@ -22,10 +62,27 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - [0.8140950912052022, 0, 0.4447724350959299, 1], - [0, 0, 1, 1], - {"error": "Could not parse color from value 'oops blue'"} + [ + 1, + 0, + 0, + 1 + ], + [ + 0.814095, + 0, + 0.444772, + 1 + ], + [ + 0, + 0, + 1, + 1 + ], + { + "error": "Could not parse color from value 'oops blue'" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/cubic-bezier-3-args/test.json b/test/integration/expression/tests/interpolate/cubic-bezier-3-args/test.json index b7155f43e..dce2690b4 100644 --- a/test/integration/expression/tests/interpolate/cubic-bezier-3-args/test.json +++ b/test/integration/expression/tests/interpolate/cubic-bezier-3-args/test.json @@ -3,8 +3,19 @@ "number", [ "interpolate", - ["cubic-bezier", 0, 0, 1], - ["number", ["get", "x"]], + [ + "cubic-bezier", + 0, + 0, + 1 + ], + [ + "number", + [ + "get", + "x" + ] + ], 0, 0, 100, @@ -23,4 +34,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/cubic-bezier-5-args/test.json b/test/integration/expression/tests/interpolate/cubic-bezier-5-args/test.json index fa6a1c2d5..e99ce9302 100644 --- a/test/integration/expression/tests/interpolate/cubic-bezier-5-args/test.json +++ b/test/integration/expression/tests/interpolate/cubic-bezier-5-args/test.json @@ -3,8 +3,21 @@ "number", [ "interpolate", - ["cubic-bezier", 0, 0, 1, 1, 1], - ["number", ["get", "x"]], + [ + "cubic-bezier", + 0, + 0, + 1, + 1, + 1 + ], + [ + "number", + [ + "get", + "x" + ] + ], 0, 0, 100, @@ -23,4 +36,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/cubic-bezier-invalid-control-point/test.json b/test/integration/expression/tests/interpolate/cubic-bezier-invalid-control-point/test.json index d61d2c096..c416d0ff9 100644 --- a/test/integration/expression/tests/interpolate/cubic-bezier-invalid-control-point/test.json +++ b/test/integration/expression/tests/interpolate/cubic-bezier-invalid-control-point/test.json @@ -3,8 +3,20 @@ "number", [ "interpolate", - ["cubic-bezier", 0, 1.75, 1, 1], - ["number", ["get", "x"]], + [ + "cubic-bezier", + 0, + 1.75, + 1, + 1 + ], + [ + "number", + [ + "get", + "x" + ] + ], 0, 0, 100, @@ -23,4 +35,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/cubic-bezier/test.json b/test/integration/expression/tests/interpolate/cubic-bezier/test.json index b988fc977..b575f1a5a 100644 --- a/test/integration/expression/tests/interpolate/cubic-bezier/test.json +++ b/test/integration/expression/tests/interpolate/cubic-bezier/test.json @@ -3,8 +3,20 @@ "number", [ "interpolate", - ["cubic-bezier", 0.42, 0, 0.58, 1], - ["number", ["get", "x"]], + [ + "cubic-bezier", + 0.42, + 0, + 0.58, + 1 + ], + [ + "number", + [ + "get", + "x" + ] + ], 0, 0, 100, @@ -12,17 +24,94 @@ ] ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 10}}], - [{}, {"properties": {"x": 20}}], - [{}, {"properties": {"x": 30}}], - [{}, {"properties": {"x": 40}}], - [{}, {"properties": {"x": 50}}], - [{}, {"properties": {"x": 60}}], - [{}, {"properties": {"x": 70}}], - [{}, {"properties": {"x": 80}}], - [{}, {"properties": {"x": 90}}], - [{}, {"properties": {"x": 100}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 10 + } + } + ], + [ + {}, + { + "properties": { + "x": 20 + } + } + ], + [ + {}, + { + "properties": { + "x": 30 + } + } + ], + [ + {}, + { + "properties": { + "x": 40 + } + } + ], + [ + {}, + { + "properties": { + "x": 50 + } + } + ], + [ + {}, + { + "properties": { + "x": 60 + } + } + ], + [ + {}, + { + "properties": { + "x": 70 + } + } + ], + [ + {}, + { + "properties": { + "x": 80 + } + } + ], + [ + {}, + { + "properties": { + "x": 90 + } + } + ], + [ + {}, + { + "properties": { + "x": 100 + } + } + ] ], "expected": { "compiled": { @@ -45,4 +134,4 @@ 100 ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/duplicate_stops/test.json b/test/integration/expression/tests/interpolate/duplicate_stops/test.json index 00888d775..ea8cf7fc0 100644 --- a/test/integration/expression/tests/interpolate/duplicate_stops/test.json +++ b/test/integration/expression/tests/interpolate/duplicate_stops/test.json @@ -1,6 +1,21 @@ { - "expression": ["interpolate", ["linear"], 0, 0, 1, 0, 2], - "inputs": [[{}, {}]], + "expression": [ + "interpolate", + [ + "linear" + ], + 0, + 0, + 1, + 0, + 2 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/exponential-number-array/test.json b/test/integration/expression/tests/interpolate/exponential-number-array/test.json index cc3b16ec4..f6dbd2e82 100644 --- a/test/integration/expression/tests/interpolate/exponential-number-array/test.json +++ b/test/integration/expression/tests/interpolate/exponential-number-array/test.json @@ -1,19 +1,75 @@ { "expression": [ "interpolate", - ["exponential", 2], - ["number", ["get", "x"]], + [ + "exponential", + 2 + ], + [ + "number", + [ + "get", + "x" + ] + ], 1, - ["literal", [2, 1]], + [ + "literal", + [ + 2, + 1 + ] + ], 3, - ["literal", [6, 1]] + [ + "literal", + [ + 6, + 1 + ] + ] ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 2}}], - [{}, {"properties": {"x": 3}}], - [{}, {"properties": {"x": 4}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 3 + } + } + ], + [ + {}, + { + "properties": { + "x": 4 + } + } + ] ], "expected": { "compiled": { @@ -22,6 +78,27 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[2, 1], [2, 1], [3.33333, 1], [6, 1], [6, 1]] + "outputs": [ + [ + 2, + 1 + ], + [ + 2, + 1 + ], + [ + 3.33333, + 1 + ], + [ + 6, + 1 + ], + [ + 6, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/exponential-single-stop/test.json b/test/integration/expression/tests/interpolate/exponential-single-stop/test.json index 355c1336c..4475f0225 100644 --- a/test/integration/expression/tests/interpolate/exponential-single-stop/test.json +++ b/test/integration/expression/tests/interpolate/exponential-single-stop/test.json @@ -1,12 +1,48 @@ { "expression": [ "number", - ["interpolate", ["exponential", 2], ["number", ["get", "x"]], 1, 2] + [ + "interpolate", + [ + "exponential", + 2 + ], + [ + "number", + [ + "get", + "x" + ] + ], + 1, + 2 + ] ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 2}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ] ], "expected": { "compiled": { @@ -15,6 +51,10 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2, 2, 2] + "outputs": [ + 2, + 2, + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/exponential-string-array/test.json b/test/integration/expression/tests/interpolate/exponential-string-array/test.json index 10fac5af7..662c4dfb1 100644 --- a/test/integration/expression/tests/interpolate/exponential-string-array/test.json +++ b/test/integration/expression/tests/interpolate/exponential-string-array/test.json @@ -1,20 +1,42 @@ { "expression": [ "interpolate", - ["exponential", 2], - ["number", ["get", "x"]], + [ + "exponential", + 2 + ], + [ + "number", + [ + "get", + "x" + ] + ], 1, - ["literal", ["a"]], + [ + "literal", + [ + "a" + ] + ], 3, - ["literal", ["b"]] + [ + "literal", + [ + "b" + ] + ] ], "inputs": [], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Type array is not interpolatable."} + { + "key": "", + "error": "Type array is not interpolatable." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/exponential-uninterpolatable-numeric-array/test.json b/test/integration/expression/tests/interpolate/exponential-uninterpolatable-numeric-array/test.json index 5e9ed776c..7f09db325 100644 --- a/test/integration/expression/tests/interpolate/exponential-uninterpolatable-numeric-array/test.json +++ b/test/integration/expression/tests/interpolate/exponential-uninterpolatable-numeric-array/test.json @@ -1,20 +1,46 @@ { "expression": [ "interpolate", - ["exponential", 2], - ["number", ["get", "x"]], + [ + "exponential", + 2 + ], + [ + "number", + [ + "get", + "x" + ] + ], 1, - ["array", "number", ["get", "array"]], + [ + "array", + "number", + [ + "get", + "array" + ] + ], 3, - ["array", "number", ["get", "array_two"]] + [ + "array", + "number", + [ + "get", + "array_two" + ] + ] ], "inputs": [], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Type array is not interpolatable."} + { + "key": "", + "error": "Type array is not interpolatable." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/exponential/test.json b/test/integration/expression/tests/interpolate/exponential/test.json index 7a529ef4b..ec9f0769a 100644 --- a/test/integration/expression/tests/interpolate/exponential/test.json +++ b/test/integration/expression/tests/interpolate/exponential/test.json @@ -1,14 +1,66 @@ { "expression": [ "number", - ["interpolate", ["exponential", 2], ["number", ["get", "x"]], 1, 2, 3, 6] + [ + "interpolate", + [ + "exponential", + 2 + ], + [ + "number", + [ + "get", + "x" + ] + ], + 1, + 2, + 3, + 6 + ] ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 2}}], - [{}, {"properties": {"x": 3}}], - [{}, {"properties": {"x": 4}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 3 + } + } + ], + [ + {}, + { + "properties": { + "x": 4 + } + } + ] ], "expected": { "compiled": { @@ -17,6 +69,12 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2, 2, 3.33333, 6, 6] + "outputs": [ + 2, + 2, + 3.33333, + 6, + 6 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/infer-array-type/test.json b/test/integration/expression/tests/interpolate/infer-array-type/test.json index 248843f15..c46e0c7b3 100644 --- a/test/integration/expression/tests/interpolate/infer-array-type/test.json +++ b/test/integration/expression/tests/interpolate/infer-array-type/test.json @@ -3,14 +3,36 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, "expression": [ "step", - ["number", ["get", "x"]], - ["literal", ["one"]], + [ + "number", + [ + "get", + "x" + ] + ], + [ + "literal", + [ + "one" + ] + ], 10, - ["literal", ["one", "two"]] + [ + "literal", + [ + "one", + "two" + ] + ] ], "inputs": [], "expected": { @@ -22,4 +44,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/linear-color/test.json b/test/integration/expression/tests/interpolate/linear-color/test.json index 9c99f62ce..497e45e25 100644 --- a/test/integration/expression/tests/interpolate/linear-color/test.json +++ b/test/integration/expression/tests/interpolate/linear-color/test.json @@ -3,22 +3,87 @@ "to-rgba", [ "interpolate", - ["exponential", 1], - ["get", "x"], + [ + "exponential", + 1 + ], + [ + "get", + "x" + ], 1, "red", 11, - ["get", "color"] + [ + "get", + "color" + ] ] ], "inputs": [ - [{}, {"properties": {"x": 0, "color": "blue"}}], - [{}, {"properties": {"x": 5, "color": "blue"}}], - [{}, {"properties": {"x": 5, "color": "#0000ff00"}}], - [{}, {"properties": {"x": 5, "color": "rgb(0% 0% 100% / 0)"}}], - [{}, {"properties": {"x": 5, "color": "hsl(240 100% 50% / 0)"}}], - [{}, {"properties": {"x": 11, "color": "blue"}}], - [{}, {"properties": {"x": 11, "color": "oops blue"}}] + [ + {}, + { + "properties": { + "x": 0, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "#0000ff00" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "rgb(0% 0% 100% / 0)" + } + } + ], + [ + {}, + { + "properties": { + "x": 5, + "color": "hsl(240 100% 50% / 0)" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "blue" + } + } + ], + [ + {}, + { + "properties": { + "x": 11, + "color": "oops blue" + } + } + ] ], "expected": { "compiled": { @@ -28,13 +93,45 @@ "type": "array" }, "outputs": [ - [255, 0, 0, 1], - [153, 0, 102, 1], - [153, 0, 102, 0.6], - [153, 0, 102, 0.6], - [153, 0, 102, 0.6], - [0, 0, 255, 1], - {"error": "Could not parse color from value 'oops blue'"} + [ + 255, + 0, + 0, + 1 + ], + [ + 153, + 0, + 102, + 1 + ], + [ + 153, + 0, + 102, + 0.6 + ], + [ + 153, + 0, + 102, + 0.6 + ], + [ + 153, + 0, + 102, + 0.6 + ], + [ + 0, + 0, + 255, + 1 + ], + { + "error": "Could not parse color from value 'oops blue'" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/linear-many-stops/test.json b/test/integration/expression/tests/interpolate/linear-many-stops/test.json index 22a389fc3..b0e8b7c20 100644 --- a/test/integration/expression/tests/interpolate/linear-many-stops/test.json +++ b/test/integration/expression/tests/interpolate/linear-many-stops/test.json @@ -3,8 +3,17 @@ "number", [ "interpolate", - ["exponential", 1], - ["number", ["get", "x"]], + [ + "exponential", + 1 + ], + [ + "number", + [ + "get", + "x" + ] + ], 2, 100, 55, @@ -36,15 +45,78 @@ ] ], "inputs": [ - [{}, {"properties": {"x": 2}}], - [{}, {"properties": {"x": 20}}], - [{}, {"properties": {"x": 607}}], - [{}, {"properties": {"x": 680}}], - [{}, {"properties": {"x": 4927}}], - [{}, {"properties": {"x": 7300}}], - [{}, {"properties": {"x": 10000}}], - [{}, {"properties": {"x": 20000}}], - [{}, {"properties": {"x": 40000}}] + [ + {}, + { + "properties": { + "x": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 20 + } + } + ], + [ + {}, + { + "properties": { + "x": 607 + } + } + ], + [ + {}, + { + "properties": { + "x": 680 + } + } + ], + [ + {}, + { + "properties": { + "x": 4927 + } + } + ], + [ + {}, + { + "properties": { + "x": 7300 + } + } + ], + [ + {}, + { + "properties": { + "x": 10000 + } + } + ], + [ + {}, + { + "properties": { + "x": 20000 + } + } + ], + [ + {}, + { + "properties": { + "x": 40000 + } + } + ] ], "expected": { "compiled": { @@ -65,4 +137,4 @@ 10000000 ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/interpolate/linear/test.json b/test/integration/expression/tests/interpolate/linear/test.json index 449b56e57..694e51955 100644 --- a/test/integration/expression/tests/interpolate/linear/test.json +++ b/test/integration/expression/tests/interpolate/linear/test.json @@ -2,16 +2,76 @@ "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["interpolate", ["linear"], ["get", "x"], 0, 100, 10, 200], + "expression": [ + "interpolate", + [ + "linear" + ], + [ + "get", + "x" + ], + 0, + 100, + 10, + 200 + ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 5}}], - [{}, {"properties": {"x": 10}}], - [{}, {"properties": {"x": -1234}}], - [{}, {"properties": {"x": 1234}}], - [{}, {"properties": {"x": "abcd"}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 5 + } + } + ], + [ + {}, + { + "properties": { + "x": 10 + } + } + ], + [ + {}, + { + "properties": { + "x": -1234 + } + } + ], + [ + {}, + { + "properties": { + "x": 1234 + } + } + ], + [ + {}, + { + "properties": { + "x": "abcd" + } + } + ] ], "expected": { "compiled": { @@ -31,4 +91,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/is-supported-script/default/test.json b/test/integration/expression/tests/is-supported-script/default/test.json index f9c764221..31b44785b 100644 --- a/test/integration/expression/tests/is-supported-script/default/test.json +++ b/test/integration/expression/tests/is-supported-script/default/test.json @@ -1,9 +1,29 @@ { - "expression": ["is-supported-script", ["get", "x"]], + "expression": [ + "is-supported-script", + [ + "get", + "x" + ] + ], "description": "'is-supported-script' always returns true when run without global context providing an 'isSupportedScript' function (as in the expression tests). The 'is-supported-script' render tests provide the necessary global context and exercise the functionality.", "inputs": [ - [{}, {"properties": {"x": "שָׁלוֹם"}}], - [{}, {"properties": {"x": "देवनागरी"}}] + [ + {}, + { + "properties": { + "x": "שָׁלוֹם" + } + } + ], + [ + {}, + { + "properties": { + "x": "देवनागरी" + } + } + ] ], "expected": { "compiled": { @@ -12,6 +32,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true] + "outputs": [ + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/array-default/test.json b/test/integration/expression/tests/legacy/categorical/array-default/test.json index 8ff8126f0..798029a17 100644 --- a/test/integration/expression/tests/legacy/categorical/array-default/test.json +++ b/test/integration/expression/tests/legacy/categorical/array-default/test.json @@ -2,21 +2,75 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[0, [0]], [1, [1]]], - "default": [-1] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "default": [ + -1 + ] }, "propertySpec": { "type": "array", "value": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -25,6 +79,22 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[-1], [0], [1], [-1], [-1]] + "outputs": [ + [ + -1 + ], + [ + 0 + ], + [ + 1 + ], + [ + -1 + ], + [ + -1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/array/test.json b/test/integration/expression/tests/legacy/categorical/array/test.json index af48b3412..0c119a478 100644 --- a/test/integration/expression/tests/legacy/categorical/array/test.json +++ b/test/integration/expression/tests/legacy/categorical/array/test.json @@ -2,21 +2,75 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[0, [0]], [1, [1]]] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] }, "propertySpec": { "type": "array", "value": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]}, - "default": [-1] + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + }, + "default": [ + -1 + ] }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -25,6 +79,22 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[-1], [0], [1], [-1], [-1]] + "outputs": [ + [ + -1 + ], + [ + 0 + ], + [ + 1 + ], + [ + -1 + ], + [ + -1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/boolean-default/test.json b/test/integration/expression/tests/legacy/categorical/boolean-default/test.json index 6074a671b..6bbde8142 100644 --- a/test/integration/expression/tests/legacy/categorical/boolean-default/test.json +++ b/test/integration/expression/tests/legacy/categorical/boolean-default/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[true, true], [false, false]], + "stops": [ + [ + true, + true + ], + [ + false, + false + ] + ], "default": true }, "propertySpec": { "type": "boolean", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": true}}], - [{}, {"properties": {"p": false}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": true + } + } + ], + [ + {}, + { + "properties": { + "p": false + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false, true] + "outputs": [ + true, + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/boolean/test.json b/test/integration/expression/tests/legacy/categorical/boolean/test.json index 49f44501a..0f4ba8dee 100644 --- a/test/integration/expression/tests/legacy/categorical/boolean/test.json +++ b/test/integration/expression/tests/legacy/categorical/boolean/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[true, true], [false, false]] + "stops": [ + [ + true, + true + ], + [ + false, + false + ] + ] }, "propertySpec": { "type": "boolean", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + }, "default": true }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": true}}], - [{}, {"properties": {"p": false}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": true + } + } + ], + [ + {}, + { + "properties": { + "p": false + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false, true] + "outputs": [ + true, + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/color-default/test.json b/test/integration/expression/tests/legacy/categorical/color-default/test.json index cfad1f1d8..1aa0b90e9 100644 --- a/test/integration/expression/tests/legacy/categorical/color-default/test.json +++ b/test/integration/expression/tests/legacy/categorical/color-default/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [["0", "red"], ["1", "lime"]], + "stops": [ + [ + "0", + "red" + ], + [ + "1", + "lime" + ] + ], "default": "blue" }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,31 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]] + "outputs": [ + [ + 0, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 0, + 1, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/color/test.json b/test/integration/expression/tests/legacy/categorical/color/test.json index c4467dc81..3e67fdbb0 100644 --- a/test/integration/expression/tests/legacy/categorical/color/test.json +++ b/test/integration/expression/tests/legacy/categorical/color/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [["0", "red"], ["1", "lime"]] + "stops": [ + [ + "0", + "red" + ], + [ + "1", + "lime" + ] + ] }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + }, "default": "blue" }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,31 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]] + "outputs": [ + [ + 0, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 0, + 1, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/number-default/test.json b/test/integration/expression/tests/legacy/categorical/number-default/test.json index 5582567d9..32a75848a 100644 --- a/test/integration/expression/tests/legacy/categorical/number-default/test.json +++ b/test/integration/expression/tests/legacy/categorical/number-default/test.json @@ -2,21 +2,76 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[0, 0], [1, 1]], + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ], "default": -1 }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -25,6 +80,13 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1, -1, 0, 1, -1, -1] + "outputs": [ + -1, + -1, + 0, + 1, + -1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/number/test.json b/test/integration/expression/tests/legacy/categorical/number/test.json index f2d4779c6..07a6f03a1 100644 --- a/test/integration/expression/tests/legacy/categorical/number/test.json +++ b/test/integration/expression/tests/legacy/categorical/number/test.json @@ -2,21 +2,76 @@ "expression": { "type": "categorical", "property": "p", - "stops": [[0, 0], [1, 1]] + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + }, "default": -1 }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -25,6 +80,13 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1, -1, 0, 1, -1, -1] + "outputs": [ + -1, + -1, + 0, + 1, + -1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/string-default/test.json b/test/integration/expression/tests/legacy/categorical/string-default/test.json index 93679e17b..2eb5983e2 100644 --- a/test/integration/expression/tests/legacy/categorical/string-default/test.json +++ b/test/integration/expression/tests/legacy/categorical/string-default/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [["0", "0"], ["1", "1"]], + "stops": [ + [ + "0", + "0" + ], + [ + "1", + "1" + ] + ], "default": "-1" }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["-1", "0", "1", "-1"] + "outputs": [ + "-1", + "0", + "1", + "-1" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/string/test.json b/test/integration/expression/tests/legacy/categorical/string/test.json index 53b1b3c56..0a40cc943 100644 --- a/test/integration/expression/tests/legacy/categorical/string/test.json +++ b/test/integration/expression/tests/legacy/categorical/string/test.json @@ -2,19 +2,60 @@ "expression": { "type": "categorical", "property": "p", - "stops": [["0", "0"], ["1", "1"]] + "stops": [ + [ + "0", + "0" + ], + [ + "1", + "1" + ] + ] }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + }, "default": "-1" }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -23,6 +64,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["-1", "0", "1", "-1"] + "outputs": [ + "-1", + "0", + "1", + "-1" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/categorical/tokens/test.json b/test/integration/expression/tests/legacy/categorical/tokens/test.json index ec0200501..bf9a38364 100644 --- a/test/integration/expression/tests/legacy/categorical/tokens/test.json +++ b/test/integration/expression/tests/legacy/categorical/tokens/test.json @@ -2,20 +2,63 @@ "expression": { "type": "categorical", "property": "p", - "stops": [["0", "0 {a}"], ["1", "1 {b}"]], + "stops": [ + [ + "0", + "0 {a}" + ], + [ + "1", + "1 {b}" + ] + ], "default": "default" }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + }, "tokens": true }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0", "a": "a"}}], - [{}, {"properties": {"p": "1", "b": "b"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0", + "a": "a" + } + } + ], + [ + {}, + { + "properties": { + "p": "1", + "b": "b" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -24,6 +67,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["default", "0 {a}", "1 {b}", "default"] + "outputs": [ + "default", + "0 {a}", + "1 {b}", + "default" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/array-default/test.json b/test/integration/expression/tests/legacy/exponential/array-default/test.json index 6e27cb0de..37aaea586 100644 --- a/test/integration/expression/tests/legacy/exponential/array-default/test.json +++ b/test/integration/expression/tests/legacy/exponential/array-default/test.json @@ -2,24 +2,92 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, [0]], [1, [1]]], - "default": [-1] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "default": [ + -1 + ] }, "propertySpec": { "type": "array", "value": "number", "length": 1, "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -28,6 +96,28 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[-1], [0], [0], [0.5], [1], [1], [-1]] + "outputs": [ + [ + -1 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0.5 + ], + [ + 1 + ], + [ + 1 + ], + [ + -1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/array/test.json b/test/integration/expression/tests/legacy/exponential/array/test.json index 0af0c40a6..e8ab93a7b 100644 --- a/test/integration/expression/tests/legacy/exponential/array/test.json +++ b/test/integration/expression/tests/legacy/exponential/array/test.json @@ -2,23 +2,89 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, [0]], [1, [1]]] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] }, "propertySpec": { "type": "array", "value": "number", "length": 1, "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -28,15 +94,27 @@ "type": "array" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0], - [0], - [0.5], - [1], - [1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0 + ], + [ + 0 + ], + [ + 0.5 + ], + [ + 1 + ], + [ + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/base/test.json b/test/integration/expression/tests/legacy/exponential/base/test.json index 69ff8d0d1..2e123af77 100644 --- a/test/integration/expression/tests/legacy/exponential/base/test.json +++ b/test/integration/expression/tests/legacy/exponential/base/test.json @@ -1,11 +1,37 @@ { - "expression": {"type": "exponential", "base": 0.5, "stops": [[0, 0], [1, 1]]}, + "expression": { + "type": "exponential", + "base": 0.5, + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ] + }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, - "inputs": [[{"zoom": 0.5}, {}]], + "inputs": [ + [ + { + "zoom": 0.5 + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -13,6 +39,8 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [0.585786] + "outputs": [ + 0.585786 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/color-default/test.json b/test/integration/expression/tests/legacy/exponential/color-default/test.json index 65a7f1f47..70fa2e6b5 100644 --- a/test/integration/expression/tests/legacy/exponential/color-default/test.json +++ b/test/integration/expression/tests/legacy/exponential/color-default/test.json @@ -2,22 +2,84 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, "black"], [1, "white"]], + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ], "default": "red" }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -27,13 +89,48 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0.5, 0.5, 0.5, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 0, 0, 1] + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 0, + 0, + 1 + ] ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/color-hcl/test.json b/test/integration/expression/tests/legacy/exponential/color-hcl/test.json index adb3b4a8f..053e49b69 100644 --- a/test/integration/expression/tests/legacy/exponential/color-hcl/test.json +++ b/test/integration/expression/tests/legacy/exponential/color-hcl/test.json @@ -2,22 +2,84 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, "black"], [1, "white"]], + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ], "colorSpace": "hcl" }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -27,15 +89,42 @@ "type": "color" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0, 0, 0, 1], - [0, 0, 0, 1], - [0.466326, 0.466326, 0.466326, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0.466326, + 0.466326, + 0.466326, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/color-lab/test.json b/test/integration/expression/tests/legacy/exponential/color-lab/test.json index 82878ce48..daf5e6fc9 100644 --- a/test/integration/expression/tests/legacy/exponential/color-lab/test.json +++ b/test/integration/expression/tests/legacy/exponential/color-lab/test.json @@ -2,22 +2,84 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, "black"], [1, "white"]], + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ], "colorSpace": "lab" }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -27,15 +89,42 @@ "type": "color" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0, 0, 0, 1], - [0, 0, 0, 1], - [0.466326, 0.466326, 0.466326, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0.466326, + 0.466326, + 0.466326, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/color/test.json b/test/integration/expression/tests/legacy/exponential/color/test.json index ee44e9d2a..60628cf66 100644 --- a/test/integration/expression/tests/legacy/exponential/color/test.json +++ b/test/integration/expression/tests/legacy/exponential/color/test.json @@ -2,21 +2,83 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, "black"], [1, "white"]] + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ] }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,15 +88,42 @@ "type": "color" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0, 0, 0, 1], - [0, 0, 0, 1], - [0.5, 0.5, 0.5, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0.5, + 0.5, + 0.5, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/composite-default/test.json b/test/integration/expression/tests/legacy/exponential/composite-default/test.json index 3e1d8804f..70fcdc2ab 100644 --- a/test/integration/expression/tests/legacy/exponential/composite-default/test.json +++ b/test/integration/expression/tests/legacy/exponential/composite-default/test.json @@ -3,26 +3,117 @@ "type": "exponential", "property": "p", "stops": [ - [{"zoom": 0, "value": 0}, 0], - [{"zoom": 0, "value": 1}, 1], - [{"zoom": 1, "value": 0}, 2], - [{"zoom": 1, "value": 1}, 3] + [ + { + "zoom": 0, + "value": 0 + }, + 0 + ], + [ + { + "zoom": 0, + "value": 1 + }, + 1 + ], + [ + { + "zoom": 1, + "value": 0 + }, + 2 + ], + [ + { + "zoom": 1, + "value": 1 + }, + 3 + ] ], "default": -1 }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{"zoom": 0.5}, {"properties": {}}], - [{"zoom": 0.5}, {"properties": {"p": -1}}], - [{"zoom": 0.5}, {"properties": {"p": 0}}], - [{"zoom": 0.5}, {"properties": {"p": 0.5}}], - [{"zoom": 0.5}, {"properties": {"p": 1}}], - [{"zoom": 0.5}, {"properties": {"p": 2}}], - [{"zoom": 0.5}, {"properties": {"p": "0"}}] + [ + { + "zoom": 0.5 + }, + { + "properties": {} + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": -1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0.5 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 2 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -31,6 +122,14 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [-1, 1, 1, 1.5, 2, 2, -1] + "outputs": [ + -1, + 1, + 1, + 1.5, + 2, + 2, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/composite/test.json b/test/integration/expression/tests/legacy/exponential/composite/test.json index fb30eeeee..30de43d21 100644 --- a/test/integration/expression/tests/legacy/exponential/composite/test.json +++ b/test/integration/expression/tests/legacy/exponential/composite/test.json @@ -3,25 +3,116 @@ "type": "exponential", "property": "p", "stops": [ - [{"zoom": 0, "value": 0}, 0], - [{"zoom": 0, "value": 1}, 1], - [{"zoom": 1, "value": 0}, 2], - [{"zoom": 1, "value": 1}, 3] + [ + { + "zoom": 0, + "value": 0 + }, + 0 + ], + [ + { + "zoom": 0, + "value": 1 + }, + 1 + ], + [ + { + "zoom": 1, + "value": 0 + }, + 2 + ], + [ + { + "zoom": 1, + "value": 1 + }, + 3 + ] ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{"zoom": 0.5}, {"properties": {}}], - [{"zoom": 0.5}, {"properties": {"p": -1}}], - [{"zoom": 0.5}, {"properties": {"p": 0}}], - [{"zoom": 0.5}, {"properties": {"p": 0.5}}], - [{"zoom": 0.5}, {"properties": {"p": 1}}], - [{"zoom": 0.5}, {"properties": {"p": 2}}], - [{"zoom": 0.5}, {"properties": {"p": "0"}}] + [ + { + "zoom": 0.5 + }, + { + "properties": {} + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": -1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0.5 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 2 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -31,7 +122,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 1, 1, 1.5, @@ -42,4 +135,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/duplicate-stops/test.json b/test/integration/expression/tests/legacy/exponential/duplicate-stops/test.json index 30d3afdb5..9495f1144 100644 --- a/test/integration/expression/tests/legacy/exponential/duplicate-stops/test.json +++ b/test/integration/expression/tests/legacy/exponential/duplicate-stops/test.json @@ -1,14 +1,44 @@ { "expression": { "type": "exponential", - "stops": [[0, 10], [1, 20], [1, 25], [2, 30]] + "stops": [ + [ + 0, + 10 + ], + [ + 1, + 20 + ], + [ + 1, + 25 + ], + [ + 2, + 30 + ] + ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, - "inputs": [[{"zoom": 1}, {}]], + "inputs": [ + [ + { + "zoom": 1 + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -16,6 +46,8 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [20] + "outputs": [ + 20 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/implicit/test.json b/test/integration/expression/tests/legacy/exponential/implicit/test.json index 3df9ce976..7a4237653 100644 --- a/test/integration/expression/tests/legacy/exponential/implicit/test.json +++ b/test/integration/expression/tests/legacy/exponential/implicit/test.json @@ -1,18 +1,83 @@ { - "expression": {"property": "p", "stops": [[0, 0], [1, 1]]}, + "expression": { + "property": "p", + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ] + }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -22,7 +87,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 0, 0, 0.5, @@ -33,4 +100,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/number-default/test.json b/test/integration/expression/tests/legacy/exponential/number-default/test.json index 34e6f98e3..204d9158f 100644 --- a/test/integration/expression/tests/legacy/exponential/number-default/test.json +++ b/test/integration/expression/tests/legacy/exponential/number-default/test.json @@ -2,22 +2,84 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, 0], [1, 1]], + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ], "default": -1 }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,6 +88,14 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1, 0, 0, 0.5, 1, 1, -1] + "outputs": [ + -1, + 0, + 0, + 0.5, + 1, + 1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/exponential/number/test.json b/test/integration/expression/tests/legacy/exponential/number/test.json index 231d05150..3a98d7e37 100644 --- a/test/integration/expression/tests/legacy/exponential/number/test.json +++ b/test/integration/expression/tests/legacy/exponential/number/test.json @@ -2,21 +2,83 @@ "expression": { "type": "exponential", "property": "p", - "stops": [[0, 0], [1, 1]] + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,7 +88,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 0, 0, 0.5, @@ -37,4 +101,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/array-default/test.json b/test/integration/expression/tests/legacy/identity/array-default/test.json index f881954c7..55a65e1d5 100644 --- a/test/integration/expression/tests/legacy/identity/array-default/test.json +++ b/test/integration/expression/tests/legacy/identity/array-default/test.json @@ -1,16 +1,58 @@ { - "expression": {"type": "identity", "property": "p", "default": [-1]}, + "expression": { + "type": "identity", + "property": "p", + "default": [ + -1 + ] + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": [0]}}], - [{}, {"properties": {"p": [1]}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": [ + 0 + ] + } + } + ], + [ + {}, + { + "properties": { + "p": [ + 1 + ] + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "array", "value": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -19,6 +61,19 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[-1], [0], [1], [-1]] + "outputs": [ + [ + -1 + ], + [ + 0 + ], + [ + 1 + ], + [ + -1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/array/test.json b/test/integration/expression/tests/legacy/identity/array/test.json index 2461a67db..dbf9a5b71 100644 --- a/test/integration/expression/tests/legacy/identity/array/test.json +++ b/test/integration/expression/tests/legacy/identity/array/test.json @@ -1,16 +1,55 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": [0]}}], - [{}, {"properties": {"p": [1]}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": [ + 0 + ] + } + } + ], + [ + {}, + { + "properties": { + "p": [ + 1 + ] + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "array", "value": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -23,11 +62,15 @@ { "error": "Expected value to be of type array, but found null instead." }, - [0], - [1], + [ + 0 + ], + [ + 1 + ], { "error": "Expected value to be of type array, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/boolean-default/test.json b/test/integration/expression/tests/legacy/identity/boolean-default/test.json index 79c69c7a7..49e149519 100644 --- a/test/integration/expression/tests/legacy/identity/boolean-default/test.json +++ b/test/integration/expression/tests/legacy/identity/boolean-default/test.json @@ -1,15 +1,51 @@ { - "expression": {"type": "identity", "property": "p", "default": true}, + "expression": { + "type": "identity", + "property": "p", + "default": true + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": true}}], - [{}, {"properties": {"p": false}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": true + } + } + ], + [ + {}, + { + "properties": { + "p": false + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "boolean", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -18,6 +54,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false, true] + "outputs": [ + true, + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/boolean/test.json b/test/integration/expression/tests/legacy/identity/boolean/test.json index 01a77a051..3619e5d58 100644 --- a/test/integration/expression/tests/legacy/identity/boolean/test.json +++ b/test/integration/expression/tests/legacy/identity/boolean/test.json @@ -1,15 +1,50 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": true}}], - [{}, {"properties": {"p": false}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": true + } + } + ], + [ + {}, + { + "properties": { + "p": false + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "boolean", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -29,4 +64,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/color-default/test.json b/test/integration/expression/tests/legacy/identity/color-default/test.json index 28103d716..0ab324e4a 100644 --- a/test/integration/expression/tests/legacy/identity/color-default/test.json +++ b/test/integration/expression/tests/legacy/identity/color-default/test.json @@ -1,14 +1,43 @@ { - "expression": {"type": "identity", "property": "p", "default": "red"}, + "expression": { + "type": "identity", + "property": "p", + "default": "red" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "blue"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "blue" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -17,6 +46,25 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[1, 0, 0, 1], [0, 0, 1, 1], [1, 0, 0, 1]] + "outputs": [ + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/color/test.json b/test/integration/expression/tests/legacy/identity/color/test.json index 35d487aca..8a73755b0 100644 --- a/test/integration/expression/tests/legacy/identity/color/test.json +++ b/test/integration/expression/tests/legacy/identity/color/test.json @@ -1,14 +1,42 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "blue"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "blue" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -18,9 +46,18 @@ "type": "color" }, "outputs": [ - {"error": "Could not parse color from value 'null'"}, - [0, 0, 1, 1], - {"error": "Could not parse color from value '0'"} + { + "error": "Could not parse color from value 'null'" + }, + [ + 0, + 0, + 1, + 1 + ], + { + "error": "Could not parse color from value '0'" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/enum-default/test.json b/test/integration/expression/tests/legacy/identity/enum-default/test.json index 5ca11075b..168d6a8d1 100644 --- a/test/integration/expression/tests/legacy/identity/enum-default/test.json +++ b/test/integration/expression/tests/legacy/identity/enum-default/test.json @@ -1,16 +1,55 @@ { - "expression": {"type": "identity", "property": "p", "default": "a"}, + "expression": { + "type": "identity", + "property": "p", + "default": "a" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "a"}}], - [{}, {"properties": {"p": "b"}}], - [{}, {"properties": {"p": "c"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ], + [ + {}, + { + "properties": { + "p": "b" + } + } + ], + [ + {}, + { + "properties": { + "p": "c" + } + } + ] ], "propertySpec": { "type": "enum", - "values": {"a": {}, "b": {}}, + "values": { + "a": {}, + "b": {} + }, "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -19,6 +58,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["a", "a", "b", "a"] + "outputs": [ + "a", + "a", + "b", + "a" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/enum/test.json b/test/integration/expression/tests/legacy/identity/enum/test.json index aa74c081b..a3a8219eb 100644 --- a/test/integration/expression/tests/legacy/identity/enum/test.json +++ b/test/integration/expression/tests/legacy/identity/enum/test.json @@ -1,16 +1,54 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "a"}}], - [{}, {"properties": {"p": "b"}}], - [{}, {"properties": {"p": "c"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ], + [ + {}, + { + "properties": { + "p": "b" + } + } + ], + [ + {}, + { + "properties": { + "p": "c" + } + } + ] ], "propertySpec": { "type": "enum", - "values": {"a": {}, "b": {}}, + "values": { + "a": {}, + "b": {} + }, "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -20,10 +58,12 @@ "type": "string" }, "outputs": [ - {"error": "Expected value to be of type string, but found null instead."}, + { + "error": "Expected value to be of type string, but found null instead." + }, "a", "b", "c" ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/number-default/test.json b/test/integration/expression/tests/legacy/identity/number-default/test.json index 221b6ff2d..dc707369e 100644 --- a/test/integration/expression/tests/legacy/identity/number-default/test.json +++ b/test/integration/expression/tests/legacy/identity/number-default/test.json @@ -1,15 +1,51 @@ { - "expression": {"type": "identity", "property": "p", "default": -1}, + "expression": { + "type": "identity", + "property": "p", + "default": -1 + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -18,6 +54,11 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1, 0, 1, -1] + "outputs": [ + -1, + 0, + 1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/number/test.json b/test/integration/expression/tests/legacy/identity/number/test.json index f92bf20d4..0056ff04e 100644 --- a/test/integration/expression/tests/legacy/identity/number/test.json +++ b/test/integration/expression/tests/legacy/identity/number/test.json @@ -1,15 +1,50 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": "wrong type"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": "wrong type" + } + } + ] ], "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -19,7 +54,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 0, 1, { @@ -27,4 +64,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/string-default/test.json b/test/integration/expression/tests/legacy/identity/string-default/test.json index 9ee388bba..ce5bfd472 100644 --- a/test/integration/expression/tests/legacy/identity/string-default/test.json +++ b/test/integration/expression/tests/legacy/identity/string-default/test.json @@ -1,15 +1,51 @@ { - "expression": {"type": "identity", "property": "p", "default": "default"}, + "expression": { + "type": "identity", + "property": "p", + "default": "default" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -18,6 +54,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["default", "0", "1", "default"] + "outputs": [ + "default", + "0", + "1", + "default" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/identity/string/test.json b/test/integration/expression/tests/legacy/identity/string/test.json index 3614fb0cb..01db711d0 100644 --- a/test/integration/expression/tests/legacy/identity/string/test.json +++ b/test/integration/expression/tests/legacy/identity/string/test.json @@ -1,15 +1,50 @@ { - "expression": {"type": "identity", "property": "p"}, + "expression": { + "type": "identity", + "property": "p" + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": "0"}}], - [{}, {"properties": {"p": "1"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ], + [ + {}, + { + "properties": { + "p": "1" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "expected": { "compiled": { @@ -19,7 +54,9 @@ "type": "string" }, "outputs": [ - {"error": "Expected value to be of type string, but found null instead."}, + { + "error": "Expected value to be of type string, but found null instead." + }, "0", "1", { @@ -27,4 +64,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/array-default/test.json b/test/integration/expression/tests/legacy/interval/array-default/test.json index b1f891154..8a72c5113 100644 --- a/test/integration/expression/tests/legacy/interval/array-default/test.json +++ b/test/integration/expression/tests/legacy/interval/array-default/test.json @@ -2,24 +2,92 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, [0]], [1, [1]]], - "default": [-1] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "default": [ + -1 + ] }, "propertySpec": { "type": "array", "value": "number", "length": 1, "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -28,6 +96,28 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[-1], [0], [0], [0], [1], [1], [-1]] + "outputs": [ + [ + -1 + ], + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 1 + ], + [ + -1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/array/test.json b/test/integration/expression/tests/legacy/interval/array/test.json index 06b65fe18..a54e3154a 100644 --- a/test/integration/expression/tests/legacy/interval/array/test.json +++ b/test/integration/expression/tests/legacy/interval/array/test.json @@ -2,23 +2,89 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, [0]], [1, [1]]] + "stops": [ + [ + 0, + [ + 0 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] }, "propertySpec": { "type": "array", "value": "number", "length": 1, "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -28,15 +94,27 @@ "type": "array" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0], - [0], - [0], - [1], - [1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0 + ], + [ + 0 + ], + [ + 0 + ], + [ + 1 + ], + [ + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/color-default/test.json b/test/integration/expression/tests/legacy/interval/color-default/test.json index 8e31fa563..aeb48e3a3 100644 --- a/test/integration/expression/tests/legacy/interval/color-default/test.json +++ b/test/integration/expression/tests/legacy/interval/color-default/test.json @@ -2,22 +2,84 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, "black"], [1, "white"]], + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ], "default": "red" }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -27,13 +89,48 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 0, 0, 1] + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 0, + 0, + 1 + ] ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/color/test.json b/test/integration/expression/tests/legacy/interval/color/test.json index ad6145c1c..9e9e3824d 100644 --- a/test/integration/expression/tests/legacy/interval/color/test.json +++ b/test/integration/expression/tests/legacy/interval/color/test.json @@ -2,21 +2,83 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, "black"], [1, "white"]] + "stops": [ + [ + 0, + "black" + ], + [ + 1, + "white" + ] + ] }, "propertySpec": { "type": "color", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,15 +88,42 @@ "type": "color" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, - [0, 0, 0, 1], - [0, 0, 0, 1], - [0, 0, 0, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], + { + "error": "Expected value to be of type number, but found null instead." + }, + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], { "error": "Expected value to be of type number, but found string instead." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/composite-default/test.json b/test/integration/expression/tests/legacy/interval/composite-default/test.json index 629d13517..5b03be76a 100644 --- a/test/integration/expression/tests/legacy/interval/composite-default/test.json +++ b/test/integration/expression/tests/legacy/interval/composite-default/test.json @@ -3,26 +3,117 @@ "type": "interval", "property": "p", "stops": [ - [{"zoom": 0, "value": 0}, 0], - [{"zoom": 0, "value": 1}, 1], - [{"zoom": 1, "value": 0}, 2], - [{"zoom": 1, "value": 1}, 3] + [ + { + "zoom": 0, + "value": 0 + }, + 0 + ], + [ + { + "zoom": 0, + "value": 1 + }, + 1 + ], + [ + { + "zoom": 1, + "value": 0 + }, + 2 + ], + [ + { + "zoom": 1, + "value": 1 + }, + 3 + ] ], "default": -1 }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{"zoom": 0.5}, {"properties": {}}], - [{"zoom": 0.5}, {"properties": {"p": -1}}], - [{"zoom": 0.5}, {"properties": {"p": 0}}], - [{"zoom": 0.5}, {"properties": {"p": 0.5}}], - [{"zoom": 0.5}, {"properties": {"p": 1}}], - [{"zoom": 0.5}, {"properties": {"p": 2}}], - [{"zoom": 0.5}, {"properties": {"p": "0"}}] + [ + { + "zoom": 0.5 + }, + { + "properties": {} + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": -1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0.5 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 2 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -31,6 +122,14 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [-1, 0, 0, 0, 1, 1, -1] + "outputs": [ + -1, + 0, + 0, + 0, + 1, + 1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/composite/test.json b/test/integration/expression/tests/legacy/interval/composite/test.json index 86f41330e..b42fb0b76 100644 --- a/test/integration/expression/tests/legacy/interval/composite/test.json +++ b/test/integration/expression/tests/legacy/interval/composite/test.json @@ -3,25 +3,116 @@ "type": "interval", "property": "p", "stops": [ - [{"zoom": 0, "value": 0}, 0], - [{"zoom": 0, "value": 1}, 1], - [{"zoom": 1, "value": 0}, 2], - [{"zoom": 1, "value": 1}, 3] + [ + { + "zoom": 0, + "value": 0 + }, + 0 + ], + [ + { + "zoom": 0, + "value": 1 + }, + 1 + ], + [ + { + "zoom": 1, + "value": 0 + }, + 2 + ], + [ + { + "zoom": 1, + "value": 1 + }, + 3 + ] ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{"zoom": 0.5}, {"properties": {}}], - [{"zoom": 0.5}, {"properties": {"p": -1}}], - [{"zoom": 0.5}, {"properties": {"p": 0}}], - [{"zoom": 0.5}, {"properties": {"p": 0.5}}], - [{"zoom": 0.5}, {"properties": {"p": 1}}], - [{"zoom": 0.5}, {"properties": {"p": 2}}], - [{"zoom": 0.5}, {"properties": {"p": "0"}}] + [ + { + "zoom": 0.5 + }, + { + "properties": {} + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": -1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 0.5 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 1 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": 2 + } + } + ], + [ + { + "zoom": 0.5 + }, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -31,7 +122,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 0, 0, 0, @@ -42,4 +135,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/duplicate-stops/test.json b/test/integration/expression/tests/legacy/interval/duplicate-stops/test.json index 19081dce1..b325c877b 100644 --- a/test/integration/expression/tests/legacy/interval/duplicate-stops/test.json +++ b/test/integration/expression/tests/legacy/interval/duplicate-stops/test.json @@ -1,14 +1,44 @@ { "expression": { "type": "interval", - "stops": [[0, "a"], [1, "b"], [1, "c"], [2, "d"]] + "stops": [ + [ + 0, + "a" + ], + [ + 1, + "b" + ], + [ + 1, + "c" + ], + [ + 2, + "d" + ] + ] }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, - "inputs": [[{"zoom": 1}, {}]], + "inputs": [ + [ + { + "zoom": 1 + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -16,6 +46,8 @@ "isZoomConstant": false, "type": "string" }, - "outputs": ["b"] + "outputs": [ + "b" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/implicit/test.json b/test/integration/expression/tests/legacy/interval/implicit/test.json index dd4669435..c74919fcf 100644 --- a/test/integration/expression/tests/legacy/interval/implicit/test.json +++ b/test/integration/expression/tests/legacy/interval/implicit/test.json @@ -1,18 +1,83 @@ { - "expression": {"property": "p", "stops": [[0, "0"], [1, "1"]]}, + "expression": { + "property": "p", + "stops": [ + [ + 0, + "0" + ], + [ + 1, + "1" + ] + ] + }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": false, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": false, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -22,7 +87,9 @@ "type": "string" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, "0", "0", "0", @@ -33,4 +100,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/number-default/test.json b/test/integration/expression/tests/legacy/interval/number-default/test.json index 3791e7da2..903a227cf 100644 --- a/test/integration/expression/tests/legacy/interval/number-default/test.json +++ b/test/integration/expression/tests/legacy/interval/number-default/test.json @@ -2,22 +2,84 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, 0], [1, 1]], + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ], "default": -1 }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,6 +88,14 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1, 0, 0, 0, 1, 1, -1] + "outputs": [ + -1, + 0, + 0, + 0, + 1, + 1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/number/test.json b/test/integration/expression/tests/legacy/interval/number/test.json index 3f3365a59..2c1a03f52 100644 --- a/test/integration/expression/tests/legacy/interval/number/test.json +++ b/test/integration/expression/tests/legacy/interval/number/test.json @@ -2,21 +2,83 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, 0], [1, 1]] + "stops": [ + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ] }, "propertySpec": { "type": "number", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,7 +88,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, 0, 0, 0, @@ -37,4 +101,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/string-default/test.json b/test/integration/expression/tests/legacy/interval/string-default/test.json index e844cf949..a1e93fd3c 100644 --- a/test/integration/expression/tests/legacy/interval/string-default/test.json +++ b/test/integration/expression/tests/legacy/interval/string-default/test.json @@ -2,22 +2,84 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, "0"], [1, "1"]], + "stops": [ + [ + 0, + "0" + ], + [ + 1, + "1" + ] + ], "default": "default" }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,6 +88,14 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["default", "0", "0", "0", "1", "1", "default"] + "outputs": [ + "default", + "0", + "0", + "0", + "1", + "1", + "default" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/string/test.json b/test/integration/expression/tests/legacy/interval/string/test.json index ab3d54522..71191b052 100644 --- a/test/integration/expression/tests/legacy/interval/string/test.json +++ b/test/integration/expression/tests/legacy/interval/string/test.json @@ -2,21 +2,83 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, "0"], [1, "1"]] + "stops": [ + [ + 0, + "0" + ], + [ + 1, + "1" + ] + ] }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]} + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": -1}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": 0.5}}], - [{}, {"properties": {"p": 1}}], - [{}, {"properties": {"p": 2}}], - [{}, {"properties": {"p": "0"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": -1 + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "p": 1 + } + } + ], + [ + {}, + { + "properties": { + "p": 2 + } + } + ], + [ + {}, + { + "properties": { + "p": "0" + } + } + ] ], "expected": { "compiled": { @@ -26,7 +88,9 @@ "type": "string" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, "0", "0", "0", @@ -37,4 +101,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/tokens-property/test.json b/test/integration/expression/tests/legacy/interval/tokens-property/test.json index dcb5f401f..baaa7715e 100644 --- a/test/integration/expression/tests/legacy/interval/tokens-property/test.json +++ b/test/integration/expression/tests/legacy/interval/tokens-property/test.json @@ -2,19 +2,62 @@ "expression": { "type": "interval", "property": "p", - "stops": [[0, "0 {a}"], [1, "1 {b}"]] + "stops": [ + [ + 0, + "0 {a}" + ], + [ + 1, + "1 {b}" + ] + ] }, "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + }, "tokens": true }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0, "a": "a"}}], - [{}, {"properties": {"p": 1, "b": "b"}}], - [{}, {"properties": {"p": 0}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0, + "a": "a" + } + } + ], + [ + {}, + { + "properties": { + "p": 1, + "b": "b" + } + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ] ], "expected": { "compiled": { @@ -24,10 +67,12 @@ "type": "string" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."}, + { + "error": "Expected value to be of type number, but found null instead." + }, "0 {a}", "1 {b}", "0 {a}" ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/legacy/interval/tokens-zoom/test.json b/test/integration/expression/tests/legacy/interval/tokens-zoom/test.json index 40427b556..e6e461a0a 100644 --- a/test/integration/expression/tests/legacy/interval/tokens-zoom/test.json +++ b/test/integration/expression/tests/legacy/interval/tokens-zoom/test.json @@ -1,14 +1,59 @@ { - "expression": {"type": "interval", "stops": [[0, "0 {a}"], [1, "{b}"]]}, + "expression": { + "type": "interval", + "stops": [ + [ + 0, + "0 {a}" + ], + [ + 1, + "{b}" + ] + ] + }, "inputs": [ - [{"zoom": 0}, {"properties": {"a": "a", "b": 2}}], - [{"zoom": 1}, {"properties": {"a": "a", "b": 2}}], - [{"zoom": 0}, {"properties": {}}] + [ + { + "zoom": 0 + }, + { + "properties": { + "a": "a", + "b": 2 + } + } + ], + [ + { + "zoom": 1 + }, + { + "properties": { + "a": "a", + "b": 2 + } + } + ], + [ + { + "zoom": 0 + }, + { + "properties": {} + } + ] ], "propertySpec": { "type": "string", "property-type": "data-driven", - "expression": {"interpolated": true, "parameters": ["zoom", "feature"]}, + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + }, "tokens": true }, "expected": { @@ -18,6 +63,10 @@ "isZoomConstant": false, "type": "string" }, - "outputs": ["0 a", "2", "0 "] + "outputs": [ + "0 a", + "2", + "0 " + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/length/array/test.json b/test/integration/expression/tests/length/array/test.json index c3bffbfa3..822e95523 100644 --- a/test/integration/expression/tests/length/array/test.json +++ b/test/integration/expression/tests/length/array/test.json @@ -1,6 +1,30 @@ { - "expression": ["length", ["array", ["get", "x"]]], - "inputs": [[{}, {"properties": {"x": [1, 2, 3, 4, 5]}}]], + "expression": [ + "length", + [ + "array", + [ + "get", + "x" + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": [ + 1, + 2, + 3, + 4, + 5 + ] + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +32,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [5] + "outputs": [ + 5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/length/implicit/test.json b/test/integration/expression/tests/length/implicit/test.json index 4a9972ab0..7688e6fbe 100644 --- a/test/integration/expression/tests/length/implicit/test.json +++ b/test/integration/expression/tests/length/implicit/test.json @@ -1,9 +1,36 @@ { - "expression": ["length", ["get", "x"]], + "expression": [ + "length", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": "a string"}}], - [{}, {"properties": {"x": []}}], - [{}, {"properties": {"x": 0}}] + [ + {}, + { + "properties": { + "x": "a string" + } + } + ], + [ + {}, + { + "properties": { + "x": [] + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ] ], "expected": { "compiled": { @@ -20,4 +47,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/length/invalid/test.json b/test/integration/expression/tests/length/invalid/test.json index 3fedfc70a..3e6856be8 100644 --- a/test/integration/expression/tests/length/invalid/test.json +++ b/test/integration/expression/tests/length/invalid/test.json @@ -1,6 +1,14 @@ { - "expression": ["length", 0], - "inputs": [[{}, {}]], + "expression": [ + "length", + 0 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +20,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/length/string/test.json b/test/integration/expression/tests/length/string/test.json index 84c19a4c2..f0d8bca58 100644 --- a/test/integration/expression/tests/length/string/test.json +++ b/test/integration/expression/tests/length/string/test.json @@ -1,6 +1,24 @@ { - "expression": ["length", ["string", ["get", "x"]]], - "inputs": [[{}, {"properties": {"x": "a string"}}]], + "expression": [ + "length", + [ + "string", + [ + "get", + "x" + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": "a string" + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +26,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [8] + "outputs": [ + 8 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/boolean/test.json b/test/integration/expression/tests/less/boolean/test.json index 731d6dbb7..bcdffef6c 100644 --- a/test/integration/expression/tests/less/boolean/test.json +++ b/test/integration/expression/tests/less/boolean/test.json @@ -1,5 +1,21 @@ { - "expression": ["<", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + "<", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/mismatch/test.json b/test/integration/expression/tests/less/mismatch/test.json index c33f34fea..54f8870c6 100644 --- a/test/integration/expression/tests/less/mismatch/test.json +++ b/test/integration/expression/tests/less/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": ["<", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "<", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/null/test.json b/test/integration/expression/tests/less/null/test.json index ac9a426fd..9d3e321fd 100644 --- a/test/integration/expression/tests/less/null/test.json +++ b/test/integration/expression/tests/less/null/test.json @@ -1,5 +1,9 @@ { - "expression": ["<", null, null], + "expression": [ + "<", + null, + null + ], "expected": { "compiled": { "result": "error", @@ -11,4 +15,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/number/test.json b/test/integration/expression/tests/less/number/test.json index 8f333c350..da915fda8 100644 --- a/test/integration/expression/tests/less/number/test.json +++ b/test/integration/expression/tests/less/number/test.json @@ -1,9 +1,49 @@ { - "expression": ["<", ["number", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "<", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": 2}}], - [{}, {"properties": {"x": 2, "y": 1}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2, + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +52,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, false] + "outputs": [ + false, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/string-and-value/test.json b/test/integration/expression/tests/less/string-and-value/test.json index c4782887e..6a1341a9a 100644 --- a/test/integration/expression/tests/less/string-and-value/test.json +++ b/test/integration/expression/tests/less/string-and-value/test.json @@ -1,9 +1,46 @@ { - "expression": ["<", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + "<", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "1", "y": 2}}], - [{}, {"properties": {"x": 1, "y": "2"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "2" + } + } + ] ], "expected": { "compiled": { @@ -22,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/string/test.json b/test/integration/expression/tests/less/string/test.json index bc2a47e1d..7314c41d7 100644 --- a/test/integration/expression/tests/less/string/test.json +++ b/test/integration/expression/tests/less/string/test.json @@ -1,12 +1,76 @@ { - "expression": ["<", ["string", ["get", "x"]], ["string", ["get", "y"]]], + "expression": [ + "<", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "string", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "2", "y": "1"}}], - [{}, {"properties": {"x": "abc", "y": "azz"}}], - [{}, {"properties": {"x": "abc", "y": "aaa"}}], - [{}, {"properties": {"x": "abc", "y": "abc"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "2", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "azz" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "aaa" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "abc" + } + } + ] ], "expected": { "compiled": { @@ -15,6 +79,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, false, true, false, false] + "outputs": [ + false, + true, + false, + true, + false, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less/value/test.json b/test/integration/expression/tests/less/value/test.json index d88ddff0b..a7874ac0a 100644 --- a/test/integration/expression/tests/less/value/test.json +++ b/test/integration/expression/tests/less/value/test.json @@ -1,10 +1,52 @@ { - "expression": ["<", ["get", "x"], ["get", "y"]], + "expression": [ + "<", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "10", "y": "2"}}], - [{}, {"properties": {"x": 1, "y": 10}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "10", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 10 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -24,4 +66,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/boolean/test.json b/test/integration/expression/tests/less_or_equal/boolean/test.json index 1b657359e..be4e81b41 100644 --- a/test/integration/expression/tests/less_or_equal/boolean/test.json +++ b/test/integration/expression/tests/less_or_equal/boolean/test.json @@ -1,5 +1,21 @@ { - "expression": ["<=", ["boolean", ["get", "x"]], ["boolean", ["get", "y"]]], + "expression": [ + "<=", + [ + "boolean", + [ + "get", + "x" + ] + ], + [ + "boolean", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", @@ -11,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/mismatch/test.json b/test/integration/expression/tests/less_or_equal/mismatch/test.json index 40e257af4..4ba72fffe 100644 --- a/test/integration/expression/tests/less_or_equal/mismatch/test.json +++ b/test/integration/expression/tests/less_or_equal/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": ["<=", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "<=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/null/test.json b/test/integration/expression/tests/less_or_equal/null/test.json index c16be2ca7..681dd8903 100644 --- a/test/integration/expression/tests/less_or_equal/null/test.json +++ b/test/integration/expression/tests/less_or_equal/null/test.json @@ -1,5 +1,9 @@ { - "expression": ["<=", null, null], + "expression": [ + "<=", + null, + null + ], "expected": { "compiled": { "result": "error", @@ -11,4 +15,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/number/test.json b/test/integration/expression/tests/less_or_equal/number/test.json index 9fb5d8136..e54bbdcad 100644 --- a/test/integration/expression/tests/less_or_equal/number/test.json +++ b/test/integration/expression/tests/less_or_equal/number/test.json @@ -1,9 +1,49 @@ { - "expression": ["<=", ["number", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "<=", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": 2}}], - [{}, {"properties": {"x": 2, "y": 1}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2, + "y": 1 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +52,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false] + "outputs": [ + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/string-and-value/test.json b/test/integration/expression/tests/less_or_equal/string-and-value/test.json index a15668f92..a44be892c 100644 --- a/test/integration/expression/tests/less_or_equal/string-and-value/test.json +++ b/test/integration/expression/tests/less_or_equal/string-and-value/test.json @@ -1,9 +1,46 @@ { - "expression": ["<", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + "<", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -22,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/string/test.json b/test/integration/expression/tests/less_or_equal/string/test.json index 54c816ed9..a7d081567 100644 --- a/test/integration/expression/tests/less_or_equal/string/test.json +++ b/test/integration/expression/tests/less_or_equal/string/test.json @@ -1,12 +1,76 @@ { - "expression": ["<=", ["string", ["get", "x"]], ["string", ["get", "y"]]], + "expression": [ + "<=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "string", + [ + "get", + "y" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": "2"}}], - [{}, {"properties": {"x": "2", "y": "1"}}], - [{}, {"properties": {"x": "abc", "y": "azz"}}], - [{}, {"properties": {"x": "abc", "y": "aaa"}}], - [{}, {"properties": {"x": "abc", "y": "abc"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": "2", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "azz" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "aaa" + } + } + ], + [ + {}, + { + "properties": { + "x": "abc", + "y": "abc" + } + } + ] ], "expected": { "compiled": { @@ -15,6 +79,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false, true, false, true] + "outputs": [ + true, + true, + false, + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/less_or_equal/value/test.json b/test/integration/expression/tests/less_or_equal/value/test.json index b72b4019c..a2576c518 100644 --- a/test/integration/expression/tests/less_or_equal/value/test.json +++ b/test/integration/expression/tests/less_or_equal/value/test.json @@ -1,10 +1,52 @@ { - "expression": ["<=", ["get", "x"], ["get", "y"]], + "expression": [ + "<=", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "10", "y": "2"}}], - [{}, {"properties": {"x": 1, "y": 10}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}] + [ + {}, + { + "properties": { + "x": "10", + "y": "2" + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 10 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ] ], "expected": { "compiled": { @@ -24,4 +66,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/basic/test.json b/test/integration/expression/tests/let/basic/test.json index fcfbc2c4e..26f37a1b3 100644 --- a/test/integration/expression/tests/let/basic/test.json +++ b/test/integration/expression/tests/let/basic/test.json @@ -2,12 +2,51 @@ "expression": [ "let", "a", - ["number", ["get", "a"]], + [ + "number", + [ + "get", + "a" + ] + ], "b", - ["number", ["get", "b"]], - ["+", ["+", ["var", "a"], ["var", "b"]], ["var", "a"]] + [ + "number", + [ + "get", + "b" + ] + ], + [ + "+", + [ + "+", + [ + "var", + "a" + ], + [ + "var", + "b" + ] + ], + [ + "var", + "a" + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "a": 1, + "b": 2 + } + } + ] ], - "inputs": [[{}, {"properties": {"a": 1, "b": 2}}]], "expected": { "compiled": { "result": "success", @@ -15,6 +54,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [4] + "outputs": [ + 4 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/expected-value/test.json b/test/integration/expression/tests/let/expected-value/test.json index dc1587b56..332c748e5 100644 --- a/test/integration/expression/tests/let/expected-value/test.json +++ b/test/integration/expression/tests/let/expected-value/test.json @@ -2,20 +2,55 @@ "expression": [ "let", "density", - ["/", ["get", "population"], ["get", "sq-km"]], + [ + "/", + [ + "get", + "population" + ], + [ + "get", + "sq-km" + ] + ], [ "interpolate", - ["linear"], - ["var", "density"], + [ + "linear" + ], + [ + "var", + "density" + ], 1, "#000000", 100, "#ffffff" ] ], - "propertySpec": {"type": "color"}, + "propertySpec": { + "type": "color", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "description": "let should preserve expected type for child expressions. If the expected 'color' type in this test were not preserved, it would not get passed into the interpolation and the literal strings wouldn't automatically coerce to the 'color' type", - "inputs": [[{}, {"properties": {"population": 100, "sq-km": 10}}]], + "inputs": [ + [ + {}, + { + "properties": { + "population": 100, + "sq-km": 10 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -23,6 +58,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0.090909, 0.090909, 0.090909, 1]] + "outputs": [ + [ + 0.090909, + 0.090909, + 0.090909, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/invalid-name/test.json b/test/integration/expression/tests/let/invalid-name/test.json index 085d6897c..3d5ebd8ed 100644 --- a/test/integration/expression/tests/let/invalid-name/test.json +++ b/test/integration/expression/tests/let/invalid-name/test.json @@ -1,5 +1,13 @@ { - "expression": ["let", "$a", 1, ["var", "$a"]], + "expression": [ + "let", + "$a", + 1, + [ + "var", + "$a" + ] + ], "inputs": [], "expected": { "compiled": { @@ -12,4 +20,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/nested/test.json b/test/integration/expression/tests/let/nested/test.json index f5e493c6e..5b38c2476 100644 --- a/test/integration/expression/tests/let/nested/test.json +++ b/test/integration/expression/tests/let/nested/test.json @@ -2,10 +2,47 @@ "expression": [ "let", "a", - ["number", ["get", "a"]], - ["let", "b", ["+", 1, ["var", "a"]], ["+", ["var", "a"], ["var", "b"]]] + [ + "number", + [ + "get", + "a" + ] + ], + [ + "let", + "b", + [ + "+", + 1, + [ + "var", + "a" + ] + ], + [ + "+", + [ + "var", + "a" + ], + [ + "var", + "b" + ] + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "a": 1 + } + } + ] ], - "inputs": [[{}, {"properties": {"a": 1}}]], "expected": { "compiled": { "result": "success", @@ -13,6 +50,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [3] + "outputs": [ + 3 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/property-function/test.json b/test/integration/expression/tests/let/property-function/test.json index aac5c852a..d1ab94ccb 100644 --- a/test/integration/expression/tests/let/property-function/test.json +++ b/test/integration/expression/tests/let/property-function/test.json @@ -1,6 +1,33 @@ { - "expression": ["let", "a", ["get", "x"], ["+", 1, ["number", ["var", "a"]]]], - "inputs": [[{}, {"properties": {"x": 5}}]], + "expression": [ + "let", + "a", + [ + "get", + "x" + ], + [ + "+", + 1, + [ + "number", + [ + "var", + "a" + ] + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": 5 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +35,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [6] + "outputs": [ + 6 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/shadow/test.json b/test/integration/expression/tests/let/shadow/test.json index 6b10a4686..9cb788c06 100644 --- a/test/integration/expression/tests/let/shadow/test.json +++ b/test/integration/expression/tests/let/shadow/test.json @@ -2,10 +2,34 @@ "expression": [ "let", "a", - ["get", "one"], - ["let", "a", ["get", "two"], ["var", "a"]] + [ + "get", + "one" + ], + [ + "let", + "a", + [ + "get", + "two" + ], + [ + "var", + "a" + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "one": 1, + "two": 2 + } + } + ] ], - "inputs": [[{}, {"properties": {"one": 1, "two": 2}}]], "expected": { "compiled": { "result": "success", @@ -13,6 +37,8 @@ "isZoomConstant": true, "type": "value" }, - "outputs": [2] + "outputs": [ + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/unbound/test.json b/test/integration/expression/tests/let/unbound/test.json index 14d430ed3..f2aef3e07 100644 --- a/test/integration/expression/tests/let/unbound/test.json +++ b/test/integration/expression/tests/let/unbound/test.json @@ -3,7 +3,24 @@ "let", "a", 1, - ["+", ["+", ["var", "a"], ["var", "b"]], ["var", "a"]] + [ + "+", + [ + "+", + [ + "var", + "a" + ], + [ + "var", + "b" + ] + ], + [ + "var", + "a" + ] + ] ], "expected": { "compiled": { @@ -16,4 +33,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/let/zoom/test.json b/test/integration/expression/tests/let/zoom/test.json index c1262adba..2ef0624a3 100644 --- a/test/integration/expression/tests/let/zoom/test.json +++ b/test/integration/expression/tests/let/zoom/test.json @@ -2,20 +2,54 @@ "expression": [ "let", "z0_value", - ["number", ["get", "a"]], + [ + "number", + [ + "get", + "a" + ] + ], "z20_value", - ["number", ["get", "b"]], + [ + "number", + [ + "get", + "b" + ] + ], [ "interpolate", - ["linear"], - ["zoom"], + [ + "linear" + ], + [ + "zoom" + ], 0, - ["var", "z0_value"], + [ + "var", + "z0_value" + ], 20, - ["var", "z20_value"] + [ + "var", + "z20_value" + ] + ] + ], + "inputs": [ + [ + { + "zoom": 10 + }, + { + "properties": { + "a": 10, + "b": 30 + } + } ] ], - "inputs": [[{"zoom": 10}, {"properties": {"a": 10, "b": 30}}]], "expected": { "compiled": { "result": "success", @@ -23,6 +57,8 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [20] + "outputs": [ + 20 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/boolean-array/test.json b/test/integration/expression/tests/literal/boolean-array/test.json index dff8b29ef..547c0da72 100644 --- a/test/integration/expression/tests/literal/boolean-array/test.json +++ b/test/integration/expression/tests/literal/boolean-array/test.json @@ -1,6 +1,17 @@ { - "expression": ["literal", [true, false]], - "inputs": [[{}, {}]], + "expression": [ + "literal", + [ + true, + false + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,11 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[true, false]] + "outputs": [ + [ + true, + false + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/empty/test.json b/test/integration/expression/tests/literal/empty/test.json index 3f7255afa..9d5988f54 100644 --- a/test/integration/expression/tests/literal/empty/test.json +++ b/test/integration/expression/tests/literal/empty/test.json @@ -1,6 +1,13 @@ { - "expression": ["literal"], - "inputs": [[{}, {}]], + "expression": [ + "literal" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +19,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/infer-empty-array-type/test.json b/test/integration/expression/tests/literal/infer-empty-array-type/test.json index aa6760e99..65a062fb1 100644 --- a/test/integration/expression/tests/literal/infer-empty-array-type/test.json +++ b/test/integration/expression/tests/literal/infer-empty-array-type/test.json @@ -3,9 +3,17 @@ "type": "array", "value": "number", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["literal", []], + "expression": [ + "literal", + [] + ], "inputs": [], "expected": { "compiled": { @@ -16,4 +24,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/literal-false/test.json b/test/integration/expression/tests/literal/literal-false/test.json index 507e81154..20a6c1a3f 100644 --- a/test/integration/expression/tests/literal/literal-false/test.json +++ b/test/integration/expression/tests/literal/literal-false/test.json @@ -1,6 +1,14 @@ { - "expression": ["literal", false], - "inputs": [[{}, {}]], + "expression": [ + "literal", + false + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/literal-null/test.json b/test/integration/expression/tests/literal/literal-null/test.json index 31b02840f..51a01b6c1 100644 --- a/test/integration/expression/tests/literal/literal-null/test.json +++ b/test/integration/expression/tests/literal/literal-null/test.json @@ -1,6 +1,14 @@ { - "expression": ["literal", null], - "inputs": [[{}, {}]], + "expression": [ + "literal", + null + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "null" }, - "outputs": [null] + "outputs": [ + null + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/literal-number/test.json b/test/integration/expression/tests/literal/literal-number/test.json index 1a4b047fb..3e1caf591 100644 --- a/test/integration/expression/tests/literal/literal-number/test.json +++ b/test/integration/expression/tests/literal/literal-number/test.json @@ -1,6 +1,14 @@ { - "expression": ["literal", 7.5], - "inputs": [[{}, {}]], + "expression": [ + "literal", + 7.5 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [7.5] + "outputs": [ + 7.5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/literal-string/test.json b/test/integration/expression/tests/literal/literal-string/test.json index 771ea0179..96564ffb9 100644 --- a/test/integration/expression/tests/literal/literal-string/test.json +++ b/test/integration/expression/tests/literal/literal-string/test.json @@ -1,6 +1,14 @@ { - "expression": ["literal", "hello"], - "inputs": [[{}, {}]], + "expression": [ + "literal", + "hello" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["hello"] + "outputs": [ + "hello" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/literal-true/test.json b/test/integration/expression/tests/literal/literal-true/test.json index 9135ec6b1..bad0d679a 100644 --- a/test/integration/expression/tests/literal/literal-true/test.json +++ b/test/integration/expression/tests/literal/literal-true/test.json @@ -1,6 +1,14 @@ { - "expression": ["literal", true], - "inputs": [[{}, {}]], + "expression": [ + "literal", + true + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/mixed-primitive-array/test.json b/test/integration/expression/tests/literal/mixed-primitive-array/test.json index fb3aea185..902791ce4 100644 --- a/test/integration/expression/tests/literal/mixed-primitive-array/test.json +++ b/test/integration/expression/tests/literal/mixed-primitive-array/test.json @@ -1,6 +1,17 @@ { - "expression": ["literal", [1, "2"]], - "inputs": [[{}, {}]], + "expression": [ + "literal", + [ + 1, + "2" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,11 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[1, "2"]] + "outputs": [ + [ + 1, + "2" + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/multiple-args/test.json b/test/integration/expression/tests/literal/multiple-args/test.json index 922cd2701..fa1c3b5eb 100644 --- a/test/integration/expression/tests/literal/multiple-args/test.json +++ b/test/integration/expression/tests/literal/multiple-args/test.json @@ -1,6 +1,15 @@ { - "expression": ["literal", {}, []], - "inputs": [[{}, {}]], + "expression": [ + "literal", + {}, + [] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +21,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/nested-array/test.json b/test/integration/expression/tests/literal/nested-array/test.json index a9ca6f165..e71086d73 100644 --- a/test/integration/expression/tests/literal/nested-array/test.json +++ b/test/integration/expression/tests/literal/nested-array/test.json @@ -1,6 +1,20 @@ { - "expression": ["literal", [1, [3, 4]]], - "inputs": [[{}, {}]], + "expression": [ + "literal", + [ + 1, + [ + 3, + 4 + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +22,14 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[1, [3, 4]]] + "outputs": [ + [ + 1, + [ + 3, + 4 + ] + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/number-array/test.json b/test/integration/expression/tests/literal/number-array/test.json index 00334e983..03e946a1f 100644 --- a/test/integration/expression/tests/literal/number-array/test.json +++ b/test/integration/expression/tests/literal/number-array/test.json @@ -1,6 +1,17 @@ { - "expression": ["literal", [1, 2]], - "inputs": [[{}, {}]], + "expression": [ + "literal", + [ + 1, + 2 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,11 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[1, 2]] + "outputs": [ + [ + 1, + 2 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/object/test.json b/test/integration/expression/tests/literal/object/test.json index 8e38e1ec7..31fe60598 100644 --- a/test/integration/expression/tests/literal/object/test.json +++ b/test/integration/expression/tests/literal/object/test.json @@ -1,6 +1,16 @@ { - "expression": ["literal", {"x": 1}], - "inputs": [[{}, {}]], + "expression": [ + "literal", + { + "x": 1 + } + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,10 @@ "isZoomConstant": true, "type": "object" }, - "outputs": [{"x": 1}] + "outputs": [ + { + "x": 1 + } + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/string-array/test.json b/test/integration/expression/tests/literal/string-array/test.json index 567b0ee91..d23d03a86 100644 --- a/test/integration/expression/tests/literal/string-array/test.json +++ b/test/integration/expression/tests/literal/string-array/test.json @@ -1,6 +1,17 @@ { - "expression": ["literal", ["1", "2"]], - "inputs": [[{}, {}]], + "expression": [ + "literal", + [ + "1", + "2" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,11 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [["1", "2"]] + "outputs": [ + [ + "1", + "2" + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/string/test.json b/test/integration/expression/tests/literal/string/test.json index f07582575..19f74be3c 100644 --- a/test/integration/expression/tests/literal/string/test.json +++ b/test/integration/expression/tests/literal/string/test.json @@ -1,6 +1,11 @@ { "expression": "ahoy!", - "inputs": [[{}, {}]], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +13,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["ahoy!"] + "outputs": [ + "ahoy!" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/literal/u2028u2029/test.json b/test/integration/expression/tests/literal/u2028u2029/test.json index f31b13001..f700c8eac 100644 --- a/test/integration/expression/tests/literal/u2028u2029/test.json +++ b/test/integration/expression/tests/literal/u2028u2029/test.json @@ -1,6 +1,11 @@ { - "expression": "ah\u2028\u2029oy!", - "inputs": [[{}, {}]], + "expression": "ah

oy!", + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +13,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["ah\u2028\u2029oy!"] + "outputs": [ + "ah

oy!" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/ln/basic/test.json b/test/integration/expression/tests/ln/basic/test.json index 2b281d492..41efe6138 100644 --- a/test/integration/expression/tests/ln/basic/test.json +++ b/test/integration/expression/tests/ln/basic/test.json @@ -1,6 +1,16 @@ { - "expression": ["ln", ["e"]], - "inputs": [[{}, {}]], + "expression": [ + "ln", + [ + "e" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/ln2/basic/test.json b/test/integration/expression/tests/ln2/basic/test.json index 925a2996f..03b2f234e 100644 --- a/test/integration/expression/tests/ln2/basic/test.json +++ b/test/integration/expression/tests/ln2/basic/test.json @@ -1,6 +1,13 @@ { - "expression": ["ln2"], - "inputs": [[{}, {}]], + "expression": [ + "ln2" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0.693147] + "outputs": [ + 0.693147 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/log10/basic/test.json b/test/integration/expression/tests/log10/basic/test.json index 5e11915b6..afab62392 100644 --- a/test/integration/expression/tests/log10/basic/test.json +++ b/test/integration/expression/tests/log10/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["log10", 100], - "inputs": [[{}, {}]], + "expression": [ + "log10", + 100 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2] + "outputs": [ + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/log2/basic/test.json b/test/integration/expression/tests/log2/basic/test.json index 5db6106a0..4f9652f10 100644 --- a/test/integration/expression/tests/log2/basic/test.json +++ b/test/integration/expression/tests/log2/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["log2", 1024], - "inputs": [[{}, {}]], + "expression": [ + "log2", + 1024 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [10] + "outputs": [ + 10 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/arity-0/test.json b/test/integration/expression/tests/match/arity-0/test.json index 2a2822b16..b4535e52a 100644 --- a/test/integration/expression/tests/match/arity-0/test.json +++ b/test/integration/expression/tests/match/arity-0/test.json @@ -1,11 +1,16 @@ { - "expression": ["match"], + "expression": [ + "match" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected at least 4 arguments, but found only 0."} + { + "key": "", + "error": "Expected at least 4 arguments, but found only 0." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/arity-1/test.json b/test/integration/expression/tests/match/arity-1/test.json index 5b0ddcc0d..784a748d5 100644 --- a/test/integration/expression/tests/match/arity-1/test.json +++ b/test/integration/expression/tests/match/arity-1/test.json @@ -1,11 +1,17 @@ { - "expression": ["match", "x"], + "expression": [ + "match", + "x" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected at least 4 arguments, but found only 1."} + { + "key": "", + "error": "Expected at least 4 arguments, but found only 1." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/arity-2/test.json b/test/integration/expression/tests/match/arity-2/test.json index 07ba0590c..1774da489 100644 --- a/test/integration/expression/tests/match/arity-2/test.json +++ b/test/integration/expression/tests/match/arity-2/test.json @@ -1,12 +1,24 @@ { - "expression": ["match", "x", "y"], - "inputs": [[{}, {}]], + "expression": [ + "match", + "x", + "y" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected at least 4 arguments, but found only 2."} + { + "key": "", + "error": "Expected at least 4 arguments, but found only 2." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/arity-3/test.json b/test/integration/expression/tests/match/arity-3/test.json index 4c7fb31cc..4d1f78388 100644 --- a/test/integration/expression/tests/match/arity-3/test.json +++ b/test/integration/expression/tests/match/arity-3/test.json @@ -1,12 +1,25 @@ { - "expression": ["match", "x", "y", "z"], - "inputs": [[{}, {}]], + "expression": [ + "match", + "x", + "y", + "z" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Expected at least 4 arguments, but found only 3."} + { + "key": "", + "error": "Expected at least 4 arguments, but found only 3." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/basic/test.json b/test/integration/expression/tests/match/basic/test.json index e036acbd8..8796230b6 100644 --- a/test/integration/expression/tests/match/basic/test.json +++ b/test/integration/expression/tests/match/basic/test.json @@ -1,11 +1,55 @@ { - "expression": ["match", ["get", "x"], "a", "Apple", "b", "Banana", "Kumquat"], + "expression": [ + "match", + [ + "get", + "x" + ], + "a", + "Apple", + "b", + "Banana", + "Kumquat" + ], "inputs": [ - [{}, {"properties": {"x": "a"}}], - [{}, {"properties": {"x": "b"}}], - [{}, {"properties": {"x": "c"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {}}] + [ + {}, + { + "properties": { + "x": "a" + } + } + ], + [ + {}, + { + "properties": { + "x": "b" + } + } + ], + [ + {}, + { + "properties": { + "x": "c" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": {} + } + ] ], "expected": { "compiled": { @@ -14,6 +58,12 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["Apple", "Banana", "Kumquat", "Kumquat", "Kumquat"] + "outputs": [ + "Apple", + "Banana", + "Kumquat", + "Kumquat", + "Kumquat" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/empty-case/test.json b/test/integration/expression/tests/match/empty-case/test.json index 61c7ba21d..b9ff36fab 100644 --- a/test/integration/expression/tests/match/empty-case/test.json +++ b/test/integration/expression/tests/match/empty-case/test.json @@ -1,9 +1,23 @@ { - "expression": ["match", ["get", "x"], [], "thing one", "thing two"], + "expression": [ + "match", + [ + "get", + "x" + ], + [], + "thing one", + "thing two" + ], "expected": { "compiled": { "result": "error", - "errors": [{"key": "[2]", "error": "Expected at least one branch label."}] + "errors": [ + { + "key": "[2]", + "error": "Expected at least one branch label." + } + ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/infer-array-type/test.json b/test/integration/expression/tests/match/infer-array-type/test.json index 698ee071a..93052d46e 100644 --- a/test/integration/expression/tests/match/infer-array-type/test.json +++ b/test/integration/expression/tests/match/infer-array-type/test.json @@ -3,16 +3,45 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, "expression": [ "match", - ["number", ["get", "x"]], + [ + "number", + [ + "get", + "x" + ] + ], 0, - ["literal", ["one"]], + [ + "literal", + [ + "one" + ] + ], 10, - ["literal", ["one", "two"]], - ["literal", ["one", "two", "three"]] + [ + "literal", + [ + "one", + "two" + ] + ], + [ + "literal", + [ + "one", + "two", + "three" + ] + ] ], "inputs": [], "expected": { @@ -24,4 +53,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-array/test.json b/test/integration/expression/tests/match/label-array/test.json index 078d81657..e2b07822e 100644 --- a/test/integration/expression/tests/match/label-array/test.json +++ b/test/integration/expression/tests/match/label-array/test.json @@ -2,7 +2,13 @@ "expression": [ "match", "x", - ["string", ["get", "y"]], + [ + "string", + [ + "get", + "y" + ] + ], "thing one", "thing two" ], @@ -10,8 +16,11 @@ "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Branch labels must be numbers or strings."} + { + "key": "[2]", + "error": "Branch labels must be numbers or strings." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-boolean/test.json b/test/integration/expression/tests/match/label-boolean/test.json index 5f5b0837e..043486fa9 100644 --- a/test/integration/expression/tests/match/label-boolean/test.json +++ b/test/integration/expression/tests/match/label-boolean/test.json @@ -1,25 +1,74 @@ { "expression": [ "match", - ["boolean", ["get", "x"]], + [ + "boolean", + [ + "get", + "x" + ] + ], true, "match", "otherwise" ], "inputs": [ - [{}, {"properties": {"x": true}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": "true"}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": null}}], - [{}, {"properties": {}}] + [ + {}, + { + "properties": { + "x": true + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": "true" + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": {} + } + ] ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Branch labels must be numbers or strings."} + { + "key": "[2]", + "error": "Branch labels must be numbers or strings." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-non-integer/test.json b/test/integration/expression/tests/match/label-non-integer/test.json index f89961f14..3c55ff194 100644 --- a/test/integration/expression/tests/match/label-non-integer/test.json +++ b/test/integration/expression/tests/match/label-non-integer/test.json @@ -1,11 +1,20 @@ { - "expression": ["match", 1, 1.5, "thing one", "thing two"], + "expression": [ + "match", + 1, + 1.5, + "thing one", + "thing two" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Numeric branch labels must be integer values."} + { + "key": "[2]", + "error": "Numeric branch labels must be integer values." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-null/test.json b/test/integration/expression/tests/match/label-null/test.json index 004cb8c75..06d6f0044 100644 --- a/test/integration/expression/tests/match/label-null/test.json +++ b/test/integration/expression/tests/match/label-null/test.json @@ -1,12 +1,28 @@ { - "expression": ["match", null, null, "match", "otherwise"], - "inputs": [[{}, {"properties": {}}]], + "expression": [ + "match", + null, + null, + "match", + "otherwise" + ], + "inputs": [ + [ + {}, + { + "properties": {} + } + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Branch labels must be numbers or strings."} + { + "key": "[2]", + "error": "Branch labels must be numbers or strings." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-number/test.json b/test/integration/expression/tests/match/label-number/test.json index 8789b7d98..6c7c15fff 100644 --- a/test/integration/expression/tests/match/label-number/test.json +++ b/test/integration/expression/tests/match/label-number/test.json @@ -1,13 +1,69 @@ { - "expression": ["match", ["get", "x"], 0, "match", "otherwise"], + "expression": [ + "match", + [ + "get", + "x" + ], + 0, + "match", + "otherwise" + ], "inputs": [ - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 0.5}}], - [{}, {"properties": {"x": "0"}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}], - [{}, {"properties": {}}] + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "x": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": {} + } + ] ], "expected": { "compiled": { @@ -26,4 +82,4 @@ "otherwise" ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-object/test.json b/test/integration/expression/tests/match/label-object/test.json index 692106968..0cc456742 100644 --- a/test/integration/expression/tests/match/label-object/test.json +++ b/test/integration/expression/tests/match/label-object/test.json @@ -1,11 +1,20 @@ { - "expression": ["match", "x", {}, "thing one", "thing two"], + "expression": [ + "match", + "x", + {}, + "thing one", + "thing two" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Branch labels must be numbers or strings."} + { + "key": "[2]", + "error": "Branch labels must be numbers or strings." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-overflow/test.json b/test/integration/expression/tests/match/label-overflow/test.json index 9eac280f4..e7da3c2f9 100644 --- a/test/integration/expression/tests/match/label-overflow/test.json +++ b/test/integration/expression/tests/match/label-overflow/test.json @@ -1,5 +1,11 @@ { - "expression": ["match", 0, 10000000000000000, "thing one", "thing two"], + "expression": [ + "match", + 0, + 10000000000000000, + "thing one", + "thing two" + ], "expected": { "compiled": { "result": "error", @@ -11,4 +17,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-string-invalid-identifier/test.json b/test/integration/expression/tests/match/label-string-invalid-identifier/test.json index d2a744eb1..c1dc113fd 100644 --- a/test/integration/expression/tests/match/label-string-invalid-identifier/test.json +++ b/test/integration/expression/tests/match/label-string-invalid-identifier/test.json @@ -1,17 +1,63 @@ { "expression": [ "match", - ["string", ["get", "x"]], - ["0-1", "a.b", "{}", "weird\u2028json\u2029issue"], + [ + "string", + [ + "get", + "x" + ] + ], + [ + "0-1", + "a.b", + "{}", + "weird
json
issue" + ], "match", "otherwise" ], "inputs": [ - [{}, {"properties": {"x": "0-1"}}], - [{}, {"properties": {"x": "a.b"}}], - [{}, {"properties": {"x": "{}"}}], - [{}, {"properties": {"x": "weird\u2028json\u2029issue"}}], - [{}, {"properties": {"x": "1"}}] + [ + {}, + { + "properties": { + "x": "0-1" + } + } + ], + [ + {}, + { + "properties": { + "x": "a.b" + } + } + ], + [ + {}, + { + "properties": { + "x": "{}" + } + } + ], + [ + {}, + { + "properties": { + "x": "weird
json
issue" + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ] ], "expected": { "compiled": { @@ -20,6 +66,12 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["match", "match", "match", "match", "otherwise"] + "outputs": [ + "match", + "match", + "match", + "match", + "otherwise" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/label-string/test.json b/test/integration/expression/tests/match/label-string/test.json index fd59b2ad7..6895c01e8 100644 --- a/test/integration/expression/tests/match/label-string/test.json +++ b/test/integration/expression/tests/match/label-string/test.json @@ -1,12 +1,64 @@ { - "expression": ["match", ["string", ["get", "x"]], "0", "match", "otherwise"], + "expression": [ + "match", + [ + "string", + [ + "get", + "x" + ] + ], + "0", + "match", + "otherwise" + ], "inputs": [ - [{}, {"properties": {"x": "0"}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}], - [{}, {"properties": {}}] + [ + {}, + { + "properties": { + "x": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": {} + } + ] ], "expected": { "compiled": { @@ -24,8 +76,12 @@ { "error": "Expected value to be of type string, but found boolean instead." }, - {"error": "Expected value to be of type string, but found null instead."}, - {"error": "Expected value to be of type string, but found null instead."} + { + "error": "Expected value to be of type string, but found null instead." + }, + { + "error": "Expected value to be of type string, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/mismatch-input/test.json b/test/integration/expression/tests/match/mismatch-input/test.json index 804933ddd..0c6baa398 100644 --- a/test/integration/expression/tests/match/mismatch-input/test.json +++ b/test/integration/expression/tests/match/mismatch-input/test.json @@ -1,11 +1,26 @@ { - "expression": ["match", ["string", ["get", "x"]], 0, "match", "otherwise"], + "expression": [ + "match", + [ + "string", + [ + "get", + "x" + ] + ], + 0, + "match", + "otherwise" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[1]", "error": "Expected number but found string instead."} + { + "key": "[1]", + "error": "Expected number but found string instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/mismatch-label-1/test.json b/test/integration/expression/tests/match/mismatch-label-1/test.json index 46d78cf40..3ea5742eb 100644 --- a/test/integration/expression/tests/match/mismatch-label-1/test.json +++ b/test/integration/expression/tests/match/mismatch-label-1/test.json @@ -1,7 +1,10 @@ { "expression": [ "match", - ["get", "x"], + [ + "get", + "x" + ], "a", "the letter a", 0, @@ -14,8 +17,11 @@ "compiled": { "result": "error", "errors": [ - {"key": "[4]", "error": "Expected string but found number instead."} + { + "key": "[4]", + "error": "Expected string but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/mismatch-label-2/test.json b/test/integration/expression/tests/match/mismatch-label-2/test.json index 67cef7ce7..4ea03c803 100644 --- a/test/integration/expression/tests/match/mismatch-label-2/test.json +++ b/test/integration/expression/tests/match/mismatch-label-2/test.json @@ -1,11 +1,26 @@ { - "expression": ["match", ["get", "x"], ["0", 0], "zero", "otherwise"], + "expression": [ + "match", + [ + "get", + "x" + ], + [ + "0", + 0 + ], + "zero", + "otherwise" + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[2]", "error": "Expected string but found number instead."} + { + "key": "[2]", + "error": "Expected string but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/mismatch-output/test.json b/test/integration/expression/tests/match/mismatch-output/test.json index 2a95152d3..261b721d9 100644 --- a/test/integration/expression/tests/match/mismatch-output/test.json +++ b/test/integration/expression/tests/match/mismatch-output/test.json @@ -1,11 +1,26 @@ { - "expression": ["match", ["string", ["get", "x"]], "0", "match", false], + "expression": [ + "match", + [ + "string", + [ + "get", + "x" + ] + ], + "0", + "match", + false + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[4]", "error": "Expected string but found boolean instead."} + { + "key": "[4]", + "error": "Expected string but found boolean instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/mixed-type/test.json b/test/integration/expression/tests/match/mixed-type/test.json index 7c4104f6b..03d347c1c 100644 --- a/test/integration/expression/tests/match/mixed-type/test.json +++ b/test/integration/expression/tests/match/mixed-type/test.json @@ -1,7 +1,10 @@ { "expression": [ "match", - ["get", "x"], + [ + "get", + "x" + ], "a", "the letter a", 0, @@ -11,17 +14,48 @@ "otherwise" ], "inputs": [ - [{}, {"properties": {"x": "a"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": "0"}}], - [{}, {"properties": {"x": true}}] + [ + {}, + { + "properties": { + "x": "a" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": true + } + } + ] ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "[4]", "error": "Expected string but found number instead."} + { + "key": "[4]", + "error": "Expected string but found number instead." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/multi-value/test.json b/test/integration/expression/tests/match/multi-value/test.json index ec55305ba..3128d1a3c 100644 --- a/test/integration/expression/tests/match/multi-value/test.json +++ b/test/integration/expression/tests/match/multi-value/test.json @@ -3,20 +3,67 @@ "string", [ "match", - ["string", ["get", "x"]], - ["a", "A"], + [ + "string", + [ + "get", + "x" + ] + ], + [ + "a", + "A" + ], "Apple", - ["b", "B"], + [ + "b", + "B" + ], "Banana", "Kumquat" ] ], "inputs": [ - [{}, {"properties": {"x": "a"}}], - [{}, {"properties": {"x": "A"}}], - [{}, {"properties": {"x": "b"}}], - [{}, {"properties": {"x": "B"}}], - [{}, {"properties": {"x": "c"}}] + [ + {}, + { + "properties": { + "x": "a" + } + } + ], + [ + {}, + { + "properties": { + "x": "A" + } + } + ], + [ + {}, + { + "properties": { + "x": "b" + } + } + ], + [ + {}, + { + "properties": { + "x": "B" + } + } + ], + [ + {}, + { + "properties": { + "x": "c" + } + } + ] ], "expected": { "compiled": { @@ -25,6 +72,12 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["Apple", "Apple", "Banana", "Banana", "Kumquat"] + "outputs": [ + "Apple", + "Apple", + "Banana", + "Banana", + "Kumquat" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/unreachable-branch-1/test.json b/test/integration/expression/tests/match/unreachable-branch-1/test.json index 9fa886878..c5348c688 100644 --- a/test/integration/expression/tests/match/unreachable-branch-1/test.json +++ b/test/integration/expression/tests/match/unreachable-branch-1/test.json @@ -1,7 +1,13 @@ { "expression": [ "match", - ["string", ["get", "x"]], + [ + "string", + [ + "get", + "x" + ] + ], "0", "match", "0", @@ -11,7 +17,12 @@ "expected": { "compiled": { "result": "error", - "errors": [{"key": "[4]", "error": "Branch labels must be unique."}] + "errors": [ + { + "key": "[4]", + "error": "Branch labels must be unique." + } + ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/match/unreachable-branch-2/test.json b/test/integration/expression/tests/match/unreachable-branch-2/test.json index 34d6ca326..8107da1c9 100644 --- a/test/integration/expression/tests/match/unreachable-branch-2/test.json +++ b/test/integration/expression/tests/match/unreachable-branch-2/test.json @@ -1,17 +1,34 @@ { "expression": [ "match", - ["string", ["get", "x"]], - ["0", "1"], + [ + "string", + [ + "get", + "x" + ] + ], + [ + "0", + "1" + ], "match", - ["0", "2"], + [ + "0", + "2" + ], "match", "otherwise" ], "expected": { "compiled": { "result": "error", - "errors": [{"key": "[4]", "error": "Branch labels must be unique."}] + "errors": [ + { + "key": "[4]", + "error": "Branch labels must be unique." + } + ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/max/arity-0/test.json b/test/integration/expression/tests/max/arity-0/test.json index a8ecaab9a..64af13c7d 100644 --- a/test/integration/expression/tests/max/arity-0/test.json +++ b/test/integration/expression/tests/max/arity-0/test.json @@ -1,6 +1,31 @@ { - "expression": ["all", ["<", ["max"], 0], ["==", 0, ["/", 1, ["max"]]]], - "inputs": [[{}, {}]], + "expression": [ + "all", + [ + "<", + [ + "max" + ], + 0 + ], + [ + "==", + 0, + [ + "/", + 1, + [ + "max" + ] + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +33,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/max/arity-1/test.json b/test/integration/expression/tests/max/arity-1/test.json index 7501f8f5b..37ae15afd 100644 --- a/test/integration/expression/tests/max/arity-1/test.json +++ b/test/integration/expression/tests/max/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["max", 1], - "inputs": [[{}, {}]], + "expression": [ + "max", + 1 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/max/basic/test.json b/test/integration/expression/tests/max/basic/test.json index d7e4b2e22..73e1b5cbb 100644 --- a/test/integration/expression/tests/max/basic/test.json +++ b/test/integration/expression/tests/max/basic/test.json @@ -1,6 +1,16 @@ { - "expression": ["max", 0, -1, 100], - "inputs": [[{}, {}]], + "expression": [ + "max", + 0, + -1, + 100 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [100] + "outputs": [ + 100 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/min/arity-0/test.json b/test/integration/expression/tests/min/arity-0/test.json index 3b74d34dc..52c25fc80 100644 --- a/test/integration/expression/tests/min/arity-0/test.json +++ b/test/integration/expression/tests/min/arity-0/test.json @@ -1,6 +1,31 @@ { - "expression": ["all", [">", ["min"], 0], ["==", 0, ["/", 1, ["min"]]]], - "inputs": [[{}, {}]], + "expression": [ + "all", + [ + ">", + [ + "min" + ], + 0 + ], + [ + "==", + 0, + [ + "/", + 1, + [ + "min" + ] + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +33,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/min/arity-1/test.json b/test/integration/expression/tests/min/arity-1/test.json index f3421f655..5c73412da 100644 --- a/test/integration/expression/tests/min/arity-1/test.json +++ b/test/integration/expression/tests/min/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["min", 1], - "inputs": [[{}, {}]], + "expression": [ + "min", + 1 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/min/basic/test.json b/test/integration/expression/tests/min/basic/test.json index d0bf8c4d6..b543d2119 100644 --- a/test/integration/expression/tests/min/basic/test.json +++ b/test/integration/expression/tests/min/basic/test.json @@ -1,6 +1,16 @@ { - "expression": ["min", 0, -1, 10], - "inputs": [[{}, {}]], + "expression": [ + "min", + 0, + -1, + 10 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-1] + "outputs": [ + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/minus/arity-0/test.json b/test/integration/expression/tests/minus/arity-0/test.json index cc5a6d94d..588c64959 100644 --- a/test/integration/expression/tests/minus/arity-0/test.json +++ b/test/integration/expression/tests/minus/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["-"], - "inputs": [[{}, {}]], + "expression": [ + "-" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +19,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/minus/arity-1/test.json b/test/integration/expression/tests/minus/arity-1/test.json index 4483ea279..85c87fca9 100644 --- a/test/integration/expression/tests/minus/arity-1/test.json +++ b/test/integration/expression/tests/minus/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["-", 5], - "inputs": [[{}, {}]], + "expression": [ + "-", + 5 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-5] + "outputs": [ + -5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/minus/basic/test.json b/test/integration/expression/tests/minus/basic/test.json index f86c0f611..f23303bf5 100644 --- a/test/integration/expression/tests/minus/basic/test.json +++ b/test/integration/expression/tests/minus/basic/test.json @@ -1,6 +1,15 @@ { - "expression": ["-", 5, 7], - "inputs": [[{}, {}]], + "expression": [ + "-", + 5, + 7 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +17,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-2] + "outputs": [ + -2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/minus/inference-arity-2/test.json b/test/integration/expression/tests/minus/inference-arity-2/test.json index 9287cf27b..3baad1d96 100644 --- a/test/integration/expression/tests/minus/inference-arity-2/test.json +++ b/test/integration/expression/tests/minus/inference-arity-2/test.json @@ -1,6 +1,22 @@ { - "expression": ["-", ["get", "x"], 7], - "inputs": [[{}, {"properties": {"x": 0}}]], + "expression": [ + "-", + [ + "get", + "x" + ], + 7 + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": 0 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +24,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-7] + "outputs": [ + -7 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/mod/basic/test.json b/test/integration/expression/tests/mod/basic/test.json index 43906196a..85a2679f7 100644 --- a/test/integration/expression/tests/mod/basic/test.json +++ b/test/integration/expression/tests/mod/basic/test.json @@ -1,6 +1,15 @@ { - "expression": ["%", 18, 12], - "inputs": [[{}, {}]], + "expression": [ + "%", + 18, + 12 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +17,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [6] + "outputs": [ + 6 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/not/basic/test.json b/test/integration/expression/tests/not/basic/test.json index b2e19dfc0..c717d64e2 100644 --- a/test/integration/expression/tests/not/basic/test.json +++ b/test/integration/expression/tests/not/basic/test.json @@ -1,8 +1,31 @@ { - "expression": ["!", ["boolean", ["get", "x"]]], + "expression": [ + "!", + [ + "boolean", + [ + "get", + "x" + ] + ] + ], "inputs": [ - [{}, {"properties": {"x": true}}], - [{}, {"properties": {"x": false}}] + [ + {}, + { + "properties": { + "x": true + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ] ], "expected": { "compiled": { @@ -11,6 +34,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true] + "outputs": [ + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/not_equal/mismatch/test.json b/test/integration/expression/tests/not_equal/mismatch/test.json index 8a455e01b..5c6a64cba 100644 --- a/test/integration/expression/tests/not_equal/mismatch/test.json +++ b/test/integration/expression/tests/not_equal/mismatch/test.json @@ -1,11 +1,30 @@ { - "expression": ["!=", ["string", ["get", "x"]], ["number", ["get", "y"]]], + "expression": [ + "!=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "number", + [ + "get", + "y" + ] + ] + ], "expected": { "compiled": { "result": "error", "errors": [ - {"key": "", "error": "Cannot compare types 'string' and 'number'."} + { + "key": "", + "error": "Cannot compare types 'string' and 'number'." + } ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/not_equal/number/test.json b/test/integration/expression/tests/not_equal/number/test.json index e0b2e62b4..98e98544c 100644 --- a/test/integration/expression/tests/not_equal/number/test.json +++ b/test/integration/expression/tests/not_equal/number/test.json @@ -1,9 +1,46 @@ { - "expression": ["!=", ["number", ["get", "x"]], ["get", "y"]], + "expression": [ + "!=", + [ + "number", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": 1}}], - [{}, {"properties": {"x": 1, "y": "1"}}], - [{}, {"properties": {"x": 1, "y": 2}}] + [ + {}, + { + "properties": { + "x": 1, + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": 1, + "y": 2 + } + } + ] ], "expected": { "compiled": { @@ -12,6 +49,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true] + "outputs": [ + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/not_equal/string/test.json b/test/integration/expression/tests/not_equal/string/test.json index 09ed7fa97..a9c203111 100644 --- a/test/integration/expression/tests/not_equal/string/test.json +++ b/test/integration/expression/tests/not_equal/string/test.json @@ -1,9 +1,46 @@ { - "expression": ["!=", ["string", ["get", "x"]], ["get", "y"]], + "expression": [ + "!=", + [ + "string", + [ + "get", + "x" + ] + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1", "y": "1"}}], - [{}, {"properties": {"x": "1", "y": 1}}], - [{}, {"properties": {"x": "1", "y": "2"}}] + [ + {}, + { + "properties": { + "x": "1", + "y": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": "2" + } + } + ] ], "expected": { "compiled": { @@ -12,6 +49,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true] + "outputs": [ + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/not_equal/value/test.json b/test/integration/expression/tests/not_equal/value/test.json index 0696d9ed5..49d4a6853 100644 --- a/test/integration/expression/tests/not_equal/value/test.json +++ b/test/integration/expression/tests/not_equal/value/test.json @@ -1,12 +1,70 @@ { - "expression": ["!=", ["get", "x"], ["get", "y"]], + "expression": [ + "!=", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": 0, "y": 0}}], - [{}, {"properties": {"x": "0", "y": "0"}}], - [{}, {"properties": {"x": 0, "y": false}}], - [{}, {"properties": {"x": 0, "y": "0"}}], - [{}, {"properties": {"x": 0, "y": null}}], - [{}, {"properties": {"x": "0", "y": null}}] + [ + {}, + { + "properties": { + "x": 0, + "y": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": "0", + "y": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": false + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": "0" + } + } + ], + [ + {}, + { + "properties": { + "x": 0, + "y": null + } + } + ], + [ + {}, + { + "properties": { + "x": "0", + "y": null + } + } + ] ], "expected": { "compiled": { @@ -15,6 +73,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, false, true, true, true, true] + "outputs": [ + false, + false, + true, + true, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/number-format/currency/test.json b/test/integration/expression/tests/number-format/currency/test.json index d1335d71b..b5ccf915b 100644 --- a/test/integration/expression/tests/number-format/currency/test.json +++ b/test/integration/expression/tests/number-format/currency/test.json @@ -2,11 +2,36 @@ "expression": [ "number-format", 123456.789, - {"locale": ["get", "locale"], "currency": ["get", "currency"]} + { + "locale": [ + "get", + "locale" + ], + "currency": [ + "get", + "currency" + ] + } ], "inputs": [ - [{}, {"properties": {"locale": "en-US", "currency": "JPY"}}], - [{}, {"properties": {"locale": "en-US", "currency": "EUR"}}] + [ + {}, + { + "properties": { + "locale": "en-US", + "currency": "JPY" + } + } + ], + [ + {}, + { + "properties": { + "locale": "en-US", + "currency": "EUR" + } + } + ] ], "expected": { "compiled": { @@ -15,6 +40,9 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["¥123,457", "€123,456.79"] + "outputs": [ + "¥123,457", + "€123,456.79" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/number-format/default/test.json b/test/integration/expression/tests/number-format/default/test.json index d593f28c3..98c1ba6fa 100644 --- a/test/integration/expression/tests/number-format/default/test.json +++ b/test/integration/expression/tests/number-format/default/test.json @@ -1,6 +1,15 @@ { - "expression": ["number-format", 123456.789, {}], - "inputs": [[{}, {}]], + "expression": [ + "number-format", + 123456.789, + {} + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +17,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["123,456.789"] + "outputs": [ + "123,456.789" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/number-format/precision/test.json b/test/integration/expression/tests/number-format/precision/test.json index 0d4f5e04b..02eeb51e8 100644 --- a/test/integration/expression/tests/number-format/precision/test.json +++ b/test/integration/expression/tests/number-format/precision/test.json @@ -3,14 +3,41 @@ "number-format", 987654321.234567, { - "locale": ["get", "locale"], - "min-fraction-digits": ["get", "min"], - "max-fraction-digits": ["get", "max"] + "locale": [ + "get", + "locale" + ], + "min-fraction-digits": [ + "get", + "min" + ], + "max-fraction-digits": [ + "get", + "max" + ] } ], "inputs": [ - [{}, {"properties": {"locale": "en-US", "min": 15, "max": 20}}], - [{}, {"properties": {"locale": "en-US", "min": 2, "max": 4}}] + [ + {}, + { + "properties": { + "locale": "en-US", + "min": 15, + "max": 20 + } + } + ], + [ + {}, + { + "properties": { + "locale": "en-US", + "min": 2, + "max": 4 + } + } + ] ], "expected": { "compiled": { @@ -19,6 +46,9 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["987,654,321.234567000000000", "987,654,321.2346"] + "outputs": [ + "987,654,321.234567000000000", + "987,654,321.2346" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/number/basic/test.json b/test/integration/expression/tests/number/basic/test.json index 847ac202a..3fbcb55a5 100644 --- a/test/integration/expression/tests/number/basic/test.json +++ b/test/integration/expression/tests/number/basic/test.json @@ -1,10 +1,44 @@ { - "expression": ["number", ["get", "x"]], + "expression": [ + "number", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -21,7 +55,9 @@ { "error": "Expected value to be of type number, but found boolean instead." }, - {"error": "Expected value to be of type number, but found null instead."} + { + "error": "Expected value to be of type number, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/number/default-value/test.json b/test/integration/expression/tests/number/default-value/test.json index 4eb5b8d9f..87f3aebf7 100644 --- a/test/integration/expression/tests/number/default-value/test.json +++ b/test/integration/expression/tests/number/default-value/test.json @@ -1,10 +1,45 @@ { - "expression": ["number", ["get", "x"], -1], + "expression": [ + "number", + [ + "get", + "x" + ], + -1 + ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -13,6 +48,11 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1, -1, -1, -1] + "outputs": [ + 1, + -1, + -1, + -1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/object/basic/test.json b/test/integration/expression/tests/object/basic/test.json index 502374356..909165497 100644 --- a/test/integration/expression/tests/object/basic/test.json +++ b/test/integration/expression/tests/object/basic/test.json @@ -1,11 +1,54 @@ { - "expression": ["object", ["get", "x"]], + "expression": [ + "object", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": {"inner": "object"}}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": { + "inner": "object" + } + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -15,7 +58,9 @@ "type": "object" }, "outputs": [ - {"inner": "object"}, + { + "inner": "object" + }, { "error": "Expected value to be of type object, but found number instead." }, @@ -25,7 +70,9 @@ { "error": "Expected value to be of type object, but found boolean instead." }, - {"error": "Expected value to be of type object, but found null instead."} + { + "error": "Expected value to be of type object, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/object/default-value/test.json b/test/integration/expression/tests/object/default-value/test.json index 5c213d0f3..11c7251ca 100644 --- a/test/integration/expression/tests/object/default-value/test.json +++ b/test/integration/expression/tests/object/default-value/test.json @@ -1,11 +1,60 @@ { - "expression": ["object", ["get", "x"], ["literal", {"default": "value"}]], + "expression": [ + "object", + [ + "get", + "x" + ], + [ + "literal", + { + "default": "value" + } + ] + ], "inputs": [ - [{}, {"properties": {"x": {"inner": "object"}}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": { + "inner": "object" + } + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -15,11 +64,21 @@ "type": "object" }, "outputs": [ - {"inner": "object"}, - {"default": "value"}, - {"default": "value"}, - {"default": "value"}, - {"default": "value"} + { + "inner": "object" + }, + { + "default": "value" + }, + { + "default": "value" + }, + { + "default": "value" + }, + { + "default": "value" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/object/implicit/test.json b/test/integration/expression/tests/object/implicit/test.json index f8abac4b4..f56e7d5ad 100644 --- a/test/integration/expression/tests/object/implicit/test.json +++ b/test/integration/expression/tests/object/implicit/test.json @@ -1,8 +1,31 @@ { - "expression": ["get", "b", ["get", "a"]], + "expression": [ + "get", + "b", + [ + "get", + "a" + ] + ], "inputs": [ - [{}, {"properties": {"a": {"b": 0}}}], - [{}, {"properties": {"a": "not"}}] + [ + {}, + { + "properties": { + "a": { + "b": 0 + } + } + } + ], + [ + {}, + { + "properties": { + "a": "not" + } + } + ] ], "expected": { "compiled": { @@ -18,4 +41,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/parse/empty/test.json b/test/integration/expression/tests/parse/empty/test.json index 737b33dc3..ae40231e3 100644 --- a/test/integration/expression/tests/parse/empty/test.json +++ b/test/integration/expression/tests/parse/empty/test.json @@ -11,4 +11,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/parse/non-array/test.json b/test/integration/expression/tests/parse/non-array/test.json index ce9ad3312..a150321dd 100644 --- a/test/integration/expression/tests/parse/non-array/test.json +++ b/test/integration/expression/tests/parse/non-array/test.json @@ -1,5 +1,13 @@ { - "expression": ["+", ["-", 0, {}], 10], + "expression": [ + "+", + [ + "-", + 0, + {} + ], + 10 + ], "expected": { "compiled": { "result": "error", @@ -11,4 +19,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/parse/non-string/test.json b/test/integration/expression/tests/parse/non-string/test.json index def3386e0..56971e3b0 100644 --- a/test/integration/expression/tests/parse/non-string/test.json +++ b/test/integration/expression/tests/parse/non-string/test.json @@ -1,5 +1,8 @@ { - "expression": [1, 2], + "expression": [ + 1, + 2 + ], "expected": { "compiled": { "result": "error", @@ -11,4 +14,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/parse/unknown-expression/test.json b/test/integration/expression/tests/parse/unknown-expression/test.json index d4ba1782a..a016463c5 100644 --- a/test/integration/expression/tests/parse/unknown-expression/test.json +++ b/test/integration/expression/tests/parse/unknown-expression/test.json @@ -1,5 +1,18 @@ { - "expression": ["+", ["*", 1, 2, 3, ["FAKE-EXPRESSION", 1]], 10], + "expression": [ + "+", + [ + "*", + 1, + 2, + 3, + [ + "FAKE-EXPRESSION", + 1 + ] + ], + 10 + ], "expected": { "compiled": { "result": "error", @@ -11,4 +24,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/pi/basic/test.json b/test/integration/expression/tests/pi/basic/test.json index b651c2137..91f058847 100644 --- a/test/integration/expression/tests/pi/basic/test.json +++ b/test/integration/expression/tests/pi/basic/test.json @@ -1,6 +1,13 @@ { - "expression": ["pi"], - "inputs": [[{}, {}]], + "expression": [ + "pi" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [3.14159] + "outputs": [ + 3.14159 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/plus/arity-0/test.json b/test/integration/expression/tests/plus/arity-0/test.json index 9433adc90..120f76d46 100644 --- a/test/integration/expression/tests/plus/arity-0/test.json +++ b/test/integration/expression/tests/plus/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["+"], - "inputs": [[{}, {}]], + "expression": [ + "+" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0] + "outputs": [ + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/plus/arity-1/test.json b/test/integration/expression/tests/plus/arity-1/test.json index 229b8dfbe..ce6bad4af 100644 --- a/test/integration/expression/tests/plus/arity-1/test.json +++ b/test/integration/expression/tests/plus/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["+", 1], - "inputs": [[{}, {}]], + "expression": [ + "+", + 1 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/plus/basic/test.json b/test/integration/expression/tests/plus/basic/test.json index a9f0add14..653f8c689 100644 --- a/test/integration/expression/tests/plus/basic/test.json +++ b/test/integration/expression/tests/plus/basic/test.json @@ -1,6 +1,17 @@ { - "expression": ["+", 1, 2, 3, 4], - "inputs": [[{}, {}]], + "expression": [ + "+", + 1, + 2, + 3, + 4 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [10] + "outputs": [ + 10 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/pow/basic/test.json b/test/integration/expression/tests/pow/basic/test.json index 453d911e2..bc017dbda 100644 --- a/test/integration/expression/tests/pow/basic/test.json +++ b/test/integration/expression/tests/pow/basic/test.json @@ -1,6 +1,33 @@ { - "expression": ["^", 4, ["number", ["get", "x"]]], - "inputs": [[{}, {"properties": {"x": 2}}], [{}, {"properties": {"x": 0.5}}]], + "expression": [ + "^", + 4, + [ + "number", + [ + "get", + "x" + ] + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": 2 + } + } + ], + [ + {}, + { + "properties": { + "x": 0.5 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +35,9 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [16, 2] + "outputs": [ + 16, + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/properties/basic/test.json b/test/integration/expression/tests/properties/basic/test.json index 907d8bed7..22ce7b6fe 100644 --- a/test/integration/expression/tests/properties/basic/test.json +++ b/test/integration/expression/tests/properties/basic/test.json @@ -1,6 +1,17 @@ { - "expression": ["properties"], - "inputs": [[{}, {"properties": {"x": 5}}]], + "expression": [ + "properties" + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": 5 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,10 @@ "isZoomConstant": true, "type": "object" }, - "outputs": [{"x": 5}] + "outputs": [ + { + "x": 5 + } + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/resolved-locale/basic/test.json b/test/integration/expression/tests/resolved-locale/basic/test.json index 39c5142d3..ac2e4fd74 100644 --- a/test/integration/expression/tests/resolved-locale/basic/test.json +++ b/test/integration/expression/tests/resolved-locale/basic/test.json @@ -5,12 +5,21 @@ "resolved-locale", [ "collator", - {"case-sensitive": true, "diacritic-sensitive": true, "locale": "en"} + { + "case-sensitive": true, + "diacritic-sensitive": true, + "locale": "en" + } ] ], "en" ], - "inputs": [[{}, {}]], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -18,6 +27,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true] + "outputs": [ + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/rgb/basic/test.json b/test/integration/expression/tests/rgb/basic/test.json index 4630b1e1b..224c4b84b 100644 --- a/test/integration/expression/tests/rgb/basic/test.json +++ b/test/integration/expression/tests/rgb/basic/test.json @@ -1,6 +1,16 @@ { - "expression": ["rgb", 0, 0, 255], - "inputs": [[{}, {}]], + "expression": [ + "rgb", + 0, + 0, + 255 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +18,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0, 0, 1, 1]] + "outputs": [ + [ + 0, + 0, + 1, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/rgba/basic/test.json b/test/integration/expression/tests/rgba/basic/test.json index 742a07f1f..0eecc33ce 100644 --- a/test/integration/expression/tests/rgba/basic/test.json +++ b/test/integration/expression/tests/rgba/basic/test.json @@ -1,6 +1,17 @@ { - "expression": ["rgba", 0, 0, 255, 1], - "inputs": [[{}, {}]], + "expression": [ + "rgba", + 0, + 0, + 255, + 1 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0, 0, 1, 1]] + "outputs": [ + [ + 0, + 0, + 1, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/rgba/out-of-bounds/test.json b/test/integration/expression/tests/rgba/out-of-bounds/test.json index 4d59b4997..7c3b70504 100644 --- a/test/integration/expression/tests/rgba/out-of-bounds/test.json +++ b/test/integration/expression/tests/rgba/out-of-bounds/test.json @@ -3,14 +3,58 @@ "rgba", 0, 0, - ["number", ["get", "b"]], - ["number", ["get", "a"]] + [ + "number", + [ + "get", + "b" + ] + ], + [ + "number", + [ + "get", + "a" + ] + ] ], "inputs": [ - [{}, {"properties": {"b": -1, "a": 1}}], - [{}, {"properties": {"b": 256, "a": 1}}], - [{}, {"properties": {"b": 255, "a": -0.5}}], - [{}, {"properties": {"b": 256, "a": 1.5}}] + [ + {}, + { + "properties": { + "b": -1, + "a": 1 + } + } + ], + [ + {}, + { + "properties": { + "b": 256, + "a": 1 + } + } + ], + [ + {}, + { + "properties": { + "b": 255, + "a": -0.5 + } + } + ], + [ + {}, + { + "properties": { + "b": 256, + "a": 1.5 + } + } + ] ], "expected": { "compiled": { @@ -34,4 +78,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/round/basic/test.json b/test/integration/expression/tests/round/basic/test.json index 683b61c7d..71639c633 100644 --- a/test/integration/expression/tests/round/basic/test.json +++ b/test/integration/expression/tests/round/basic/test.json @@ -1,14 +1,76 @@ { - "expression": ["round", ["get", "x"]], + "expression": [ + "round", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": -2.6}}], - [{}, {"properties": {"x": -2.5}}], - [{}, {"properties": {"x": -2.4}}], - [{}, {"properties": {"x": -2}}], - [{}, {"properties": {"x": 2.6}}], - [{}, {"properties": {"x": 2.5}}], - [{}, {"properties": {"x": 2.4}}], - [{}, {"properties": {"x": 2}}] + [ + {}, + { + "properties": { + "x": -2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": -2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": -2 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.6 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.5 + } + } + ], + [ + {}, + { + "properties": { + "x": 2.4 + } + } + ], + [ + {}, + { + "properties": { + "x": 2 + } + } + ] ], "expected": { "compiled": { @@ -17,6 +79,15 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [-3, -3, -2, -2, 3, 3, 2, 2] + "outputs": [ + -3, + -3, + -2, + -2, + 3, + 3, + 2, + 2 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/sin/basic/test.json b/test/integration/expression/tests/sin/basic/test.json index ea51d397b..f6778e4de 100644 --- a/test/integration/expression/tests/sin/basic/test.json +++ b/test/integration/expression/tests/sin/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["sin", 0], - "inputs": [[{}, {}]], + "expression": [ + "sin", + 0 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0] + "outputs": [ + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/slice/array-one-index/test.json b/test/integration/expression/tests/slice/array-one-index/test.json index f14a924e9..068e0bd00 100644 --- a/test/integration/expression/tests/slice/array-one-index/test.json +++ b/test/integration/expression/tests/slice/array-one-index/test.json @@ -1,10 +1,79 @@ { - "expression": ["slice", ["array", ["get", "val"]], ["get", "index"]], + "expression": [ + "slice", + [ + "array", + [ + "get", + "val" + ] + ], + [ + "get", + "index" + ] + ], "inputs": [ - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "index": 2}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "index": 0}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "index": 99}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "index": -2}}] + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "index": 2 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "index": 0 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "index": 99 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "index": -2 + } + } + ] ], "expected": { "compiled": { @@ -13,6 +82,24 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[3, 4, 5], [1, 2, 3, 4, 5], [], [4, 5]] + "outputs": [ + [ + 3, + 4, + 5 + ], + [ + 1, + 2, + 3, + 4, + 5 + ], + [], + [ + 4, + 5 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/slice/array-two-indexes/test.json b/test/integration/expression/tests/slice/array-two-indexes/test.json index e175a986d..5d4577cca 100644 --- a/test/integration/expression/tests/slice/array-two-indexes/test.json +++ b/test/integration/expression/tests/slice/array-two-indexes/test.json @@ -1,17 +1,119 @@ { "expression": [ "slice", - ["array", ["get", "val"]], - ["get", "i1"], - ["get", "i2"] + [ + "array", + [ + "get", + "val" + ] + ], + [ + "get", + "i1" + ], + [ + "get", + "i2" + ] ], "inputs": [ - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": 2, "i2": 4}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": 1, "i2": 5}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": 1, "i2": 99}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": -4, "i2": -2}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": 0, "i2": -1}}], - [{}, {"properties": {"val": [1, 2, 3, 4, 5], "i1": 0, "i2": 0}}] + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": 2, + "i2": 4 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": 1, + "i2": 5 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": 1, + "i2": 99 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": -4, + "i2": -2 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": 0, + "i2": -1 + } + } + ], + [ + {}, + { + "properties": { + "val": [ + 1, + 2, + 3, + 4, + 5 + ], + "i1": 0, + "i2": 0 + } + } + ] ], "expected": { "compiled": { @@ -20,6 +122,34 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[3, 4], [2, 3, 4, 5], [2, 3, 4, 5], [2, 3], [1, 2, 3, 4], []] + "outputs": [ + [ + 3, + 4 + ], + [ + 2, + 3, + 4, + 5 + ], + [ + 2, + 3, + 4, + 5 + ], + [ + 2, + 3 + ], + [ + 1, + 2, + 3, + 4 + ], + [] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/slice/invalid-inputs/test.json b/test/integration/expression/tests/slice/invalid-inputs/test.json index 658aac570..d4bea1a01 100644 --- a/test/integration/expression/tests/slice/invalid-inputs/test.json +++ b/test/integration/expression/tests/slice/invalid-inputs/test.json @@ -1,12 +1,70 @@ { - "expression": ["slice", ["get", "input"], ["get", "i1"]], + "expression": [ + "slice", + [ + "get", + "input" + ], + [ + "get", + "i1" + ] + ], "inputs": [ - [{}, {"properties": {"input": false, "i1": 1}}], - [{}, {"properties": {"input": null, "i1": 1}}], - [{}, {"properties": {"input": 12, "i1": 1}}], - [{}, {"properties": {"input": {}, "i1": 1}}], - [{}, {"properties": {"other": 1, "i1": 1}}], - [{}, {"properties": {"input": "correct", "i1": "one"}}] + [ + {}, + { + "properties": { + "input": false, + "i1": 1 + } + } + ], + [ + {}, + { + "properties": { + "input": null, + "i1": 1 + } + } + ], + [ + {}, + { + "properties": { + "input": 12, + "i1": 1 + } + } + ], + [ + {}, + { + "properties": { + "input": {}, + "i1": 1 + } + } + ], + [ + {}, + { + "properties": { + "other": 1, + "i1": 1 + } + } + ], + [ + {}, + { + "properties": { + "input": "correct", + "i1": "one" + } + } + ] ], "expected": { "compiled": { @@ -36,4 +94,4 @@ } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/slice/string-one-index/test.json b/test/integration/expression/tests/slice/string-one-index/test.json index 20f421c6b..df865db69 100644 --- a/test/integration/expression/tests/slice/string-one-index/test.json +++ b/test/integration/expression/tests/slice/string-one-index/test.json @@ -1,10 +1,52 @@ { - "expression": ["slice", ["get", "val"], ["get", "index"]], + "expression": [ + "slice", + [ + "get", + "val" + ], + [ + "get", + "index" + ] + ], "inputs": [ - [{}, {"properties": {"val": "0123456789", "index": 0}}], - [{}, {"properties": {"val": "0123456789", "index": 4}}], - [{}, {"properties": {"val": "0123456789", "index": 99}}], - [{}, {"properties": {"val": "0123456789", "index": -2}}] + [ + {}, + { + "properties": { + "val": "0123456789", + "index": 0 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "index": 4 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "index": 99 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "index": -2 + } + } + ] ], "expected": { "compiled": { @@ -13,6 +55,11 @@ "isZoomConstant": true, "type": "value" }, - "outputs": ["0123456789", "456789", "", "89"] + "outputs": [ + "0123456789", + "456789", + "", + "89" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/slice/string-two-indexes/test.json b/test/integration/expression/tests/slice/string-two-indexes/test.json index 8afe231ef..72c2ede4c 100644 --- a/test/integration/expression/tests/slice/string-two-indexes/test.json +++ b/test/integration/expression/tests/slice/string-two-indexes/test.json @@ -1,11 +1,70 @@ { - "expression": ["slice", ["get", "val"], ["get", "i1"], ["get", "i2"]], + "expression": [ + "slice", + [ + "get", + "val" + ], + [ + "get", + "i1" + ], + [ + "get", + "i2" + ] + ], "inputs": [ - [{}, {"properties": {"val": "0123456789", "i1": 1, "i2": 8}}], - [{}, {"properties": {"val": "0123456789", "i1": 4, "i2": -2}}], - [{}, {"properties": {"val": "0123456789", "i1": -3, "i2": -1}}], - [{}, {"properties": {"val": "0123456789", "i1": 0, "i2": -1}}], - [{}, {"properties": {"val": "0123456789", "i1": 0, "i2": 99}}] + [ + {}, + { + "properties": { + "val": "0123456789", + "i1": 1, + "i2": 8 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "i1": 4, + "i2": -2 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "i1": -3, + "i2": -1 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "i1": 0, + "i2": -1 + } + } + ], + [ + {}, + { + "properties": { + "val": "0123456789", + "i1": 0, + "i2": 99 + } + } + ] ], "expected": { "compiled": { @@ -14,6 +73,12 @@ "isZoomConstant": true, "type": "value" }, - "outputs": ["1234567", "4567", "78", "012345678", "0123456789"] + "outputs": [ + "1234567", + "4567", + "78", + "012345678", + "0123456789" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/sqrt/basic/test.json b/test/integration/expression/tests/sqrt/basic/test.json index 03b472b01..32a0d09f4 100644 --- a/test/integration/expression/tests/sqrt/basic/test.json +++ b/test/integration/expression/tests/sqrt/basic/test.json @@ -1,6 +1,29 @@ { - "expression": ["sqrt", ["get", "x"]], - "inputs": [[{}, {"properties": {"x": 4}}], [{}, {"properties": {"x": 0.25}}]], + "expression": [ + "sqrt", + [ + "get", + "x" + ] + ], + "inputs": [ + [ + {}, + { + "properties": { + "x": 4 + } + } + ], + [ + {}, + { + "properties": { + "x": 0.25 + } + } + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +31,9 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [2, 0.5] + "outputs": [ + 2, + 0.5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/step/basic/test.json b/test/integration/expression/tests/step/basic/test.json index eb6c459b6..c70e92031 100644 --- a/test/integration/expression/tests/step/basic/test.json +++ b/test/integration/expression/tests/step/basic/test.json @@ -1,15 +1,71 @@ { "expression": [ "number", - ["step", ["number", ["get", "x"]], 11, 0, 111, 1, 1111] + [ + "step", + [ + "number", + [ + "get", + "x" + ] + ], + 11, + 0, + 111, + 1, + 1111 + ] ], "inputs": [ - [{}, {"properties": {"x": -1.5}}], - [{}, {"properties": {"x": -0.5}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 0.5}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": 1.5}}] + [ + {}, + { + "properties": { + "x": -1.5 + } + } + ], + [ + {}, + { + "properties": { + "x": -0.5 + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 0.5 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": 1.5 + } + } + ] ], "expected": { "compiled": { @@ -18,6 +74,13 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [11, 11, 111, 111, 1111, 1111] + "outputs": [ + 11, + 11, + 111, + 111, + 1111, + 1111 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/step/duplicate_stops/test.json b/test/integration/expression/tests/step/duplicate_stops/test.json index de5212369..d4e32e061 100644 --- a/test/integration/expression/tests/step/duplicate_stops/test.json +++ b/test/integration/expression/tests/step/duplicate_stops/test.json @@ -1,6 +1,19 @@ { - "expression": ["step", 0, "a", 0, "b", 0, "c"], - "inputs": [[{}, {}]], + "expression": [ + "step", + 0, + "a", + 0, + "b", + 0, + "c" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +25,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/string/basic/test.json b/test/integration/expression/tests/string/basic/test.json index 20c4d7874..ae31c6332 100644 --- a/test/integration/expression/tests/string/basic/test.json +++ b/test/integration/expression/tests/string/basic/test.json @@ -1,10 +1,44 @@ { - "expression": ["string", ["get", "x"]], + "expression": [ + "string", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -21,7 +55,9 @@ { "error": "Expected value to be of type string, but found boolean instead." }, - {"error": "Expected value to be of type string, but found null instead."} + { + "error": "Expected value to be of type string, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/string/default-value/test.json b/test/integration/expression/tests/string/default-value/test.json index b2998cf97..3d722c09a 100644 --- a/test/integration/expression/tests/string/default-value/test.json +++ b/test/integration/expression/tests/string/default-value/test.json @@ -1,10 +1,45 @@ { - "expression": ["string", ["get", "x"], "default"], + "expression": [ + "string", + [ + "get", + "x" + ], + "default" + ], "inputs": [ - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}] + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -13,6 +48,11 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["1", "default", "default", "default"] + "outputs": [ + "1", + "default", + "default", + "default" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/tan/basic/test.json b/test/integration/expression/tests/tan/basic/test.json index b70098687..7fcab24d6 100644 --- a/test/integration/expression/tests/tan/basic/test.json +++ b/test/integration/expression/tests/tan/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["tan", 0.7853981633974483], - "inputs": [[{}, {}]], + "expression": [ + "tan", + 0.7853981633974483 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0.999999] + "outputs": [ + 0.999999 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/times/arity-0/test.json b/test/integration/expression/tests/times/arity-0/test.json index 85bb857c9..aedf35dcb 100644 --- a/test/integration/expression/tests/times/arity-0/test.json +++ b/test/integration/expression/tests/times/arity-0/test.json @@ -1,6 +1,13 @@ { - "expression": ["*"], - "inputs": [[{}, {}]], + "expression": [ + "*" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +15,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1] + "outputs": [ + 1 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/times/arity-1/test.json b/test/integration/expression/tests/times/arity-1/test.json index 67a75afed..cfb51031a 100644 --- a/test/integration/expression/tests/times/arity-1/test.json +++ b/test/integration/expression/tests/times/arity-1/test.json @@ -1,6 +1,14 @@ { - "expression": ["*", 0], - "inputs": [[{}, {}]], + "expression": [ + "*", + 0 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [0] + "outputs": [ + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/times/basic/test.json b/test/integration/expression/tests/times/basic/test.json index f3d55eedf..f37f019a7 100644 --- a/test/integration/expression/tests/times/basic/test.json +++ b/test/integration/expression/tests/times/basic/test.json @@ -1,6 +1,17 @@ { - "expression": ["*", 3, 2, 0.5, 2], - "inputs": [[{}, {}]], + "expression": [ + "*", + 3, + 2, + 0.5, + 2 + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +19,8 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [6] + "outputs": [ + 6 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-boolean/2-ary/test.json b/test/integration/expression/tests/to-boolean/2-ary/test.json index 94de6a23d..4b9873304 100644 --- a/test/integration/expression/tests/to-boolean/2-ary/test.json +++ b/test/integration/expression/tests/to-boolean/2-ary/test.json @@ -1,10 +1,30 @@ { - "expression": ["to-boolean", ["get", "x"], ["get", "y"]], - "inputs": [[{}, {}]], + "expression": [ + "to-boolean", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", - "errors": [{"key": "", "error": "Expected one argument."}] + "errors": [ + { + "key": "", + "error": "Expected one argument." + } + ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-boolean/basic/test.json b/test/integration/expression/tests/to-boolean/basic/test.json index 86a6c9e40..d47dc0f7a 100644 --- a/test/integration/expression/tests/to-boolean/basic/test.json +++ b/test/integration/expression/tests/to-boolean/basic/test.json @@ -1,14 +1,72 @@ { - "expression": ["to-boolean", ["get", "x"]], + "expression": [ + "to-boolean", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {}], - [{}, {"properties": {"x": true}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": ""}}], - [{}, {"properties": {"x": "false"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": null}}] + [ + {}, + {} + ], + [ + {}, + { + "properties": { + "x": true + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": "" + } + } + ], + [ + {}, + { + "properties": { + "x": "false" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ] ], "expected": { "compiled": { @@ -17,6 +75,15 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, false, false, true, false, true, false] + "outputs": [ + false, + true, + false, + false, + true, + false, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-color/2-ary/test.json b/test/integration/expression/tests/to-color/2-ary/test.json index 5cc13f921..33824d456 100644 --- a/test/integration/expression/tests/to-color/2-ary/test.json +++ b/test/integration/expression/tests/to-color/2-ary/test.json @@ -1,13 +1,94 @@ { - "expression": ["to-color", ["get", "x"], ["get", "y"]], + "expression": [ + "to-color", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": "red", "y": "#000000"}}], - [{}, {"properties": {"x": "invalid", "y": "#000000"}}], - [{}, {"properties": {"x": "rgba(0, 255, 0, 1)", "y": "#000000"}}], - [{}, {"properties": {"x": [0, 255, 0, 1], "y": "#000000"}}], - [{}, {"properties": {"x": [0, 255, 0], "y": "#000000"}}], - [{}, {"properties": {"x": [0, 255], "y": "#000000"}}], - [{}, {"properties": {"x": [0, 255], "y": "invalid"}}] + [ + {}, + { + "properties": { + "x": "red", + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": "invalid", + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": "rgba(0, 255, 0, 1)", + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255, + 0, + 1 + ], + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255, + 0 + ], + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255 + ], + "y": "#000000" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255 + ], + "y": "invalid" + } + } + ] ], "expected": { "compiled": { @@ -17,13 +98,45 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - [0, 0, 0, 1], - [0, 1, 0, 1], - [0, 1, 0, 1], - [0, 1, 0, 1], - [0, 0, 0, 1], - {"error": "Could not parse color from value 'invalid'"} + [ + 1, + 0, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 0, + 0, + 1 + ], + { + "error": "Could not parse color from value 'invalid'" + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-color/basic/test.json b/test/integration/expression/tests/to-color/basic/test.json index 89341252d..4a69494c8 100644 --- a/test/integration/expression/tests/to-color/basic/test.json +++ b/test/integration/expression/tests/to-color/basic/test.json @@ -1,12 +1,72 @@ { - "expression": ["to-color", ["get", "x"]], + "expression": [ + "to-color", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": "red"}}], - [{}, {"properties": {"x": "invalid"}}], - [{}, {"properties": {"x": "rgba(0, 255, 0, 1)"}}], - [{}, {"properties": {"x": [0, 255, 0, 1]}}], - [{}, {"properties": {"x": [0, 255, 0]}}], - [{}, {"properties": {"x": [0, 255]}}] + [ + {}, + { + "properties": { + "x": "red" + } + } + ], + [ + {}, + { + "properties": { + "x": "invalid" + } + } + ], + [ + {}, + { + "properties": { + "x": "rgba(0, 255, 0, 1)" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255, + 0, + 1 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255, + 0 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255 + ] + } + } + ] ], "expected": { "compiled": { @@ -16,14 +76,36 @@ "type": "color" }, "outputs": [ - [1, 0, 0, 1], - {"error": "Could not parse color from value 'invalid'"}, - [0, 1, 0, 1], - [0, 1, 0, 1], - [0, 1, 0, 1], + [ + 1, + 0, + 0, + 1 + ], + { + "error": "Could not parse color from value 'invalid'" + }, + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], + [ + 0, + 1, + 0, + 1 + ], { "error": "Invalid rbga value [0,255]: expected an array containing either three or four numeric values." } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-color/color/test.json b/test/integration/expression/tests/to-color/color/test.json index dfbc97e80..24817f3f6 100644 --- a/test/integration/expression/tests/to-color/color/test.json +++ b/test/integration/expression/tests/to-color/color/test.json @@ -1,6 +1,20 @@ { - "expression": ["to-color", ["rgba", 0, 0, 0, 1]], - "inputs": [[{}, {}]], + "expression": [ + "to-color", + [ + "rgba", + 0, + 0, + 0, + 1 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +22,13 @@ "isZoomConstant": true, "type": "color" }, - "outputs": [[0, 0, 0, 1]] + "outputs": [ + [ + 0, + 0, + 0, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-number/2-ary/test.json b/test/integration/expression/tests/to-number/2-ary/test.json index dbf0cbdda..24ae4d913 100644 --- a/test/integration/expression/tests/to-number/2-ary/test.json +++ b/test/integration/expression/tests/to-number/2-ary/test.json @@ -1,15 +1,100 @@ { - "expression": ["to-number", ["get", "x"], ["get", "y"]], + "expression": [ + "to-number", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1, "y": -1}}], - [{}, {"properties": {"x": "1", "y": -1}}], - [{}, {"properties": {"x": "6.02e-23", "y": -1}}], - [{}, {"properties": {"x": "Not a number", "y": -1}}], - [{}, {"properties": {"x": null, "y": -1}}], - [{}, {"properties": {"x": [1, 2], "y": -1}}], - [{}, {"properties": {"x": {"y": 1}, "y": -1}}], - [{}, {"properties": {"y": -1}}], - [{}, {"properties": {"y": "bad fallback"}}] + [ + {}, + { + "properties": { + "x": 1, + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1", + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": "6.02e-23", + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": "Not a number", + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": null, + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2 + ], + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "x": { + "y": 1 + }, + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "y": -1 + } + } + ], + [ + {}, + { + "properties": { + "y": "bad fallback" + } + } + ] ], "expected": { "compiled": { @@ -18,6 +103,16 @@ "isZoomConstant": true, "type": "number" }, - "outputs": [1, 1, 6.02e-23, -1, 0, -1, -1, 0, 0] + "outputs": [ + 1, + 1, + 6.02e-23, + -1, + 0, + -1, + -1, + 0, + 0 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-number/basic/test.json b/test/integration/expression/tests/to-number/basic/test.json index 408cbd184..fe7a8d4df 100644 --- a/test/integration/expression/tests/to-number/basic/test.json +++ b/test/integration/expression/tests/to-number/basic/test.json @@ -1,13 +1,73 @@ { - "expression": ["to-number", ["get", "x"]], + "expression": [ + "to-number", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": "1"}}], - [{}, {"properties": {"x": "6.02e-23"}}], - [{}, {"properties": {"x": "Not a number"}}], - [{}, {"properties": {"x": null}}], - [{}, {"properties": {"x": [1, 2]}}], - [{}, {"properties": {"x": {"y": 1}}}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": "1" + } + } + ], + [ + {}, + { + "properties": { + "x": "6.02e-23" + } + } + ], + [ + {}, + { + "properties": { + "x": "Not a number" + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": { + "y": 1 + } + } + } + ] ], "expected": { "compiled": { @@ -20,10 +80,16 @@ 1, 1, 6.02e-23, - {"error": "Could not convert \"Not a number\" to number."}, + { + "error": "Could not convert \"Not a number\" to number." + }, 0, - {"error": "Could not convert [1,2] to number."}, - {"error": "Could not convert {\"y\":1} to number."} + { + "error": "Could not convert [1,2] to number." + }, + { + "error": "Could not convert {\"y\":1} to number." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-rgba/alpha/test.json b/test/integration/expression/tests/to-rgba/alpha/test.json index bdd0b5add..fb90a691a 100644 --- a/test/integration/expression/tests/to-rgba/alpha/test.json +++ b/test/integration/expression/tests/to-rgba/alpha/test.json @@ -1,6 +1,20 @@ { - "expression": ["to-rgba", ["rgba", 0, 128, 255, 0.5]], - "inputs": [[{}, {}]], + "expression": [ + "to-rgba", + [ + "rgba", + 0, + 128, + 255, + 0.5 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +22,13 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[0, 128, 255, 0.5]] + "outputs": [ + [ + 0, + 128, + 255, + 0.5 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-rgba/basic/test.json b/test/integration/expression/tests/to-rgba/basic/test.json index 9151d8f7b..3110aa55f 100644 --- a/test/integration/expression/tests/to-rgba/basic/test.json +++ b/test/integration/expression/tests/to-rgba/basic/test.json @@ -1,10 +1,53 @@ { - "expression": ["to-rgba", ["get", "x"]], + "expression": [ + "to-rgba", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": "red"}}], - [{}, {"properties": {"x": "rgba(0, 255, 0, 1)"}}], - [{}, {"properties": {"x": [0, 255, 0, 1]}}], - [{}, {"properties": {"x": [0, 0, 255]}}] + [ + {}, + { + "properties": { + "x": "red" + } + } + ], + [ + {}, + { + "properties": { + "x": "rgba(0, 255, 0, 1)" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 255, + 0, + 1 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 0, + 0, + 255 + ] + } + } + ] ], "expected": { "compiled": { @@ -13,6 +56,31 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[255, 0, 0, 1], [0, 255, 0, 1], [0, 255, 0, 1], [0, 0, 255, 1]] + "outputs": [ + [ + 255, + 0, + 0, + 1 + ], + [ + 0, + 255, + 0, + 1 + ], + [ + 0, + 255, + 0, + 1 + ], + [ + 0, + 0, + 255, + 1 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-rgba/zero/test.json b/test/integration/expression/tests/to-rgba/zero/test.json index 777b2c6d0..fcbc5edc1 100644 --- a/test/integration/expression/tests/to-rgba/zero/test.json +++ b/test/integration/expression/tests/to-rgba/zero/test.json @@ -1,6 +1,20 @@ { - "expression": ["to-rgba", ["rgba", 0, 0, 0, 0]], - "inputs": [[{}, {}]], + "expression": [ + "to-rgba", + [ + "rgba", + 0, + 0, + 0, + 0 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +22,13 @@ "isZoomConstant": true, "type": "array" }, - "outputs": [[0, 0, 0, 0]] + "outputs": [ + [ + 0, + 0, + 0, + 0 + ] + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-string/2-ary/test.json b/test/integration/expression/tests/to-string/2-ary/test.json index 4ee8bde79..7403d1645 100644 --- a/test/integration/expression/tests/to-string/2-ary/test.json +++ b/test/integration/expression/tests/to-string/2-ary/test.json @@ -1,10 +1,30 @@ { - "expression": ["to-string", ["get", "x"], ["get", "y"]], - "inputs": [[{}, {}]], + "expression": [ + "to-string", + [ + "get", + "x" + ], + [ + "get", + "y" + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", - "errors": [{"key": "", "error": "Expected one argument."}] + "errors": [ + { + "key": "", + "error": "Expected one argument." + } + ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-string/basic/test.json b/test/integration/expression/tests/to-string/basic/test.json index 3a8165427..dfb482b7a 100644 --- a/test/integration/expression/tests/to-string/basic/test.json +++ b/test/integration/expression/tests/to-string/basic/test.json @@ -1,12 +1,65 @@ { - "expression": ["to-string", ["get", "x"]], + "expression": [ + "to-string", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": 1}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": null}}], - [{}, {"properties": {"x": "string"}}], - [{}, {"properties": {"x": [1, 2]}}], - [{}, {"properties": {"x": {"y": 1}}}] + [ + {}, + { + "properties": { + "x": 1 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": { + "x": "string" + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": { + "y": 1 + } + } + } + ] ], "expected": { "compiled": { @@ -15,6 +68,13 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["1", "false", "", "string", "[1,2]", "{\"y\":1}"] + "outputs": [ + "1", + "false", + "", + "string", + "[1,2]", + "{\"y\":1}" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-string/color/test.json b/test/integration/expression/tests/to-string/color/test.json index 29d0afff2..845757d01 100644 --- a/test/integration/expression/tests/to-string/color/test.json +++ b/test/integration/expression/tests/to-string/color/test.json @@ -1,6 +1,20 @@ { - "expression": ["to-string", ["rgba", 85, 255, 0, 0.5]], - "inputs": [[{}, {}]], + "expression": [ + "to-string", + [ + "rgba", + 85, + 255, + 0, + 0.5 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +22,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["rgba(85,255,0,0.5)"] + "outputs": [ + "rgba(85,255,0,0.5)" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/to-string/implicit/test.json b/test/integration/expression/tests/to-string/implicit/test.json index 29366bdeb..ab6d9d880 100644 --- a/test/integration/expression/tests/to-string/implicit/test.json +++ b/test/integration/expression/tests/to-string/implicit/test.json @@ -1,10 +1,42 @@ { - "expression": ["get", "p"], - "propertySpec": {"type": "string"}, + "expression": [ + "get", + "p" + ], + "propertySpec": { + "type": "string", + "property-type": "data-driven", + "expression": { + "interpolated": true, + "parameters": [ + "zoom", + "feature" + ] + } + }, "inputs": [ - [{}, {"properties": {}}], - [{}, {"properties": {"p": 0}}], - [{}, {"properties": {"p": "a"}}] + [ + {}, + { + "properties": {} + } + ], + [ + {}, + { + "properties": { + "p": 0 + } + } + ], + [ + {}, + { + "properties": { + "p": "a" + } + } + ] ], "expected": { "compiled": { @@ -13,6 +45,10 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["", "0", "a"] + "outputs": [ + "", + "0", + "a" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typecheck/array-invalid-item/test.json b/test/integration/expression/tests/typecheck/array-invalid-item/test.json index 07c9f8f17..f8dcf1bf1 100644 --- a/test/integration/expression/tests/typecheck/array-invalid-item/test.json +++ b/test/integration/expression/tests/typecheck/array-invalid-item/test.json @@ -4,9 +4,22 @@ "value": "string", "length": 2, "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["array", "number", 2, ["get", "x"]], + "expression": [ + "array", + "number", + 2, + [ + "get", + "x" + ] + ], "inputs": [], "expected": { "compiled": { @@ -19,4 +32,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typecheck/array-item-subtyping/test.json b/test/integration/expression/tests/typecheck/array-item-subtyping/test.json index 5d16a179c..db59e0caf 100644 --- a/test/integration/expression/tests/typecheck/array-item-subtyping/test.json +++ b/test/integration/expression/tests/typecheck/array-item-subtyping/test.json @@ -2,9 +2,22 @@ "propertySpec": { "type": "array", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["array", "number", 2, ["get", "x"]], + "expression": [ + "array", + "number", + 2, + [ + "get", + "x" + ] + ], "inputs": [], "expected": { "compiled": { @@ -15,4 +28,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typecheck/array-length-subtyping--no-length/test.json b/test/integration/expression/tests/typecheck/array-length-subtyping--no-length/test.json index d180e38ba..ae04c4a62 100644 --- a/test/integration/expression/tests/typecheck/array-length-subtyping--no-length/test.json +++ b/test/integration/expression/tests/typecheck/array-length-subtyping--no-length/test.json @@ -4,9 +4,21 @@ "value": "number", "length": 3, "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["array", "number", ["get", "x"]], + "expression": [ + "array", + "number", + [ + "get", + "x" + ] + ], "inputs": [], "expected": { "compiled": { @@ -19,4 +31,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typecheck/array-length-subtyping/test.json b/test/integration/expression/tests/typecheck/array-length-subtyping/test.json index 9ec400a79..0cf39f193 100644 --- a/test/integration/expression/tests/typecheck/array-length-subtyping/test.json +++ b/test/integration/expression/tests/typecheck/array-length-subtyping/test.json @@ -3,9 +3,22 @@ "type": "array", "value": "string", "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["array", "string", 2, ["get", "x"]], + "expression": [ + "array", + "string", + 2, + [ + "get", + "x" + ] + ], "inputs": [], "expected": { "compiled": { @@ -16,4 +29,4 @@ }, "outputs": [] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typecheck/array-wrong-length/test.json b/test/integration/expression/tests/typecheck/array-wrong-length/test.json index a5e08bd02..6b6762c2a 100644 --- a/test/integration/expression/tests/typecheck/array-wrong-length/test.json +++ b/test/integration/expression/tests/typecheck/array-wrong-length/test.json @@ -4,9 +4,22 @@ "value": "number", "length": 3, "property-type": "data-driven", - "expression": {"parameters": ["zoom", "feature"]} + "expression": { + "parameters": [ + "zoom", + "feature" + ] + } }, - "expression": ["array", "number", 2, ["get", "x"]], + "expression": [ + "array", + "number", + 2, + [ + "get", + "x" + ] + ], "inputs": [], "expected": { "compiled": { @@ -19,4 +32,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/typeof/basic/test.json b/test/integration/expression/tests/typeof/basic/test.json index 7bf9b52ed..7f8a16d82 100644 --- a/test/integration/expression/tests/typeof/basic/test.json +++ b/test/integration/expression/tests/typeof/basic/test.json @@ -1,15 +1,98 @@ { - "expression": ["typeof", ["get", "x"]], + "expression": [ + "typeof", + [ + "get", + "x" + ] + ], "inputs": [ - [{}, {"properties": {"x": null}}], - [{}, {"properties": {"x": "s"}}], - [{}, {"properties": {"x": 0}}], - [{}, {"properties": {"x": false}}], - [{}, {"properties": {"x": [1, 2, 3]}}], - [{}, {"properties": {"x": ["a", "b", "c"]}}], - [{}, {"properties": {"x": [true, false]}}], - [{}, {"properties": {"x": [1, false]}}], - [{}, {"properties": {"x": {}}}] + [ + {}, + { + "properties": { + "x": null + } + } + ], + [ + {}, + { + "properties": { + "x": "s" + } + } + ], + [ + {}, + { + "properties": { + "x": 0 + } + } + ], + [ + {}, + { + "properties": { + "x": false + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + 2, + 3 + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + "a", + "b", + "c" + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + true, + false + ] + } + } + ], + [ + {}, + { + "properties": { + "x": [ + 1, + false + ] + } + } + ], + [ + {}, + { + "properties": { + "x": {} + } + } + ] ], "expected": { "compiled": { @@ -30,4 +113,4 @@ "object" ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/upcase/basic/test.json b/test/integration/expression/tests/upcase/basic/test.json index 92dc9f7e0..638dab9cb 100644 --- a/test/integration/expression/tests/upcase/basic/test.json +++ b/test/integration/expression/tests/upcase/basic/test.json @@ -1,6 +1,14 @@ { - "expression": ["upcase", "string"], - "inputs": [[{}, {}]], + "expression": [ + "upcase", + "string" + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +16,8 @@ "isZoomConstant": true, "type": "string" }, - "outputs": ["STRING"] + "outputs": [ + "STRING" + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/invalid-geojson/test.json b/test/integration/expression/tests/within/invalid-geojson/test.json index 4b89ba998..c197dc889 100644 --- a/test/integration/expression/tests/within/invalid-geojson/test.json +++ b/test/integration/expression/tests/within/invalid-geojson/test.json @@ -1,20 +1,91 @@ { "expression": [ "within", - {"type": "LineString", "coordinates": [[0, 0], [0, 5], [5, 5], [5, 0]]} + { + "type": "LineString", + "coordinates": [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 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": [ + 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": "Point", + "coordinates": [ + 2, + 2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [4, 1]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 4, + 1 + ] + ] + } + } ] ], "expected": { @@ -28,4 +99,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/line-within-collection-of-multipolygons/test.json b/test/integration/expression/tests/within/line-within-collection-of-multipolygons/test.json index 1764f7524..826a0abb0 100644 --- a/test/integration/expression/tests/within/line-within-collection-of-multipolygons/test.json +++ b/test/integration/expression/tests/within/line-within-collection-of-multipolygons/test.json @@ -1,62 +1,264 @@ { - "expression": [ - "within", - { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]], - [[[10, 10], [10, 15], [15, 15], [15, 10], [10, 10]]] - ] - } - }, - { - "type": "Feature", - "geometry": { - "type": "MultiPolygon", - "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[0, 10], [0, 15], [5, 15], [5, 10], [0, 10]]] - ] - } - } - ] + "expression": [ + "within", + { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + 10, + 0 + ], + [ + 10, + 5 + ], + [ + 15, + 5 + ], + [ + 15, + 0 + ], + [ + 10, + 0 + ] + ] + ], + [ + [ + [ + 10, + 10 + ], + [ + 10, + 15 + ], + [ + 15, + 15 + ], + [ + 15, + 10 + ], + [ + 10, + 10 + ] + ] + ] + ] + } + }, + { + "type": "Feature", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 0, + 10 + ], + [ + 0, + 15 + ], + [ + 5, + 15 + ], + [ + 5, + 10 + ], + [ + 0, + 10 + ] + ] + ] + ] + } + } + ] + } + ], + "inputs": [ + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 1, + 1 + ], + [ + 4, + 4 + ] + ] + } } ], - "inputs": [ - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[1, 1], [4, 4]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [6, 6]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[11, 1], [14, 4]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[14, 14], [11, 12]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [13, 13]]}} - ] + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 6, + 6 + ] + ] + } + } ], - "expected": { - "compiled": { - "result": "success", - "isFeatureConstant": false, - "isZoomConstant": true, - "type": "boolean" + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } }, - "outputs": [true, false, true, true, false] - } + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 11, + 1 + ], + [ + 14, + 4 + ] + ] + } + } + ], + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 14, + 14 + ], + [ + 11, + 12 + ] + ] + } + } + ], + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 13, + 13 + ] + ] + } + } + ] + ], + "expected": { + "compiled": { + "result": "success", + "isFeatureConstant": false, + "isZoomConstant": true, + "type": "boolean" + }, + "outputs": [ + true, + false, + true, + true, + false + ] } - \ No newline at end of file +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/line-within-collection-of-polygons/test.json b/test/integration/expression/tests/within/line-within-collection-of-polygons/test.json index fdec2a4c0..ed6ae7fa0 100644 --- a/test/integration/expression/tests/within/line-within-collection-of-polygons/test.json +++ b/test/integration/expression/tests/within/line-within-collection-of-polygons/test.json @@ -1,56 +1,212 @@ { - "expression": [ - "within", - { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]] - } - }, - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] - } - } - ] + "expression": [ + "within", + { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 10, + 0 + ], + [ + 10, + 5 + ], + [ + 15, + 5 + ], + [ + 15, + 0 + ], + [ + 10, + 0 + ] + ] + ] + } + }, + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] + } + } + ] + } + ], + "inputs": [ + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 1, + 1 + ], + [ + 4, + 4 + ] + ] + } } ], - "inputs": [ - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[1, 1], [4, 4]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [6, 6]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[11, 1], [14, 4]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[11, 1], [16, 4]]}} - ], - [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [13, 3]]}} - ] + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 6, + 6 + ] + ] + } + } ], - "expected": { - "compiled": { - "result": "success", - "isFeatureConstant": false, - "isZoomConstant": true, - "type": "boolean" + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } }, - "outputs": [true, false, true, false, false] - } + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 11, + 1 + ], + [ + 14, + 4 + ] + ] + } + } + ], + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 11, + 1 + ], + [ + 16, + 4 + ] + ] + } + } + ], + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 13, + 3 + ] + ] + } + } + ] + ], + "expected": { + "compiled": { + "result": "success", + "isFeatureConstant": false, + "isZoomConstant": true, + "type": "boolean" + }, + "outputs": [ + true, + false, + true, + false, + false + ] } - \ No newline at end of file +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/line-within-polygon/test.json b/test/integration/expression/tests/within/line-within-polygon/test.json index 4238daa20..2e441cd05 100644 --- a/test/integration/expression/tests/within/line-within-polygon/test.json +++ b/test/integration/expression/tests/within/line-within-polygon/test.json @@ -3,17 +3,82 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [4, 1]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 4, + 1 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [6, 6]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 6, + 6 + ] + ] + } + } ] ], "expected": { @@ -23,6 +88,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false] + "outputs": [ + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/line-within-polygons/test.json b/test/integration/expression/tests/within/line-within-polygons/test.json index 6f3594564..0c1e4d186 100644 --- a/test/integration/expression/tests/within/line-within-polygons/test.json +++ b/test/integration/expression/tests/within/line-within-polygons/test.json @@ -4,31 +4,182 @@ { "type": "MultiPolygon", "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[0, 0], [-3, 0], [-3, -3], [0, -3], [0, 0]]] + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 0, + 0 + ], + [ + -3, + 0 + ], + [ + -3, + -3 + ], + [ + 0, + -3 + ], + [ + 0, + 0 + ] + ] + ] ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [4, 1]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + 4, + 1 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[3, 3], [-2, -2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 3, + 3 + ], + [ + -2, + -2 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[0, 0], [2, 2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 0, + 0 + ], + [ + 2, + 2 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[1, 3], [-2, -2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 1, + 3 + ], + [ + -2, + -2 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "LineString", "coordinates": [[-1, -1], [-2, -2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -1, + -1 + ], + [ + -2, + -2 + ] + ] + } + } ] ], "expected": { @@ -38,6 +189,12 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, false, false, true] + "outputs": [ + true, + false, + false, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/lines-within-polygon/test.json b/test/integration/expression/tests/within/lines-within-polygon/test.json index fde30da9d..ffaa289eb 100644 --- a/test/integration/expression/tests/within/lines-within-polygon/test.json +++ b/test/integration/expression/tests/within/lines-within-polygon/test.json @@ -3,25 +3,108 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiLineString", - "coordinates": [[[3, 3], [4, 1]], [[-2, -2], [-1, -1]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 4, + 1 + ] + ], + [ + [ + -2, + -2 + ], + [ + -1, + -1 + ] + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiLineString", - "coordinates": [[[3, 3], [2, 2]], [[1, 1], [2, 2], [3, 2]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 2, + 2 + ] + ], + [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + [ + 3, + 2 + ] + ] + ] } } ] @@ -33,6 +116,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true] + "outputs": [ + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/lines-within-polygons/test.json b/test/integration/expression/tests/within/lines-within-polygons/test.json index e0577cda4..011737c89 100644 --- a/test/integration/expression/tests/within/lines-within-polygons/test.json +++ b/test/integration/expression/tests/within/lines-within-polygons/test.json @@ -4,36 +4,174 @@ { "type": "MultiPolygon", "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[0, 0], [-3, 0], [-3, -3], [0, -3], [0, 0]]] + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 0, + 0 + ], + [ + -3, + 0 + ], + [ + -3, + -3 + ], + [ + 0, + -3 + ], + [ + 0, + 0 + ] + ] + ] ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiLineString", - "coordinates": [[[3, 3], [4, 1]], [[-2, -2], [-1, -1]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 4, + 1 + ] + ], + [ + [ + -2, + -2 + ], + [ + -1, + -1 + ] + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiLineString", - "coordinates": [[[3, 3], [2, 2]], [[1, 1], [2, 2], [3, 2]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 2, + 2 + ] + ], + [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + [ + 3, + 2 + ] + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiLineString", - "coordinates": [[[3, 3], [2, 2]], [[-1, 1], [2, 2], [3, 2]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 2, + 2 + ] + ], + [ + [ + -1, + 1 + ], + [ + 2, + 2 + ], + [ + 3, + 2 + ] + ] + ] } } ] @@ -45,6 +183,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, false] + "outputs": [ + true, + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/meridian-issue-line-1/test.json b/test/integration/expression/tests/within/meridian-issue-line-1/test.json index b9b8c9c83..61c2df874 100644 --- a/test/integration/expression/tests/within/meridian-issue-line-1/test.json +++ b/test/integration/expression/tests/within/meridian-issue-line-1/test.json @@ -3,22 +3,82 @@ "within", { "type": "Polygon", - "coordinates": [[[-190, 0], [-178, 0], [-178, 10], [-190, 10], [-190, 0]]] + "coordinates": [ + [ + [ + -190, + 0 + ], + [ + -178, + 0 + ], + [ + -178, + 10 + ], + [ + -190, + 10 + ], + [ + -190, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "LineString", - "coordinates": [[-183, 5], [-179, 1]] + "coordinates": [ + [ + -183, + 5 + ], + [ + -179, + 1 + ] + ] } } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "LineString", "coordinates": [[-183, 5], [181, 1]]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -183, + 5 + ], + [ + 181, + 1 + ] + ] + } + } ] ], "expected": { @@ -28,6 +88,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false] + "outputs": [ + true, + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/meridian-issue-line-2/test.json b/test/integration/expression/tests/within/meridian-issue-line-2/test.json index cce591141..d90937218 100644 --- a/test/integration/expression/tests/within/meridian-issue-line-2/test.json +++ b/test/integration/expression/tests/within/meridian-issue-line-2/test.json @@ -4,35 +4,104 @@ { "type": "Polygon", "coordinates": [ - [[-185, 60], [175, 60], [175, 65], [-185, 65], [-185, 60]] + [ + [ + -185, + 60 + ], + [ + 175, + 60 + ], + [ + 175, + 65 + ], + [ + -185, + 65 + ], + [ + -185, + 60 + ] + ] ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "LineString", - "coordinates": [[-183, 61], [-179, 62]] + "coordinates": [ + [ + -183, + 61 + ], + [ + -179, + 62 + ] + ] } } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "LineString", - "coordinates": [[-183, 61], [181, 63]] + "coordinates": [ + [ + -183, + 61 + ], + [ + 181, + 63 + ] + ] } } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "LineString", - "coordinates": [[-183, 62], [55, 63.5]] + "coordinates": [ + [ + -183, + 62 + ], + [ + 55, + 63.5 + ] + ] } } ] @@ -44,6 +113,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, false, true] + "outputs": [ + true, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/meridian-issue-point-1/test.json b/test/integration/expression/tests/within/meridian-issue-point-1/test.json index f7e1de13a..fc65bf37b 100644 --- a/test/integration/expression/tests/within/meridian-issue-point-1/test.json +++ b/test/integration/expression/tests/within/meridian-issue-point-1/test.json @@ -4,32 +4,100 @@ { "type": "Polygon", "coordinates": [ - [[-185, 60], [-175, 60], [-175, 65], [-185, 65], [-185, 60]] + [ + [ + -185, + 60 + ], + [ + -175, + 60 + ], + [ + -175, + 65 + ], + [ + -185, + 65 + ], + [ + -185, + 60 + ] + ] ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "MultiPoint", - "coordinates": [[-183, 62], [-179, 63]] + "coordinates": [ + [ + -183, + 62 + ], + [ + -179, + 63 + ] + ] } } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, { "geometry": { "type": "MultiPoint", - "coordinates": [[-183, 62], [181, 63]] + "coordinates": [ + [ + -183, + 62 + ], + [ + 181, + 63 + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 7, "y": 2}}, - {"geometry": {"type": "Point", "coordinates": [177, 62.5]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 7, + "y": 2 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 177, + 62.5 + ] + } + } ] ], "expected": { @@ -39,6 +107,10 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, true] + "outputs": [ + true, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/meridian-issue-point-2/test.json b/test/integration/expression/tests/within/meridian-issue-point-2/test.json index 8a9c64186..325549ea0 100644 --- a/test/integration/expression/tests/within/meridian-issue-point-2/test.json +++ b/test/integration/expression/tests/within/meridian-issue-point-2/test.json @@ -3,25 +3,108 @@ "within", { "type": "Polygon", - "coordinates": [[[-360, 60], [0, 60], [0, 65], [-360, 65], [-360, 60]]] + "coordinates": [ + [ + [ + -360, + 60 + ], + [ + 0, + 60 + ], + [ + 0, + 65 + ], + [ + -360, + 65 + ], + [ + -360, + 60 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [-183, 61]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -183, + 61 + ] + } + } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [-361, 61]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -361, + 61 + ] + } + } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [183, 62]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 183, + 62 + ] + } + } ], [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [55, 62]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 55, + 62 + ] + } + } ] ], "expected": { @@ -31,6 +114,11 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [true, true, true, true] + "outputs": [ + true, + true, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/non-supported/test.json b/test/integration/expression/tests/within/non-supported/test.json index 3a7516c20..8ade986af 100644 --- a/test/integration/expression/tests/within/non-supported/test.json +++ b/test/integration/expression/tests/within/non-supported/test.json @@ -3,16 +3,61 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "Polygon", - "coordinates": [[[3, 3], [6, 6], [3, 3]]] + "coordinates": [ + [ + [ + 3, + 3 + ], + [ + 6, + 6 + ], + [ + 3, + 3 + ] + ] + ] } } ] @@ -24,6 +69,8 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false] + "outputs": [ + false + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-on-boundary-1/test.json b/test/integration/expression/tests/within/point-on-boundary-1/test.json index a6ee9d470..c6d3cdf34 100644 --- a/test/integration/expression/tests/within/point-on-boundary-1/test.json +++ b/test/integration/expression/tests/within/point-on-boundary-1/test.json @@ -3,85 +3,393 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 1, "canonicalID": {"z": 1, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 1, + "canonicalID": { + "z": 1, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 2, "canonicalID": {"z": 2, "x": 2, "y": 2}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 2, + "canonicalID": { + "z": 2, + "x": 2, + "y": 2 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 4, "canonicalID": {"z": 4, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 4, + "canonicalID": { + "z": 4, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 5, "canonicalID": {"z": 5, "x": 16, "y": 16}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 5, + "canonicalID": { + "z": 5, + "x": 16, + "y": 16 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 6, "canonicalID": {"z": 6, "x": 32, "y": 32}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 6, + "canonicalID": { + "z": 6, + "x": 32, + "y": 32 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 7, "canonicalID": {"z": 7, "x": 65, "y": 63}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 7, + "canonicalID": { + "z": 7, + "x": 65, + "y": 63 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 8, "canonicalID": {"z": 8, "x": 131, "y": 124}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 8, + "canonicalID": { + "z": 8, + "x": 131, + "y": 124 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 9, "canonicalID": {"z": 9, "x": 263, "y": 248}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 9, + "canonicalID": { + "z": 9, + "x": 263, + "y": 248 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 10, "canonicalID": {"z": 10, "x": 526, "y": 497}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 10, + "canonicalID": { + "z": 10, + "x": 526, + "y": 497 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 11, "canonicalID": {"z": 11, "x": 1052, "y": 995}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 11, + "canonicalID": { + "z": 11, + "x": 1052, + "y": 995 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 12, "canonicalID": {"z": 12, "x": 2104, "y": 1991}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 12, + "canonicalID": { + "z": 12, + "x": 2104, + "y": 1991 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 13, "canonicalID": {"z": 13, "x": 4209, "y": 3982}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 4209, + "y": 3982 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 14, "canonicalID": {"z": 14, "x": 8419, "y": 7964}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 14, + "canonicalID": { + "z": 14, + "x": 8419, + "y": 7964 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 15, "canonicalID": {"z": 15, "x": 16839, "y": 15928}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 15, + "canonicalID": { + "z": 15, + "x": 16839, + "y": 15928 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 16, "canonicalID": {"z": 16, "x": 33678, "y": 31856}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 16, + "canonicalID": { + "z": 16, + "x": 33678, + "y": 31856 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 17, "canonicalID": {"z": 17, "x": 67356, "y": 67313}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 17, + "canonicalID": { + "z": 17, + "x": 67356, + "y": 67313 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ], [ - {"zoom": 18, "canonicalID": {"z": 18, "x": 134712, "y": 127426}}, - {"geometry": {"type": "Point", "coordinates": [5, 5]}} + { + "zoom": 18, + "canonicalID": { + "z": 18, + "x": 134712, + "y": 127426 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 5, + 5 + ] + } + } ] ], "expected": { @@ -113,4 +421,4 @@ false ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-on-boundary-2/test.json b/test/integration/expression/tests/within/point-on-boundary-2/test.json index cffefe786..69dbf40f6 100644 --- a/test/integration/expression/tests/within/point-on-boundary-2/test.json +++ b/test/integration/expression/tests/within/point-on-boundary-2/test.json @@ -3,85 +3,393 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 1, "canonicalID": {"z": 1, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 1, + "canonicalID": { + "z": 1, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 2, "canonicalID": {"z": 2, "x": 2, "y": 2}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 2, + "canonicalID": { + "z": 2, + "x": 2, + "y": 2 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 4, "canonicalID": {"z": 4, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 4, + "canonicalID": { + "z": 4, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 5, "canonicalID": {"z": 5, "x": 16, "y": 16}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 5, + "canonicalID": { + "z": 5, + "x": 16, + "y": 16 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 6, "canonicalID": {"z": 6, "x": 32, "y": 32}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 6, + "canonicalID": { + "z": 6, + "x": 32, + "y": 32 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 7, "canonicalID": {"z": 7, "x": 65, "y": 63}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 7, + "canonicalID": { + "z": 7, + "x": 65, + "y": 63 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 8, "canonicalID": {"z": 8, "x": 131, "y": 126}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 8, + "canonicalID": { + "z": 8, + "x": 131, + "y": 126 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 9, "canonicalID": {"z": 9, "x": 261, "y": 261}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 9, + "canonicalID": { + "z": 9, + "x": 261, + "y": 261 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 10, "canonicalID": {"z": 10, "x": 512, "y": 503}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 10, + "canonicalID": { + "z": 10, + "x": 512, + "y": 503 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 11, "canonicalID": {"z": 11, "x": 1024, "y": 1006}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 11, + "canonicalID": { + "z": 11, + "x": 1024, + "y": 1006 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 12, "canonicalID": {"z": 12, "x": 2048, "y": 2013}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 12, + "canonicalID": { + "z": 12, + "x": 2048, + "y": 2013 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 13, "canonicalID": {"z": 13, "x": 4096, "y": 4027}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 4096, + "y": 4027 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 14, "canonicalID": {"z": 14, "x": 8192, "y": 8055}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 14, + "canonicalID": { + "z": 14, + "x": 8192, + "y": 8055 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 15, "canonicalID": {"z": 15, "x": 16384, "y": 16110}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 15, + "canonicalID": { + "z": 15, + "x": 16384, + "y": 16110 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 16, "canonicalID": {"z": 16, "x": 32768, "y": 32221}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 16, + "canonicalID": { + "z": 16, + "x": 32768, + "y": 32221 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 17, "canonicalID": {"z": 17, "x": 65536, "y": 64443}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 17, + "canonicalID": { + "z": 17, + "x": 65536, + "y": 64443 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ], [ - {"zoom": 18, "canonicalID": {"z": 18, "x": 131072, "y": 128888}}, - {"geometry": {"type": "Point", "coordinates": [0, 3]}} + { + "zoom": 18, + "canonicalID": { + "z": 18, + "x": 131072, + "y": 128888 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 0, + 3 + ] + } + } ] ], "expected": { @@ -113,4 +421,4 @@ false ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-on-boundary-3/test.json b/test/integration/expression/tests/within/point-on-boundary-3/test.json index c6014efc5..9af38c2f1 100644 --- a/test/integration/expression/tests/within/point-on-boundary-3/test.json +++ b/test/integration/expression/tests/within/point-on-boundary-3/test.json @@ -3,85 +3,393 @@ "within", { "type": "Polygon", - "coordinates": [[[-10, -10], [10, -10], [10, 10], [-10, 10], [-10, -10]]] + "coordinates": [ + [ + [ + -10, + -10 + ], + [ + 10, + -10 + ], + [ + 10, + 10 + ], + [ + -10, + 10 + ], + [ + -10, + -10 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 0, "canonicalID": {"z": 0, "x": 0, "y": 0}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 0, + "canonicalID": { + "z": 0, + "x": 0, + "y": 0 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 1, "canonicalID": {"z": 1, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 1, + "canonicalID": { + "z": 1, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 2, "canonicalID": {"z": 2, "x": 2, "y": 2}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 2, + "canonicalID": { + "z": 2, + "x": 2, + "y": 2 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 4, "canonicalID": {"z": 4, "x": 1, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 4, + "canonicalID": { + "z": 4, + "x": 1, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 5, "canonicalID": {"z": 5, "x": 16, "y": 16}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 5, + "canonicalID": { + "z": 5, + "x": 16, + "y": 16 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 6, "canonicalID": {"z": 6, "x": 32, "y": 32}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 6, + "canonicalID": { + "z": 6, + "x": 32, + "y": 32 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 7, "canonicalID": {"z": 7, "x": 65, "y": 63}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 7, + "canonicalID": { + "z": 7, + "x": 65, + "y": 63 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 8, "canonicalID": {"z": 8, "x": 135, "y": 135}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 8, + "canonicalID": { + "z": 8, + "x": 135, + "y": 135 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 9, "canonicalID": {"z": 9, "x": 270, "y": 270}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 9, + "canonicalID": { + "z": 9, + "x": 270, + "y": 270 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 10, "canonicalID": {"z": 10, "x": 540, "y": 540}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 10, + "canonicalID": { + "z": 10, + "x": 540, + "y": 540 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 11, "canonicalID": {"z": 11, "x": 1080, "y": 1081}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 11, + "canonicalID": { + "z": 11, + "x": 1080, + "y": 1081 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 12, "canonicalID": {"z": 12, "x": 2161, "y": 2162}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 12, + "canonicalID": { + "z": 12, + "x": 2161, + "y": 2162 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 13, "canonicalID": {"z": 13, "x": 4323, "y": 4324}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 4323, + "y": 4324 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 14, "canonicalID": {"z": 14, "x": 8650, "y": 8650}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 14, + "canonicalID": { + "z": 14, + "x": 8650, + "y": 8650 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 15, "canonicalID": {"z": 15, "x": 17295, "y": 17298}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 15, + "canonicalID": { + "z": 15, + "x": 17295, + "y": 17298 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 16, "canonicalID": {"z": 16, "x": 34588, "y": 34597}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 16, + "canonicalID": { + "z": 16, + "x": 34588, + "y": 34597 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 17, "canonicalID": {"z": 17, "x": 69176, "y": 69195}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 17, + "canonicalID": { + "z": 17, + "x": 69176, + "y": 69195 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ], [ - {"zoom": 18, "canonicalID": {"z": 18, "x": 138353, "y": 138391}}, - {"geometry": {"type": "Point", "coordinates": [10, -10]}} + { + "zoom": 18, + "canonicalID": { + "z": 18, + "x": 138353, + "y": 138391 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 10, + -10 + ] + } + } ] ], "expected": { @@ -113,4 +421,4 @@ false ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-within-collection-of-multipolygons/test.json b/test/integration/expression/tests/within/point-within-collection-of-multipolygons/test.json index a0cebce3b..2597d51eb 100644 --- a/test/integration/expression/tests/within/point-within-collection-of-multipolygons/test.json +++ b/test/integration/expression/tests/within/point-within-collection-of-multipolygons/test.json @@ -9,8 +9,54 @@ "geometry": { "type": "MultiPolygon", "coordinates": [ - [[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]], - [[[110, 0], [110, 5], [115, 5], [115, 0], [110, 0]]] + [ + [ + [ + 10, + 0 + ], + [ + 10, + 5 + ], + [ + 15, + 5 + ], + [ + 15, + 0 + ], + [ + 10, + 0 + ] + ] + ], + [ + [ + [ + 110, + 0 + ], + [ + 110, + 5 + ], + [ + 115, + 5 + ], + [ + 115, + 0 + ], + [ + 110, + 0 + ] + ] + ] ] } }, @@ -19,8 +65,54 @@ "geometry": { "type": "MultiPolygon", "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[50, 0], [50, 5], [55, 5], [55, 0], [50, 0]]] + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 50, + 0 + ], + [ + 50, + 5 + ], + [ + 55, + 5 + ], + [ + 55, + 0 + ], + [ + 50, + 0 + ] + ] + ] ] } } @@ -29,28 +121,118 @@ ], "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": [ + 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": "Point", + "coordinates": [ + 2, + 2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [12, 2]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 12, + 2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [22, 2]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 22, + 2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [52, 2]}} - ], + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 52, + 2 + ] + } + } + ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [112, 2]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 112, + 2 + ] + } + } ] ], "expected": { @@ -60,6 +242,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, false, true, true] + "outputs": [ + false, + true, + true, + false, + true, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-within-collection-of-polygons/test.json b/test/integration/expression/tests/within/point-within-collection-of-polygons/test.json index e1151490d..d46ae9fa6 100644 --- a/test/integration/expression/tests/within/point-within-collection-of-polygons/test.json +++ b/test/integration/expression/tests/within/point-within-collection-of-polygons/test.json @@ -1,48 +1,142 @@ { - "expression": [ - "within", + "expression": [ + "within", + { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 10, + 0 + ], + [ + 10, + 5 + ], + [ + 15, + 5 + ], + [ + 15, + 0 + ], + [ + 10, + 0 + ] + ] + ] + } + }, + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] + } + } + ] + } + ], + "inputs": [ + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[[10, 0], [10, 5], [15, 5], [15, 0], [10, 0]]] - } - }, - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] - } - } - ] + "geometry": { + "type": "Point", + "coordinates": [ + 6, + 6 + ] + } } ], - "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": "Point", "coordinates": [12, 2]}} - ] + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 2, + 2 + ] + } + } ], - "expected": { - "compiled": { - "result": "success", - "isFeatureConstant": false, - "isZoomConstant": true, - "type": "boolean" + [ + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } }, - "outputs": [false, true, true] - } + { + "geometry": { + "type": "Point", + "coordinates": [ + 12, + 2 + ] + } + } + ] + ], + "expected": { + "compiled": { + "result": "success", + "isFeatureConstant": false, + "isZoomConstant": true, + "type": "boolean" + }, + "outputs": [ + false, + true, + true + ] } - \ No newline at end of file +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-within-polygon/test.json b/test/integration/expression/tests/within/point-within-polygon/test.json index 813d02e5b..fd2c8dc41 100644 --- a/test/integration/expression/tests/within/point-within-polygon/test.json +++ b/test/integration/expression/tests/within/point-within-polygon/test.json @@ -3,17 +3,70 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "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": [ + 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": "Point", + "coordinates": [ + 2, + 2 + ] + } + } ] ], "expected": { @@ -23,6 +76,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true] + "outputs": [ + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/point-within-polygons/test.json b/test/integration/expression/tests/within/point-within-polygons/test.json index 6797f26fc..541dec461 100644 --- a/test/integration/expression/tests/within/point-within-polygons/test.json +++ b/test/integration/expression/tests/within/point-within-polygons/test.json @@ -4,39 +4,190 @@ { "type": "MultiPolygon", "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[0, 0], [-3, 0], [-3, -3], [0, -3], [0, 0]]] + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 0, + 0 + ], + [ + -3, + 0 + ], + [ + -3, + -3 + ], + [ + 0, + -3 + ], + [ + 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": [ + 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": "Point", + "coordinates": [ + 2, + 2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [3, 4]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 3, + 4 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [-1, 3]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -1, + 3 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 0, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [-1, -5]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 0, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -1, + -5 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 5, "x": 3, "y": 3}}, - {"geometry": {"type": "Point", "coordinates": [2, -2]}} + { + "zoom": 3, + "canonicalID": { + "z": 5, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + 2, + -2 + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 2, "x": 0, "y": 1}}, - {"geometry": {"type": "Point", "coordinates": [-2, -2]}} + { + "zoom": 3, + "canonicalID": { + "z": 2, + "x": 0, + "y": 1 + } + }, + { + "geometry": { + "type": "Point", + "coordinates": [ + -2, + -2 + ] + } + } ] ], "expected": { @@ -46,6 +197,14 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, false, false, false, true] + "outputs": [ + false, + true, + true, + false, + false, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/points-within-polygon/test.json b/test/integration/expression/tests/within/points-within-polygon/test.json index 1a0b0b926..0b3d2e2c4 100644 --- a/test/integration/expression/tests/within/points-within-polygon/test.json +++ b/test/integration/expression/tests/within/points-within-polygon/test.json @@ -3,22 +3,86 @@ "within", { "type": "Polygon", - "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + "coordinates": [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { "geometry": { "type": "MultiPoint", - "coordinates": [[6, 6], [3, 4], [2, 2]] + "coordinates": [ + [ + 6, + 6 + ], + [ + 3, + 4 + ], + [ + 2, + 2 + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[2, 2], [3, 3]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + 2, + 2 + ], + [ + 3, + 3 + ] + ] + } + } ] ], "expected": { @@ -28,6 +92,9 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true] + "outputs": [ + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/within/points-within-polygons/test.json b/test/integration/expression/tests/within/points-within-polygons/test.json index 5df1f680c..b567f9b00 100644 --- a/test/integration/expression/tests/within/points-within-polygons/test.json +++ b/test/integration/expression/tests/within/points-within-polygons/test.json @@ -4,40 +4,211 @@ { "type": "MultiPolygon", "coordinates": [ - [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]], - [[[0, 0], [-3, 0], [-3, -3], [0, -3], [0, 0]]] + [ + [ + [ + 0, + 0 + ], + [ + 0, + 5 + ], + [ + 5, + 5 + ], + [ + 5, + 0 + ], + [ + 0, + 0 + ] + ] + ], + [ + [ + [ + 0, + 0 + ], + [ + -3, + 0 + ], + [ + -3, + -3 + ], + [ + 0, + -3 + ], + [ + 0, + 0 + ] + ] + ] ] } ], "inputs": [ [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[6, 6], [2, 2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + 6, + 6 + ], + [ + 2, + 2 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[2, 2], [3, 3]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + 2, + 2 + ], + [ + 3, + 3 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[3, 4], [-2, -2]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + 3, + 4 + ], + [ + -2, + -2 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 3, "y": 3}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[-1, 3], [1, 3]]}} + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + -1, + 3 + ], + [ + 1, + 3 + ] + ] + } + } ], [ - {"zoom": 3, "canonicalID": {"z": 3, "x": 0, "y": 1}}, + { + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 0, + "y": 1 + } + }, { "geometry": { "type": "MultiPoint", - "coordinates": [[2, 3], [-2, 3], [-2, -2]] + "coordinates": [ + [ + 2, + 3 + ], + [ + -2, + 3 + ], + [ + -2, + -2 + ] + ] } } ], [ - {"zoom": 3, "canonicalID": {"z": 5, "x": 15, "y": 16}}, - {"geometry": {"type": "MultiPoint", "coordinates": [[-2, -2], [-1, -1]]}} + { + "zoom": 3, + "canonicalID": { + "z": 5, + "x": 15, + "y": 16 + } + }, + { + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [ + -2, + -2 + ], + [ + -1, + -1 + ] + ] + } + } ] ], "expected": { @@ -47,6 +218,13 @@ "isZoomConstant": true, "type": "boolean" }, - "outputs": [false, true, true, false, false, true] + "outputs": [ + false, + true, + true, + false, + false, + true + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/basic/test.json b/test/integration/expression/tests/zoom/basic/test.json index c65208dd4..476af34e7 100644 --- a/test/integration/expression/tests/zoom/basic/test.json +++ b/test/integration/expression/tests/zoom/basic/test.json @@ -1,6 +1,25 @@ { - "expression": ["interpolate", ["linear"], ["zoom"], 0, 0, 30, 30], - "inputs": [[{"zoom": 5}, {}]], + "expression": [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 30, + 30 + ], + "inputs": [ + [ + { + "zoom": 5 + }, + {} + ] + ], "expected": { "compiled": { "result": "success", @@ -8,6 +27,8 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [5] + "outputs": [ + 5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-nested-1/test.json b/test/integration/expression/tests/zoom/invalid-nested-1/test.json index 1f2601017..8eb4706fd 100644 --- a/test/integration/expression/tests/zoom/invalid-nested-1/test.json +++ b/test/integration/expression/tests/zoom/invalid-nested-1/test.json @@ -1,6 +1,27 @@ { - "expression": ["+", 0.5, ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1]], - "inputs": [[{}, {}]], + "expression": [ + "+", + 0.5, + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ] + ], + "inputs": [ + [ + {}, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +33,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-nested-2/test.json b/test/integration/expression/tests/zoom/invalid-nested-2/test.json index 06947e70d..2652ffd3d 100644 --- a/test/integration/expression/tests/zoom/invalid-nested-2/test.json +++ b/test/integration/expression/tests/zoom/invalid-nested-2/test.json @@ -1,14 +1,35 @@ { "expression": [ "interpolate", - ["linear"], - ["zoom"], + [ + "linear" + ], + [ + "zoom" + ], 0, 0, 1, - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1] + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ] + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "error", @@ -20,4 +41,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-nested-3/test.json b/test/integration/expression/tests/zoom/invalid-nested-3/test.json index 277772c9d..afaebebf7 100644 --- a/test/integration/expression/tests/zoom/invalid-nested-3/test.json +++ b/test/integration/expression/tests/zoom/invalid-nested-3/test.json @@ -2,10 +2,39 @@ "expression": [ "let", "x", - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1], - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1] + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ], + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ] + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "error", @@ -17,4 +46,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-nested-4/test.json b/test/integration/expression/tests/zoom/invalid-nested-4/test.json index 7f8005a02..274e76a29 100644 --- a/test/integration/expression/tests/zoom/invalid-nested-4/test.json +++ b/test/integration/expression/tests/zoom/invalid-nested-4/test.json @@ -1,10 +1,39 @@ { "expression": [ "coalesce", - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1], - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1] + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ], + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ] + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "error", @@ -16,4 +45,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-nested-5/test.json b/test/integration/expression/tests/zoom/invalid-nested-5/test.json index d5e0619b9..656dc0e81 100644 --- a/test/integration/expression/tests/zoom/invalid-nested-5/test.json +++ b/test/integration/expression/tests/zoom/invalid-nested-5/test.json @@ -2,10 +2,34 @@ "expression": [ "let", "x", - ["interpolate", ["linear"], ["zoom"], 0, 0, 1, 1], - ["+", 0.5, ["get", "x"]] + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 1, + 1 + ], + [ + "+", + 0.5, + [ + "get", + "x" + ] + ] + ], + "inputs": [ + [ + {}, + {} + ] ], - "inputs": [[{}, {}]], "expected": { "compiled": { "result": "error", @@ -17,4 +41,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/invalid-no-curve/test.json b/test/integration/expression/tests/zoom/invalid-no-curve/test.json index dc90f8289..baa82f621 100644 --- a/test/integration/expression/tests/zoom/invalid-no-curve/test.json +++ b/test/integration/expression/tests/zoom/invalid-no-curve/test.json @@ -1,6 +1,19 @@ { - "expression": ["+", ["zoom"], 0], - "inputs": [[{"zoom": 5}, {}]], + "expression": [ + "+", + [ + "zoom" + ], + 0 + ], + "inputs": [ + [ + { + "zoom": 5 + }, + {} + ] + ], "expected": { "compiled": { "result": "error", @@ -12,4 +25,4 @@ ] } } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/nested-coalesce/test.json b/test/integration/expression/tests/zoom/nested-coalesce/test.json index 9392985a9..a421ea9f5 100644 --- a/test/integration/expression/tests/zoom/nested-coalesce/test.json +++ b/test/integration/expression/tests/zoom/nested-coalesce/test.json @@ -1,9 +1,28 @@ { "expression": [ "coalesce", - ["interpolate", ["linear"], ["zoom"], 0, 0, 30, 30] + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 30, + 30 + ] + ], + "inputs": [ + [ + { + "zoom": 5 + }, + {} + ] ], - "inputs": [[{"zoom": 5}, {}]], "expected": { "compiled": { "result": "success", @@ -11,6 +30,8 @@ "isZoomConstant": false, "type": "number" }, - "outputs": [5] + "outputs": [ + 5 + ] } -} +} \ No newline at end of file diff --git a/test/integration/expression/tests/zoom/nested-let/test.json b/test/integration/expression/tests/zoom/nested-let/test.json index 194b53acc..3a3706f5a 100644 --- a/test/integration/expression/tests/zoom/nested-let/test.json +++ b/test/integration/expression/tests/zoom/nested-let/test.json @@ -2,10 +2,40 @@ "expression": [ "let", "x", - ["number", ["get", "a"]], - ["interpolate", ["linear"], ["zoom"], 0, 0, 30, ["var", "x"]] + [ + "number", + [ + "get", + "a" + ] + ], + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 0, + 0, + 30, + [ + "var", + "x" + ] + ] + ], + "inputs": [ + [ + { + "zoom": 5 + }, + { + "a": 30 + } + ] ], - "inputs": [[{"zoom": 5}, {"a": 30}]], "expected": { "compiled": { "result": "success", @@ -14,7 +44,9 @@ "type": "number" }, "outputs": [ - {"error": "Expected value to be of type number, but found null instead."} + { + "error": "Expected value to be of type number, but found null instead." + } ] } -} +} \ No newline at end of file diff --git a/test/integration/style-spec/tests/numbers.output.json b/test/integration/style-spec/tests/numbers.output.json index 8fadd34d7..04c23b820 100644 --- a/test/integration/style-spec/tests/numbers.output.json +++ b/test/integration/style-spec/tests/numbers.output.json @@ -1,21 +1,21 @@ [ - { - "message": "layers[2].paint.circle-radius: -1 is less than the minimum value 0", - "line": 42 - }, - { - "message": "layers[3].paint.circle-radius: number expected, null found" - }, - { - "message": "layers[4].paint.circle-radius: missing required property \"stops\"", - "line": 58 - }, - { - "message": "layers[5].paint.circle-radius: number expected, array found", - "line": 66 - }, - { - "message": "layers[6].paint.circle-radius: number expected, boolean found", - "line": 74 - } -] + { + "message": "layers[2].paint.circle-radius: -1 is less than the minimum value 0", + "line": 42 + }, + { + "message": "layers[3].paint.circle-radius: number expected, null found" + }, + { + "message": "layers[4].paint.circle-radius: missing required property \"stops\"", + "line": 58 + }, + { + "message": "layers[5].paint.circle-radius: number expected, array found", + "line": 66 + }, + { + "message": "layers[6].paint.circle-radius: number expected, boolean found", + "line": 74 + } +] \ No newline at end of file diff --git a/test/integration/style-spec/tests/terrain.output.json b/test/integration/style-spec/tests/terrain.output.json index ec2f64284..a6aa436e4 100644 --- a/test/integration/style-spec/tests/terrain.output.json +++ b/test/integration/style-spec/tests/terrain.output.json @@ -7,4 +7,4 @@ "message": "exaggeration: number expected, string found", "line": 14 } -] +] \ No newline at end of file diff --git a/test/lib/util.ts b/test/lib/util.ts index 202ba3720..7d0b36f44 100644 --- a/test/lib/util.ts +++ b/test/lib/util.ts @@ -1,4 +1,3 @@ -import compactStringify from 'json-stringify-pretty-compact'; import Color from '../../src/util/color'; /** @@ -27,17 +26,3 @@ export function expectToMatchColor(toTest: Color, expectedSerialized: string, nu export function expectCloseToArray(toTest: number[], expected: number[], numDigits = 5) { expect(toTest).toEqual(expected.map(n => isNaN(n) ? n : expect.closeTo(n, numDigits))); } - -// we have to handle this edge case here because we have test fixtures for this -// edge case, and we don't want UPDATE=1 to mess with them -export function stringify(v) { - let s = compactStringify(v); - - if (s.indexOf('\u2028') >= 0) { - s = s.replace(/\u2028/g, '\\u2028'); - } - if (s.indexOf('\u2029') >= 0) { - s = s.replace(/\u2029/g, '\\u2029'); - } - return s; -}