Skip to content

Commit

Permalink
CMR-6690 fixing the indexing issue - where an empty list is getting p…
Browse files Browse the repository at this point in the history
…assed in. (#1040)
  • Loading branch information
eereiter authored and jwteague committed Sep 2, 2020
1 parent 27f9d4c commit a2189ea
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
output-formats sub element is omitted."
[supported-reformattings input-formats output-formats]
(let [join-formats (fn [sup-ref input-format]
(let [sup-ref (if sup-ref
(let [sup-ref (if (seq sup-ref)
sup-ref
[])
index (find-first-supported-reformatting input-format sup-ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,55 @@
[{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32" "HDF4","NETCDF-3","NETCDF-4","BINARY","ASCII", "ZARR", "GeoJSON"]}
{:SupportedInputFormat "Shapefile"
:SupportedOutputFormats ["HDF4","NETCDF-3","NETCDF-4","BINARY","ASCII", "ZARR", "GeoJSON"]}]))
:SupportedOutputFormats ["HDF4","NETCDF-3","NETCDF-4","BINARY","ASCII", "ZARR", "GeoJSON"]}]

"Testing empty input/ouput formats."
{:SupportedInputFormats []
:SupportedOutputFormats []
:SupportedReformattings [{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]}
[{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]

"Testing empty output formats and nil input formats."
{:SupportedOutputFormats []
:SupportedReformattings [{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]}
[{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]

"Testing empty input formats and nil output formats."
{:SupportedInputFormats []
:SupportedReformattings [{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]}
[{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]

"Testing nil input and output formats."
{:SupportedInputFormats nil
:SupportedReformattings [{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]}
[{:SupportedInputFormat "HDF4"
:SupportedOutputFormats ["GEOTIFFFLOAT32"]}]

"Testing nil input formats and supported reformattings."
{:SupportedOutputFormats ["GEOTIFFFLOAT32"]}
nil

"Tested with SupportedReformattings which is an empty list."
{:SupportedInputFormats [ "ASCII" "GEOTIFF" "NETCDF-3"]
:SupportedOutputFormats [ "ASCII" "GEOTIFF" "NETCDF-3"]
:SupportedReformatting '()}
[{:SupportedInputFormat "ASCII",
:SupportedOutputFormats ["ASCII" "GEOTIFF" "NETCDF-3"]}
{:SupportedInputFormat "GEOTIFF",
:SupportedOutputFormats ["ASCII" "GEOTIFF" "NETCDF-3"]}
{:SupportedInputFormat "NETCDF-3",
:SupportedOutputFormats ["ASCII" "GEOTIFF" "NETCDF-3"]}]

"Testing nil inputs."
nil
nil))

(deftest create-subset-type-1-3-4-to-1-3-3-test
"Test to see if umm-s version 1.3.3 SupportedInputFormats and SupportedOutputFormats are converted
Expand Down

0 comments on commit a2189ea

Please sign in to comment.