From dafc6d93a7ea9882b67895d0c3301cda414e451f Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 13 Oct 2023 14:13:26 +0200 Subject: [PATCH] Add tests and docs --- absolute.json | 14 +- tests/README.md | 241 +++++++++++++++++++++++++++++++-- tests/absolute.json5 | 32 ++++- tests/add.json5 | 84 ++++++++++++ tests/array_concat.json5 | 4 +- tests/array_modify.json5 | 12 +- tests/between.json5 | 2 +- tests/constant.json5 | 101 +++++++++++++- tests/date_shift.json5 | 8 +- tests/e.json5 | 8 +- tests/extrema.json5 | 2 +- tests/filter_labels.json5 | 2 +- tests/first.json5 | 2 +- tests/is_infinite.json5 | 111 ++++++++++++++- tests/is_nan.json5 | 68 +++++++++- tests/is_nodata.json5 | 12 +- tests/last.json5 | 2 +- tests/linear_scale_range.json5 | 2 +- tests/max.json5 | 2 +- tests/mean.json5 | 4 +- tests/median.json5 | 4 +- tests/nan.json5 | 7 +- tests/pi.json5 | 8 +- tests/rename_labels.json5 | 2 +- tests/sd.json5 | 2 +- tests/subtract.json5 | 84 ++++++++++++ tests/variance.json5 | 2 +- 27 files changed, 753 insertions(+), 69 deletions(-) diff --git a/absolute.json b/absolute.json index 3b6e91dc..a1fc1d50 100644 --- a/absolute.json +++ b/absolute.json @@ -28,12 +28,6 @@ } }, "examples": [ - { - "arguments": { - "x": 0 - }, - "returns": 0 - }, { "arguments": { "x": 3.5 @@ -45,12 +39,6 @@ "x": -0.4 }, "returns": 0.4 - }, - { - "arguments": { - "x": -3.5 - }, - "returns": 3.5 } ], "links": [ @@ -95,4 +83,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/tests/README.md b/tests/README.md index c124b15e..81dda3a0 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,7 +1,148 @@ # Tests This folder contains test cases for the openEO processes. -To allow for more data types (e.g. infinity and nan for numbers), all the files are encoded in **JSON5**. + +## Supported processes + +- [x] absolute +- [x] add +- [ ] add_dimension +- [ ] aggregate_spatial +- [ ] aggregate_spatial_window +- [ ] aggregate_temporal +- [ ] aggregate_temporal_period +- [x] all +- [x] and +- [ ] anomaly +- [x] any +- [ ] apply +- [ ] apply_dimension +- [ ] apply_kernel +- [ ] apply_neighborhood +- [ ] apply_polygon +- [ ] arccos +- [ ] arcosh +- [ ] arcsin +- [ ] arctan +- [ ] arctan2 +- [ ] array_append +- [ ] array_apply +- [ ] array_concat +- [ ] array_contains +- [ ] array_create +- [ ] array_create_labeled +- [ ] array_element +- [ ] array_filter +- [ ] array_find +- [ ] array_find_label +- [ ] array_interpolate_linear +- [ ] array_labels +- [ ] array_modify +- [ ] arsinh +- [ ] artanh +- [ ] between +- [ ] ceil +- [ ] climatological_normal +- [ ] clip +- [x] constant +- [ ] cos +- [ ] cosh +- [ ] count +- [ ] create_data_cube +- [ ] cummax +- [ ] cummin +- [ ] cumproduct +- [ ] cumsum +- [ ] date_between +- [ ] date_difference +- [ ] date_shift +- [ ] dimension_labels +- [ ] divide +- [ ] drop_dimension +- [x] e +- [ ] eq +- [ ] exp +- [ ] extrema +- [ ] filter_bands +- [ ] filter_bbox +- [ ] filter_labels +- [ ] filter_spatial +- [ ] filter_temporal +- [ ] filter_vector +- [ ] first +- [ ] flatten_dimensions +- [ ] floor +- [ ] gt +- [ ] gte +- [ ] if +- [ ] int +- [ ] is_infinite +- [x] is_nan +- [ ] is_valid +- [ ] last +- [ ] linear_scale_range +- [ ] ln +- [ ] load_geojson +- [ ] load_stac +- [ ] load_uploaded_files +- [ ] load_url +- [ ] log +- [ ] lt +- [ ] lte +- [ ] mask +- [ ] mask_polygon +- [ ] max +- [ ] mean +- [ ] median +- [ ] merge_cubes +- [ ] min +- [ ] mod +- [ ] multiply +- [x] nan +- [ ] ndvi +- [ ] neq +- [ ] normalized_difference +- [x] not +- [x] or +- [ ] order +- [x] pi +- [ ] power +- [ ] product +- [ ] quantiles +- [ ] rearrange +- [ ] reduce_dimension +- [ ] reduce_spatial +- [ ] rename_dimension +- [ ] rename_labels +- [ ] resample_cube_spatial +- [ ] resample_cube_temporal +- [ ] resample_spatial +- [ ] round +- [ ] sd +- [ ] sgn +- [ ] sin +- [ ] sinh +- [ ] sort +- [ ] sqrt +- [x] subtract +- [ ] sum +- [ ] tan +- [ ] tanh +- [x] text_begins +- [x] text_concat +- [x] text_contains +- [x] text_ends +- [ ] trim_cube +- [ ] unflatten_dimension +- [ ] variance +- [ ] vector_buffer +- [ ] vector_reproject +- [ ] vector_to_regular_points +- [x] xor + +## Incomplete processes + +- [x] is_nodata - actual no-data values depends on context / metadata ## Missing processes @@ -9,17 +150,87 @@ The following processes have no test cases as the results heavily depend on the or need an external services to be available for testing (e.g. loading files from the user workspace or a UDF server). We don't expect that we can provide meaningful test cases for these processes. -- ard_normalized_radar_backscatter -- ard_surface_reflectance -- atmospheric_correction -- cloud_detection -- fit_curve -- inspect -- load_collection -- load_uploaded_files -- predict_curve -- run_udf -- run_udf_externally -- sar_backscatter -- save_result -- vector_to_random_points \ No newline at end of file +- [ ] ard_normalized_radar_backscatter +- [ ] ard_surface_reflectance +- [ ] atmospheric_correction +- [ ] cloud_detection +- [ ] fit_curve +- [ ] inspect +- [ ] load_collection +- [ ] load_uploaded_files +- [ ] predict_curve +- [ ] run_udf +- [ ] run_udf_externally +- [ ] sar_backscatter +- [ ] save_result +- [ ] vector_to_random_points + +## Assumptions + +The test cases assume a couple of things as they are an abstraction and not bound to specific implementations: +- The JSON Schema type `number` explicitly includes the values `+Infinity`, `-Infinity` and `NaN`. +- The input and output values for no-data values are `null`, so there's no mapping to e.g. `0` as no-data value. +- Input that is not valid according to the schemas, will be rejected upfront and will not be checked on. For example, the absolute process only tests against the data types `number` and `null`. There are no tests for a boolean or string input. +- Numerical data types such as uint8 don't matter, i.e. tests don't check for overflows etc. This suite can't provide such tests as the underlying data type is not known. + +## Test Files + +To allow for more data types (e.g. infinity and nan for numbers), all the files are encoded in **JSON5** instead of JSON. + +The test files have the following schema: + +```yaml +description: A document with test cases for a specific openEO process +type: object +required: + - tests +properties: + tests: + description: A list of test cases without a specific order + type: array + items: + description: A test case with a set of arguments and a specific return value or exception + type: object + required: + - arguments + properties: + arguments: + description: A key-value pair for an argument. Key = Parameter name, Value = Argument value + type: object + additionalProperties: + description: An argument, can be of any type + oneOf: + - required: + - returns + properties: + returns: + description: The return value, can be of any type + delta: + description: If set to a positive number the equality of the actual return value and the expected return value is checked against a delta value to circumvent problems with floating-point inaccuracy. + type: number + - required: + - throws + properties: + throws: + oneOf: + - description: Specify an exception name from the process specification + type: string + minLength: 1 + - description: Use true if the type of exception is unknown + type: boolean + const: true +``` + +Arguments and return values can point to external files, e.g. +```json +{ + "$ref": "https://host.example/file.nc" +} +``` + +### Assets + +Additional assets will be provided for the test cases. + +- Raster data cubes will be provided as CoverageJSON. +- Multi-dimensional vector data cubes can't be provided right now, we use GeoJSON whenever possible. diff --git a/tests/absolute.json5 b/tests/absolute.json5 index e7f17c42..fbd1f53e 100644 --- a/tests/absolute.json5 +++ b/tests/absolute.json5 @@ -1,5 +1,29 @@ { "tests": [ + { + "arguments": { + "x": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": null + }, + "returns": null + }, { "arguments": { "x": 0 @@ -8,15 +32,15 @@ }, { "arguments": { - "x": 3.5 + "x": -1 }, - "returns": 3.5 + "returns": 1 }, { "arguments": { - "x": -0.4 + "x": 3.5 }, - "returns": 0.4 + "returns": 3.5 }, { "arguments": { diff --git a/tests/add.json5 b/tests/add.json5 index 1b0c998c..4ceab658 100644 --- a/tests/add.json5 +++ b/tests/add.json5 @@ -1,5 +1,68 @@ { "tests": [ + { + "arguments": { + "x": Infinity, + "y": -1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": 1, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": null + }, + "returns": null + }, + { + "arguments": { + "x": null, + "y": -Infinity + }, + "returns": null + }, { "arguments": { "x": 5, @@ -14,12 +77,33 @@ }, "returns": -6 }, + { + "arguments": { + "x": 5.25, + "y": 0 + }, + "returns": 5.25 + }, + { + "arguments": { + "x": 250, + "y": 10 + }, + "returns": 260 + }, { "arguments": { "x": 1, "y": null }, "returns": null + }, + { + "arguments": { + "x": null, + "y": -1 + }, + "returns": null } ] } \ No newline at end of file diff --git a/tests/array_concat.json5 b/tests/array_concat.json5 index af0c6263..11174ee0 100644 --- a/tests/array_concat.json5 +++ b/tests/array_concat.json5 @@ -1,7 +1,7 @@ { "tests": [ { - "description": "Concatenates two numerical arrays.", + // Concatenates two numerical arrays. "arguments": { "array1": [ 1.5, @@ -18,7 +18,7 @@ ] }, { - "description": "Concatenates two arrays containing different data type, may not always be supported.", + // Concatenates two arrays containing different data type, may not always be supported. "arguments": { "array1": [ "a", diff --git a/tests/array_modify.json5 b/tests/array_modify.json5 index c5686dcd..ec8f134c 100644 --- a/tests/array_modify.json5 +++ b/tests/array_modify.json5 @@ -1,7 +1,7 @@ { "tests": [ { - "description": "Replace a single value in the array.", + // Replace a single value in the array. "arguments": { "data": [ "a", @@ -21,7 +21,7 @@ ] }, { - "description": "Replace multiple values in the array.", + // Replace multiple values in the array. "arguments": { "data": [ "a", @@ -46,7 +46,7 @@ ] }, { - "description": "Insert a value to the array at a given position.", + // Insert a value to the array at a given position. "arguments": { "data": [ "a", @@ -64,7 +64,7 @@ ] }, { - "description": "Remove a single value from the array.", + // Remove a single value from the array. "arguments": { "data": [ "a", @@ -82,7 +82,7 @@ ] }, { - "description": "Remove multiple values from the array.", + // Remove multiple values from the array. "arguments": { "data": [ null, @@ -102,7 +102,7 @@ ] }, { - "description": "Remove multiple values from the end of the array and ignore that the given length is exceeding the size of the array.", + // Remove multiple values from the end of the array and ignore that the given length is exceeding the size of the array. "arguments": { "data": [ "a", diff --git a/tests/between.json5 b/tests/between.json5 index 1834bf2e..6aab5faf 100644 --- a/tests/between.json5 +++ b/tests/between.json5 @@ -26,7 +26,7 @@ "returns": false }, { - "description": "Swapped bounds (min is greater than max) MUST always return `false`.", + // Swapped bounds (min is greater than max) MUST always return `false` "arguments": { "x": 0.5, "min": 1, diff --git a/tests/constant.json5 b/tests/constant.json5 index 308e1aa1..664fd424 100644 --- a/tests/constant.json5 +++ b/tests/constant.json5 @@ -1,3 +1,102 @@ { - "tests": [] + "tests": [ + { + "arguments": { + "x": 0 + }, + "returns": 0 + }, + { + "arguments": { + "x": -260 + }, + "returns": -260 + }, + { + "arguments": { + "x": 66666 + }, + "returns": 66666 + }, + { + "arguments": { + "x": 0.123456789 + }, + "returns": 0.123456789 + }, + { + "arguments": { + "x": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": true + }, + "returns": true + }, + { + "arguments": { + "x": false + }, + "returns": false + }, + { + "arguments": { + "x": null + }, + "returns": null + }, + { + "arguments": { + "x": "test" + }, + "returns": "test" + }, + { + "arguments": { + "x": [] + }, + "returns": [] + }, + { + "arguments": { + "x": [1,2,3,-4] + }, + "returns": [1,2,3,-4] + }, + { + "arguments": { + "x": [0,NaN,null,false,""] + }, + "returns": [0,NaN,null,false,""] + }, + { + "arguments": { + "x": { + "a": "b", + "b": 123, + "c": [] + } + }, + "returns": { + "a": "b", + "b": 123, + "c": [] + } + } + ] } \ No newline at end of file diff --git a/tests/date_shift.json5 b/tests/date_shift.json5 index 1606cec3..4e792fba 100644 --- a/tests/date_shift.json5 +++ b/tests/date_shift.json5 @@ -17,7 +17,7 @@ "returns": "2021-03-24T00:00:00+02:00" }, { - "description": "Adding a year to February 29th in a leap year will result in February 28th in the next (non-leap) year.", + // Adding a year to February 29th in a leap year will result in February 28th in the next (non-leap) year. "arguments": { "date": "2020-02-29T17:22:45Z", "value": 1, @@ -26,7 +26,7 @@ "returns": "2021-02-28T17:22:45Z" }, { - "description": "Adding a month to January 31th will result in February 29th in leap years.", + // Adding a month to January 31th will result in February 29th in leap years. "arguments": { "date": "2020-01-31", "value": 1, @@ -35,7 +35,7 @@ "returns": "2020-02-29" }, { - "description": "The process skips over the leap second `2016-12-31T23:59:60Z`.", + // The process skips over the leap second `2016-12-31T23:59:60Z`. "arguments": { "date": "2016-12-31T23:59:59Z", "value": 1, @@ -44,7 +44,7 @@ "returns": "2017-01-01T00:00:00Z" }, { - "description": "Milliseconds can be added or subtracted. If not given, the default value is `0`.", + // Milliseconds can be added or subtracted. If not given, the default value is `0`. "arguments": { "date": "2018-12-31T17:22:45Z", "value": 1150, diff --git a/tests/e.json5 b/tests/e.json5 index 308e1aa1..2a02d4d8 100644 --- a/tests/e.json5 +++ b/tests/e.json5 @@ -1,3 +1,9 @@ { - "tests": [] + "tests": [ + { + "arguments": {}, + "returns": 2.718281828459, + "delta": 0.000000000001 + } + ] } \ No newline at end of file diff --git a/tests/extrema.json5 b/tests/extrema.json5 index 94fdce69..87f1bb62 100644 --- a/tests/extrema.json5 +++ b/tests/extrema.json5 @@ -45,7 +45,7 @@ ] }, { - "description": "The input array is empty: return two `null` values.", + // The input array is empty: return two `null` values. "arguments": { "data": [] }, diff --git a/tests/filter_labels.json5 b/tests/filter_labels.json5 index 849670cd..f0460bb1 100644 --- a/tests/filter_labels.json5 +++ b/tests/filter_labels.json5 @@ -1,7 +1,7 @@ { "tests": [ { - "description": "Filters the data cube to only contain data from platform Sentinel-2A. This example assumes that the data cube has a dimension `platform` so that computations can distinguish between Sentinel-2A and Sentinel-2B data.", + // Filters the data cube to only contain data from platform Sentinel-2A. This example assumes that the data cube has a dimension `platform` so that computations can distinguish between Sentinel-2A and Sentinel-2B data. "arguments": { "data": { "from_parameter": "sentinel2_data" diff --git a/tests/first.json5 b/tests/first.json5 index f2c3243a..ec0d70ad 100644 --- a/tests/first.json5 +++ b/tests/first.json5 @@ -33,7 +33,7 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, diff --git a/tests/is_infinite.json5 b/tests/is_infinite.json5 index 308e1aa1..2c6ac1cf 100644 --- a/tests/is_infinite.json5 +++ b/tests/is_infinite.json5 @@ -1,3 +1,112 @@ { - "tests": [] + "tests": [ + { + "arguments": { + "x": Infinity + }, + "returns": true + }, + { + "arguments": { + "x": -Infinity + }, + "returns": true + }, + { + "arguments": { + "x": 1 + }, + "returns": false + }, + { + "arguments": { + "x": -123456789.0 + }, + "returns": false + }, + { + "arguments": { + "x": NaN + }, + "returns": false + }, + { + "arguments": { + "x": true + }, + "returns": false + }, + { + "arguments": { + "x": false + }, + "returns": false + }, + { + "arguments": { + "x": [Infinity] + }, + "returns": false + }, + { + "arguments": { + "x": [] + }, + "returns": false + }, + { + "arguments": { + "x": {} + }, + "returns": false + }, + { + "arguments": { + "x": {"inf": Infinity} + }, + "returns": false + }, + { + "arguments": { + "x": "-infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "-Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "-inf" + }, + "returns": false + }, + { + "arguments": { + "x": "infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "Infinity" + }, + "returns": false + }, + { + "arguments": { + "x": "inf" + }, + "returns": false + }, + { + "arguments": { + "x": null + }, + "returns": false + } + ] } \ No newline at end of file diff --git a/tests/is_nan.json5 b/tests/is_nan.json5 index 7aa14245..a991a6d7 100644 --- a/tests/is_nan.json5 +++ b/tests/is_nan.json5 @@ -8,7 +8,73 @@ }, { "arguments": { - "x": "Test" + "x": -123456789.0 + }, + "returns": false + }, + { + "arguments": { + "x": Infinity + }, + "returns": false + }, + { + "arguments": { + "x": -Infinity + }, + "returns": false + }, + { + "arguments": { + "x": NaN + }, + "returns": true + }, + { + "arguments": { + "x": true + }, + "returns": true + }, + { + "arguments": { + "x": false + }, + "returns": true + }, + { + "arguments": { + "x": [NaN] + }, + "returns": true + }, + { + "arguments": { + "x": [] + }, + "returns": true + }, + { + "arguments": { + "x": {} + }, + "returns": true + }, + { + "arguments": { + "x": {"nan": NaN} + }, + "returns": true + }, + { + "arguments": { + "x": "NaN" + }, + "returns": true + }, + { + "arguments": { + "x": "nan" }, "returns": true }, diff --git a/tests/is_nodata.json5 b/tests/is_nodata.json5 index d316a73a..dd81695c 100644 --- a/tests/is_nodata.json5 +++ b/tests/is_nodata.json5 @@ -1,22 +1,24 @@ { + // We can't check for other no-data values than `null` + // as it depends on the data cube / metadata / context, which can't influence "tests": [ { "arguments": { - "x": 1 + "x": null }, - "returns": false + "returns": true }, { "arguments": { - "x": "Test" + "x": 1 }, "returns": false }, { "arguments": { - "x": null + "x": "Test" }, - "returns": true + "returns": false }, { "arguments": { diff --git a/tests/last.json5 b/tests/last.json5 index 8da4ff66..795439d3 100644 --- a/tests/last.json5 +++ b/tests/last.json5 @@ -33,7 +33,7 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, diff --git a/tests/linear_scale_range.json5 b/tests/linear_scale_range.json5 index ed964c81..7e5d3a36 100644 --- a/tests/linear_scale_range.json5 +++ b/tests/linear_scale_range.json5 @@ -27,7 +27,7 @@ "returns": null }, { - "description": "Shows that the input data is clipped.", + // Shows that the input data is clipped. "arguments": { "x": 1.12, "inputMin": 0, diff --git a/tests/max.json5 b/tests/max.json5 index bef35016..1b8c6902 100644 --- a/tests/max.json5 +++ b/tests/max.json5 @@ -36,7 +36,7 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, diff --git a/tests/mean.json5 b/tests/mean.json5 index fc997cd6..5dece9dd 100644 --- a/tests/mean.json5 +++ b/tests/mean.json5 @@ -33,14 +33,14 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, "returns": null }, { - "description": "The input array has only `null` elements: return `null`.", + // The input array has only `null` elements: return `null`. "arguments": { "data": [ null, diff --git a/tests/median.json5 b/tests/median.json5 index ad549d23..949c3f3e 100644 --- a/tests/median.json5 +++ b/tests/median.json5 @@ -53,14 +53,14 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, "returns": null }, { - "description": "The input array has only `null` elements: return `null`.", + // The input array has only `null` elements: return `null`. "arguments": { "data": [ null, diff --git a/tests/nan.json5 b/tests/nan.json5 index 308e1aa1..6e0a71c4 100644 --- a/tests/nan.json5 +++ b/tests/nan.json5 @@ -1,3 +1,8 @@ { - "tests": [] + "tests": [ + { + "arguments": {}, + "returns": NaN + } + ] } \ No newline at end of file diff --git a/tests/pi.json5 b/tests/pi.json5 index 308e1aa1..19c411a7 100644 --- a/tests/pi.json5 +++ b/tests/pi.json5 @@ -1,3 +1,9 @@ { - "tests": [] + "tests": [ + { + "arguments": {}, + "returns": 3.14159265, + "delta": 0.00000001 + } + ] } \ No newline at end of file diff --git a/tests/rename_labels.json5 b/tests/rename_labels.json5 index 1999ce6f..10e45a68 100644 --- a/tests/rename_labels.json5 +++ b/tests/rename_labels.json5 @@ -2,7 +2,7 @@ "tests": [ { "title": "Rename named labels", - "description": "Renaming the bands from `B1` to `red`, from `B2` to `green` and from `B3` to `blue`.", + // Renaming the bands from `B1` to `red`, from `B2` to `green` and from `B3` to `blue`. "arguments": { "data": { "from_parameter": "data" diff --git a/tests/sd.json5 b/tests/sd.json5 index 3f8cd496..1858b004 100644 --- a/tests/sd.json5 +++ b/tests/sd.json5 @@ -24,7 +24,7 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] }, diff --git a/tests/subtract.json5 b/tests/subtract.json5 index 7a9f82d6..e2c77377 100644 --- a/tests/subtract.json5 +++ b/tests/subtract.json5 @@ -1,5 +1,68 @@ { "tests": [ + { + "arguments": { + "x": Infinity, + "y": -1 + }, + "returns": Infinity + }, + { + "arguments": { + "x": 1, + "y": -Infinity + }, + "returns": -Infinity + }, + { + "arguments": { + "x": Infinity, + "y": -Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": -Infinity, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": Infinity + }, + "returns": Infinity + }, + { + "arguments": { + "x": Infinity, + "y": NaN + }, + "returns": NaN + }, + { + "arguments": { + "x": NaN, + "y": -Infinity + }, + "returns": NaN + }, + { + "arguments": { + "x": Infinity, + "y": null + }, + "returns": null + }, + { + "arguments": { + "x": null, + "y": -Infinity + }, + "returns": null + }, { "arguments": { "x": 5, @@ -13,6 +76,20 @@ "y": 4 }, "returns": -6 + } + { + "arguments": { + "x": 5.25, + "y": 0 + }, + "returns": 5.25 + }, + { + "arguments": { + "x": -250, + "y": 10 + }, + "returns": -260 }, { "arguments": { @@ -20,6 +97,13 @@ "y": null }, "returns": null + }, + { + "arguments": { + "x": null, + "y": -1 + }, + "returns": null } ] } \ No newline at end of file diff --git a/tests/variance.json5 b/tests/variance.json5 index 1fa210e1..dc4bc830 100644 --- a/tests/variance.json5 +++ b/tests/variance.json5 @@ -37,7 +37,7 @@ "returns": null }, { - "description": "The input array is empty: return `null`.", + // The input array is empty: return `null`. "arguments": { "data": [] },