Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing undefined value in specpack and simpack functions #529

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions tests/tst_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdio.h>
#include <stdlib.h>

#define DATA_LEN 4
#define DATA_LEN 6
#define PACKED_LEN 200

/* Prototypes we are testing. */
Expand All @@ -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; */
Expand Down Expand Up @@ -76,4 +100,4 @@ main()
/* printf("ok!\n"); */
printf("SUCCESS!\n");
return 0;
}
}
Loading