From ad10347a448d88cacc83241daa32744b391fe498 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 2 Apr 2001 17:01:03 +0000 Subject: [PATCH] *** empty log message *** --- allParam/test/blob/b_lowercase.c | 7 ++- allParam/test/blob/b_odd_size.c | 66 ++++++++++++++++++++++++++++ allParam/test/blob/b_odd_size.h | 6 +++ allParam/test/blob/b_to_large.c | 71 +++++++++++++++++++++++++++++++ allParam/test/blob/b_to_large.h | 6 +++ allParam/test/blob/test0.blob | Bin 16368 -> 16364 bytes 6 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 allParam/test/blob/b_odd_size.c create mode 100644 allParam/test/blob/b_odd_size.h create mode 100644 allParam/test/blob/b_to_large.c create mode 100644 allParam/test/blob/b_to_large.h 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 ae56c07133a54e32e3dda56fc643fb92722a2897..3ff8d37f2af5ba33429860dba0fde2a5a8082c6c 100644 GIT binary patch delta 7 OcmexR|E7M!8+!m0Pz1IB delta 11 ScmaD;|Dk@v8~e#0_*nofUIt76 -- 2.43.0