From cfc96163b804d9236a01a46caf0823a131a2f543 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 30 Aug 2023 11:02:52 +0000 Subject: [PATCH] ECC-1674: Test added --- tests/CMakeLists.txt | 1 + tests/grib_run_length_packing.cc | 75 ++++++++++++++++++++++++++++++++ tests/grib_run_length_packing.sh | 13 ++++++ 3 files changed, 89 insertions(+) create mode 100644 tests/grib_run_length_packing.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2e478eefc..1595e759e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -32,6 +32,7 @@ list(APPEND test_c_bins grib_optimize_scaling grib_optimize_scaling_sh grib_set_force + grib_run_length_packing grib_partial_message grib_ecc-386 grib_ecc-1467 diff --git a/tests/grib_run_length_packing.cc b/tests/grib_run_length_packing.cc new file mode 100644 index 000000000..15a88619f --- /dev/null +++ b/tests/grib_run_length_packing.cc @@ -0,0 +1,75 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by + * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. + */ +#include +#include "eccodes.h" +#undef NDEBUG +#include + +int main(int argc, char *argv[]) +{ + size_t str_len = 0; + long number_of_values=4, bits_per_value=8, max_level_value=3, number_of_level_values=5, decimal_scale_factor=1; + size_t level_values_length = number_of_level_values; + long level_values[] = {101L, 102L, 103L, 104L, 105L}; + double *values = NULL; + size_t values_length = number_of_values; + values = (double*)malloc(values_length * sizeof(double)); + int i = 0; + values[0] = 9999.0; + + assert(argc == 2); + + for (i=1; i