diff --git a/tests/tst_spec.c b/tests/tst_spec.c index 874f2bc9..c3c3cb86 100644 --- a/tests/tst_spec.c +++ b/tests/tst_spec.c @@ -8,7 +8,7 @@ #include #include -#define DATA_LEN 4 +#define DATA_LEN 6 #define PACKED_LEN 200 /* Prototypes we are testing. */ @@ -17,6 +17,30 @@ int main() { printf("Testing spec functions.\n"); + { + g2int ndpts = DATA_LEN; + float fld[DATA_LEN] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}; + float fld_in[DATA_LEN]; + unsigned char cpack[PACKED_LEN]; + g2int lcpack; + g2int idrstmpl[10] = {0, 1, 1, 16, 0, 0, 0, 0, 2, 1}; + g2int JJ = 1, KK = 1, MM = 1; + int i; + + printf("Packing the data..."); + specpack(fld, ndpts, JJ, KK, MM, idrstmpl, cpack, &lcpack); + + printf("Unpacking the data..."); + if (specunpack(cpack, idrstmpl, ndpts, JJ, KK, MM, fld_in)) + return G2C_ERROR; + + for (i = 0; i < DATA_LEN; i++) + { + printf("%g %g\n", fld[i], fld_in[i]); + if (fld[i] != fld_in[i]) + return G2C_ERROR; + } + } /* printf("Testing specpack()/specunpack() calls..."); */ /* { */ /* g2int height = 2, width = 2; */ @@ -76,4 +100,4 @@ main() /* printf("ok!\n"); */ printf("SUCCESS!\n"); return 0; -} +} \ No newline at end of file