]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Mon, 2 Apr 2001 17:01:03 +0000 (17:01 +0000)
committerhades <hades>
Mon, 2 Apr 2001 17:01:03 +0000 (17:01 +0000)
allParam/test/blob/b_lowercase.c
allParam/test/blob/b_odd_size.c [new file with mode: 0644]
allParam/test/blob/b_odd_size.h [new file with mode: 0644]
allParam/test/blob/b_to_large.c [new file with mode: 0644]
allParam/test/blob/b_to_large.h [new file with mode: 0644]
allParam/test/blob/test0.blob

index 0abdc1e0e89cc89a86781468e12be26fd4a72362..d0f3e3e0d501bf0e2a44f1308268b5586a2fbdda 100644 (file)
@@ -1,6 +1,8 @@
+#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include <allParam.h>
 
@@ -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 (file)
index 0000000..b62289a
--- /dev/null
@@ -0,0 +1,66 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <allParam.h>
+
+#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 (file)
index 0000000..2a5bd34
--- /dev/null
@@ -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 (file)
index 0000000..f00d206
--- /dev/null
@@ -0,0 +1,71 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <allParam.h>
+
+#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 (file)
index 0000000..e016b5d
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef B_TO_LARGE_H
+#define B_TO_LARGE_H
+
+int b_to_large(const char *);
+
+#endif
index ae56c07133a54e32e3dda56fc643fb92722a2897..3ff8d37f2af5ba33429860dba0fde2a5a8082c6c 100644 (file)
Binary files a/allParam/test/blob/test0.blob and b/allParam/test/blob/test0.blob differ