Skip to content

Commit

Permalink
Add first tests from process examples
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Oct 12, 2023
1 parent 836a84b commit f563a2c
Show file tree
Hide file tree
Showing 137 changed files with 4,045 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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**.

## Missing processes

The following processes have no test cases as the results heavily depend on the underlying implementation
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
28 changes: 28 additions & 0 deletions tests/absolute.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tests": [
{
"arguments": {
"x": 0
},
"returns": 0
},
{
"arguments": {
"x": 3.5
},
"returns": 3.5
},
{
"arguments": {
"x": -0.4
},
"returns": 0.4
},
{
"arguments": {
"x": -3.5
},
"returns": 3.5
}
]
}
25 changes: 25 additions & 0 deletions tests/add.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"tests": [
{
"arguments": {
"x": 5,
"y": 2.5
},
"returns": 7.5
},
{
"arguments": {
"x": -2,
"y": -4
},
"returns": -6
},
{
"arguments": {
"x": 1,
"y": null
},
"returns": null
}
]
}
3 changes: 3 additions & 0 deletions tests/add_dimension.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tests": []
}
3 changes: 3 additions & 0 deletions tests/aggregate_spatial.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tests": []
}
3 changes: 3 additions & 0 deletions tests/aggregate_spatial_window.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tests": []
}
53 changes: 53 additions & 0 deletions tests/aggregate_temporal.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"tests": [
{
"arguments": {
"data": {
"from_parameter": "data"
},
"intervals": [
[
"2015-01-01",
"2016-01-01"
],
[
"2016-01-01",
"2017-01-01"
],
[
"2017-01-01",
"2018-01-01"
],
[
"2018-01-01",
"2019-01-01"
],
[
"2019-01-01",
"2020-01-01"
]
],
"labels": [
"2015",
"2016",
"2017",
"2018",
"2019"
],
"reducer": {
"process_graph": {
"mean1": {
"process_id": "mean",
"arguments": {
"data": {
"from_parameter": "data"
}
},
"result": true
}
}
}
}
}
]
}
3 changes: 3 additions & 0 deletions tests/aggregate_temporal_period.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tests": []
}
94 changes: 94 additions & 0 deletions tests/all.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"tests": [
{
"arguments": {
"data": [
false,
null
]
},
"returns": false
},
{
"arguments": {
"data": [
true,
null
]
},
"returns": true
},
{
"arguments": {
"data": [
false,
null
],
"ignore_nodata": false
},
"returns": false
},
{
"arguments": {
"data": [
true,
null
],
"ignore_nodata": false
},
"returns": null
},
{
"arguments": {
"data": [
true,
false,
true,
false
]
},
"returns": false
},
{
"arguments": {
"data": [
true,
false
]
},
"returns": false
},
{
"arguments": {
"data": [
true,
true
]
},
"returns": true
},
{
"arguments": {
"data": [
true
]
},
"returns": true
},
{
"arguments": {
"data": [
null
],
"ignore_nodata": false
},
"returns": null
},
{
"arguments": {
"data": []
},
"returns": null
}
]
}
39 changes: 39 additions & 0 deletions tests/and.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"tests": [
{
"arguments": {
"x": true,
"y": true
},
"returns": true
},
{
"arguments": {
"x": true,
"y": false
},
"returns": false
},
{
"arguments": {
"x": false,
"y": false
},
"returns": false
},
{
"arguments": {
"x": false,
"y": null
},
"returns": false
},
{
"arguments": {
"x": true,
"y": null
},
"returns": null
}
]
}
3 changes: 3 additions & 0 deletions tests/anomaly.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tests": []
}
94 changes: 94 additions & 0 deletions tests/any.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"tests": [
{
"arguments": {
"data": [
false,
null
]
},
"returns": false
},
{
"arguments": {
"data": [
true,
null
]
},
"returns": true
},
{
"arguments": {
"data": [
false,
null
],
"ignore_nodata": false
},
"returns": null
},
{
"arguments": {
"data": [
true,
null
],
"ignore_nodata": false
},
"returns": true
},
{
"arguments": {
"data": [
true,
false,
true,
false
]
},
"returns": true
},
{
"arguments": {
"data": [
true,
false
]
},
"returns": true
},
{
"arguments": {
"data": [
false,
false
]
},
"returns": false
},
{
"arguments": {
"data": [
true
]
},
"returns": true
},
{
"arguments": {
"data": [
null
],
"ignore_nodata": false
},
"returns": null
},
{
"arguments": {
"data": []
},
"returns": null
}
]
}
Loading

0 comments on commit f563a2c

Please sign in to comment.