mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
07d67e737a
2. modified ncdap_tests to remove <cr> from generated output before comparison to expected. This is a hack because my other attempts to force windows to use binary mode have not worked.
61 lines
1.6 KiB
C
61 lines
1.6 KiB
C
/*********************************************************************
|
|
* Copyright 2016, UCAR/Unidata
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
*********************************************************************/
|
|
|
|
/**
|
|
Test the NCpathcvt
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "ncwinpath.h"
|
|
|
|
#undef VERBOSE
|
|
|
|
typedef struct Test {
|
|
char* path;
|
|
char* expected;
|
|
} Test;
|
|
|
|
/* Path conversion tests */
|
|
static Test PATHTESTS[] = {
|
|
{"/xxx/a/b","/xxx/a/b"},
|
|
{"d:/x/y","d:\\x\\y"},
|
|
{"/cygdrive/d/x/y","d:\\x\\y"},
|
|
{"/d/x/y","d:\\x\\y"},
|
|
{"/cygdrive/d","d:\\"},
|
|
{"/d","d:\\"},
|
|
{"/cygdrive/d/git/netcdf-c/dap4_test/daptestfiles/test_anon_dim.2.syn","d:\\git\\netcdf-c\\dap4_test\\daptestfiles\\test_anon_dim.2.syn"},
|
|
{"[dap4]file:///cygdrive/d/git/netcdf-c/dap4_test/daptestfiles/test_anon_dim.2.syn","[dap4]file:///cygdrive/d/git/netcdf-c/dap4_test/daptestfiles/test_anon_dim.2.syn"},
|
|
{NULL,NULL}
|
|
};
|
|
|
|
int
|
|
main(int argc, char** argv)
|
|
{
|
|
Test* test;
|
|
int failcount = 0;
|
|
|
|
for(test=PATHTESTS;test->path;test++) {
|
|
int ret = 0;
|
|
char* cvt = NCpathcvt(test->path);
|
|
if(cvt == NULL) {
|
|
fprintf(stderr,"TEST returned NULL: %s\n",test->path);
|
|
exit(1);
|
|
}
|
|
if(strcmp(cvt,test->expected) != 0) {
|
|
fprintf(stderr,"NCpathcvt failed:: input: |%s| expected=|%s| actual=|%s|\n",test->path,test->expected,cvt);
|
|
failcount++;
|
|
}
|
|
#ifdef VERBOSE
|
|
fprintf(stderr,"NCpathcvt:: input: |%s| actual=|%s|\n",test->path,cvt);
|
|
#endif
|
|
free(cvt);
|
|
}
|
|
|
|
fprintf(stderr,"%s test_ncuri\n",failcount > 0 ? "***FAIL":"***PASS");
|
|
return (failcount > 0 ? 1 : 0);
|
|
}
|