From: hades Date: Mon, 2 Apr 2001 17:01:03 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ad10347a448d88cacc83241daa32744b391fe498;p=daqdata.git *** empty log message *** --- diff --git a/allParam/test/blob/b_lowercase.c b/allParam/test/blob/b_lowercase.c index 0abdc1e..d0f3e3e 100644 --- a/allParam/test/blob/b_lowercase.c +++ b/allParam/test/blob/b_lowercase.c @@ -1,6 +1,8 @@ +#include #include #include #include +#include #include @@ -15,16 +17,19 @@ int b_lowercase(const char *testid) { size_t size; int retVal; int myRetVal; + struct stat fileS, *file = &fileS; #ifdef VERBOSE printf("%s : Param_getBlob: Lowercase input on correct statements.\n", testid); #endif + stat("blob/test0.blob", file); + param = malloc(sizeof(Param)); conSetupParam(param, testid); retVal = Param_getBlob(param, name, idx, &size, &result); - if ((size == 16368) && (retVal == 0)) { + if ((size == file->st_size) && (retVal == 0)) { int buf; store = fopen("test0.blob", "w+"); while((buf = fgetc(result)) != EOF) { diff --git a/allParam/test/blob/b_odd_size.c b/allParam/test/blob/b_odd_size.c new file mode 100644 index 0000000..b62289a --- /dev/null +++ b/allParam/test/blob/b_odd_size.c @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include + +#include + +#include "b_odd_size.h" + +int b_odd_size(const char *testid) { + Param *param; + char *name = "file"; + char *idx = "rname"; + FILE *result; + FILE *store; + size_t size; + int retVal; + int myRetVal; + struct stat fileS, *file = &fileS; + +#ifdef VERBOSE + printf("%s : Param_getBlob: Lowercase input on correct statements.\n", testid); +#endif + + stat("blob/test2.blob", file); + + param = malloc(sizeof(Param)); + conSetupParam(param, testid); + + retVal = Param_getBlob(param, name, idx, &size, &result); + if ((size == file->st_size) && (retVal == 0)) { + int buf; + store = fopen("test2.blob", "w+"); + while((buf = fgetc(result)) != EOF) { + putc(buf, store); + } + fclose(store); + if (!system("diff test2.blob blob/test2.blob")) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Files \"test2.blob\" and \"blob/test2.blob\" differ.\n", testid); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + fclose(result); + } else { +#ifdef VERBOSE + printf("%s : Failed. Size: %d, return Value: %d.\n", testid, size, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + + desParam(param); + free(param); + + return myRetVal; +} + diff --git a/allParam/test/blob/b_odd_size.h b/allParam/test/blob/b_odd_size.h new file mode 100644 index 0000000..2a5bd34 --- /dev/null +++ b/allParam/test/blob/b_odd_size.h @@ -0,0 +1,6 @@ +#ifndef B_ODD_SIZE_H +#define B_ODD_SIZE_H + +int b_odd_size(const char *); + +#endif diff --git a/allParam/test/blob/b_to_large.c b/allParam/test/blob/b_to_large.c new file mode 100644 index 0000000..f00d206 --- /dev/null +++ b/allParam/test/blob/b_to_large.c @@ -0,0 +1,71 @@ +#include +#include +#include +#include +#include + +#include + +#include "b_to_large.h" + +#define EPICS_MAX_INDEX 4092 + +int b_to_large(const char *testid) { + Param *param; + char *name = "file"; + char *idx = "rnamelarge"; + FILE *result; + FILE *store; + size_t size; + int retVal; + int myRetVal; + struct stat fileS, *file = &fileS; + +#ifdef VERBOSE + printf("%s : Param_getBlob: File larger than %d bytes (EPICS_MAX_INDEX-limitation).\n", testid, (EPICS_MAX_INDEX - 1) * sizeof(unsigned long int)); +#endif + + stat("blob/test1.blob", file); + + param = malloc(sizeof(Param)); + conSetupParam(param, testid); + + retVal = Param_getBlob(param, name, idx, &size, &result); + if (((size == file->st_size) && (retVal == 0)) { + int buf; + store = fopen("test1.blob", "w+"); + while((buf = fgetc(result)) != EOF) { + putc(buf, store); + } + fclose(store); + if (!system("diff test1.blob blob/test1.blob")) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Files \"test1.blob\" and \"blob/test1.blob\" differ.\n", testid); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + fclose(result); + } else if ((size == 0) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Size: %d, return Value: %d.\n", testid, size, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + + desParam(param); + free(param); + + return myRetVal; +} + diff --git a/allParam/test/blob/b_to_large.h b/allParam/test/blob/b_to_large.h new file mode 100644 index 0000000..e016b5d --- /dev/null +++ b/allParam/test/blob/b_to_large.h @@ -0,0 +1,6 @@ +#ifndef B_TO_LARGE_H +#define B_TO_LARGE_H + +int b_to_large(const char *); + +#endif diff --git a/allParam/test/blob/test0.blob b/allParam/test/blob/test0.blob index ae56c07..3ff8d37 100644 Binary files a/allParam/test/blob/test0.blob and b/allParam/test/blob/test0.blob differ