]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Thu, 31 Aug 2000 12:44:20 +0000 (12:44 +0000)
committerhades <hades>
Thu, 31 Aug 2000 12:44:20 +0000 (12:44 +0000)
48 files changed:
allParam/ca/caParam.c
allParam/file/fileParam.c
allParam/ora/oraParam.pc
allParam/psql/psqlParam.c
allParam/tcl/tclParam.c
allParam/test/Makefile [new file with mode: 0644]
allParam/test/param.tcl [new file with mode: 0644]
allParam/test/suite.c [new file with mode: 0644]
allParam/test/test1.c [new file with mode: 0644]
allParam/test/test1.h [new file with mode: 0644]
allParam/test/test10.c [new file with mode: 0644]
allParam/test/test10.h [new file with mode: 0644]
allParam/test/test11.c [new file with mode: 0644]
allParam/test/test11.h [new file with mode: 0644]
allParam/test/test12.c [new file with mode: 0644]
allParam/test/test12.h [new file with mode: 0644]
allParam/test/test13.c [new file with mode: 0644]
allParam/test/test13.h [new file with mode: 0644]
allParam/test/test14.c [new file with mode: 0644]
allParam/test/test14.h [new file with mode: 0644]
allParam/test/test15.c [new file with mode: 0644]
allParam/test/test15.h [new file with mode: 0644]
allParam/test/test16.c [new file with mode: 0644]
allParam/test/test16.h [new file with mode: 0644]
allParam/test/test17.c [new file with mode: 0644]
allParam/test/test17.h [new file with mode: 0644]
allParam/test/test18.c [new file with mode: 0644]
allParam/test/test18.h [new file with mode: 0644]
allParam/test/test19.c [new file with mode: 0644]
allParam/test/test19.h [new file with mode: 0644]
allParam/test/test2.c [new file with mode: 0644]
allParam/test/test2.h [new file with mode: 0644]
allParam/test/test20.c [new file with mode: 0644]
allParam/test/test20.h [new file with mode: 0644]
allParam/test/test3.c [new file with mode: 0644]
allParam/test/test3.h [new file with mode: 0644]
allParam/test/test4.c [new file with mode: 0644]
allParam/test/test4.h [new file with mode: 0644]
allParam/test/test5.c [new file with mode: 0644]
allParam/test/test5.h [new file with mode: 0644]
allParam/test/test6.c [new file with mode: 0644]
allParam/test/test6.h [new file with mode: 0644]
allParam/test/test7.c [new file with mode: 0644]
allParam/test/test7.h [new file with mode: 0644]
allParam/test/test8.c [new file with mode: 0644]
allParam/test/test8.h [new file with mode: 0644]
allParam/test/test9.c [new file with mode: 0644]
allParam/test/test9.h [new file with mode: 0644]

index 16b48f3893298ec00e47df492f14bedae5c240e0..f0762560965e09b6b3c15d719031367a022c0110 100644 (file)
@@ -11,7 +11,7 @@
 static chid Param_openChannel(const Param *, const char *, int *);
 static int Param_closeChannel(const Param *, chid, char *);
 static char *Param_returnPVName(const char *, const char *, int);
-static void Param_strerror(const Param *, const char *);
+static void Param_strerror(Param *, const char *);
 
 int conParam(Param *my)
 {
@@ -37,7 +37,7 @@ int Param_getString(const Param *my, const char *name, const char *idx, int *row
        int i;
 
        if(ca_task_initialize() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot establish ca connection.\n");
+               Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                return -1;
        }
 
@@ -45,7 +45,7 @@ int Param_getString(const Param *my, const char *name, const char *idx, int *row
        chan = Param_openChannel(my, pPVName, &found);
        switch (found) {
                case(-1):
-                       Param_strerror(my, "Cannot establish ca connection.\n");
+                       Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                        break;
                case(0):
                        *row = 0;
@@ -53,7 +53,7 @@ int Param_getString(const Param *my, const char *name, const char *idx, int *row
                case(1):
                        *row = 1;
                        if(ca_bget(chan, val) != ECA_NORMAL) {
-                               Param_strerror(my, "Did not receive correct data via ca.\n");
+                               Param_strerror((Param *) my, "Did not receive correct data via ca.\n");
                                return -1;
                        }
                        retVal = Param_closeChannel(my, chan, pPVName);
@@ -61,7 +61,7 @@ int Param_getString(const Param *my, const char *name, const char *idx, int *row
        }
 
        if(ca_task_exit() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot close ca connection.\n");
+               Param_strerror((Param *) my, "Cannot close ca connection.\n");
                return -1;
        }
        
@@ -77,7 +77,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
        int i;
 
        if(ca_task_initialize() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot establish ca connection.\n");
+               Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                return -1;
        }
 
@@ -85,7 +85,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
        chan = Param_openChannel(my, pPVName, &found);
        switch (found) {
                case(-1):
-                       Param_strerror(my, "Cannot establish ca connection.\n");
+                       Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                        break;
                case(0):
                        *rows = 0;
@@ -93,7 +93,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
                case(1):
                        *rows = maxrows;
                        if(ca_array_get(DBR_LONG, maxrows, chan, val) != ECA_NORMAL) {
-                               Param_strerror(my, "Did not receive correct data via ca.\n");
+                               Param_strerror((Param *) my, "Did not receive correct data via ca.\n");
                                retVal = -1;
                        }
                        retVal|= Param_closeChannel(my, chan, pPVName);
@@ -101,7 +101,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
        }
 
        if(ca_task_exit() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot close ca connection.\n");
+               Param_strerror((Param *) my, "Cannot close ca connection.\n");
                return -1;
        }
        return retVal;
@@ -116,7 +116,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
        int i;
 
        if(ca_task_initialize() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot establish ca connection.\n");
+               Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                return -1;
        }
 
@@ -126,7 +126,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
                chan = Param_openChannel(my, pPVName, &found);
                switch (found) {
                        case(-1):
-                               Param_strerror(my, "Cannot establish ca connection.\n");
+                               Param_strerror((Param *) my, "Cannot establish ca connection.\n");
                                return -1;
                                break;
                        case(0):
@@ -134,7 +134,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
                                break;
                        case(1):
                                if(ca_bget(chan, val) != ECA_NORMAL) {
-                                       Param_strerror(my, "Did not receive correct data via ca.\n");
+                                       Param_strerror((Param *) my, "Did not receive correct data via ca.\n");
                                        retVal = -1;
                                } else {
                                        *rows++;
@@ -145,7 +145,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
        }
 
        if(ca_task_exit() != ECA_NORMAL) {
-               Param_strerror(my, "Cannot close ca connection.\n");
+               Param_strerror((Param *) my, "Cannot close ca connection.\n");
                return -1;
        }
        
@@ -170,7 +170,7 @@ static chid Param_openChannel(const Param *my, const char *pPVName, int *found)
        }
 
        if(ca_pend_io(TIMEOUT) != ECA_NORMAL) {
-               Param_strerror(my, "Cannot switch to asynchronous mode.\n");
+               Param_strerror((Param *) my, "Cannot switch to asynchronous mode.\n");
        }
        return chan;
 }
@@ -178,7 +178,7 @@ static chid Param_openChannel(const Param *my, const char *pPVName, int *found)
 static int Param_closeChannel(const Param *my, chid chan, char *pPVName)
 {
        if(ca_pend_io(TIMEOUT) != ECA_NORMAL) {
-               Param_strerror(my, "Cannot switch to asynchronous mode.\n");
+               Param_strerror((Param *) my, "Cannot switch to asynchronous mode.\n");
        }
        free(pPVName);
        if(ca_clear_channel(chan) != ECA_NORMAL) {
@@ -206,9 +206,11 @@ static char *Param_returnPVName(const char *name, const char *idx, int num)
        return pPVName;
 }
 
-static void Param_strerror(const Param *my, const char *strerror)
+static void Param_strerror(Param *my, const char *strerror)
 {
-       realloc(my->strerror, strlen(strerror));
-       strcpy(my->strerror, strerror);
+       my->strerror = realloc(my->strerror, strlen(strerror) + 1);
+       if(my->strerror != NULL) {
+               strcpy(my->strerror, strerror);
+       }
 }
 
index 8ceaef3a887b4294a30a8267caa756f2f48fed9f..4992e1328e2c75e241c5af12e82dee386f5241d7 100644 (file)
@@ -11,7 +11,7 @@
 #define BUFFERSIZE 130
 
 static int Param_getParamNumber(const Param *, const char *, const char *);
-static void Param_strerror(const Param *, const char *);
+static void Param_strerror(Param *, const char *);
 
 int conParam(Param *my)
 {
@@ -67,7 +67,7 @@ int Param_getInt(const Param *my, const char *name, const char *idx, int *row, u
        }
        *val = strtoul(valstr, &endptr, 0);
        if (*endptr == '\0') {
-               Param_strerror(my, "Value seems to be no integer.\n");
+               Param_strerror((Param *) my, "Value seems to be no integer.\n");
                retVal = -1;
        }
        return retVal;
@@ -79,7 +79,7 @@ int Param_getString(const Param *my, const char *name, const char *idx, int *row
        n = Param_getParamNumber(my, name, idx);
        if (n == -1) {
                strcpy(val, "");
-               Param_strerror(my, "Parameter not found.\n");
+               Param_strerror((Param *) my, "Parameter not found.\n");
                *row = 0;
        } else {
                strcpy(val, my->value[n]);
@@ -97,7 +97,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
        for (i = 0 ; i < maxrows ; i++) {
                sprintf(index,"%s%d", idx, i);
                if(retVal |= Param_getInt(my, name, index, &row, val + i) == 0) {
-                       *rows+= row;
+                       *rows += row;
                } else {
                        i = maxrows;
                }
@@ -115,7 +115,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
        for (i = 0 ; i < maxrows ; i++) {
                sprintf(index,"%s%d", idx, i);
                if(retVal |= Param_getString(my, name, index, &row, val[i]) == 0) {
-                       *rows+= row;
+                       *rows += row;
                } else {
                        i = maxrows;
                }
@@ -144,9 +144,11 @@ static int Param_getParamNumber(const Param *my, const char *name, const char *i
        return retVal;
 }
 
-static void Param_strerror(const Param *my, const char *strerror)
+static void Param_strerror(Param *my, const char *strerror)
 {
-       realloc(my->strerror, strlen(strerror));
-       strcpy(my->strerror, strerror);
+       my->strerror = realloc(my->strerror, strlen(strerror) + 1);
+       if(my->strerror != NULL) {
+               strcpy(my->strerror, strerror);
+       }
 }
 
index 9b8187151a0e37a02467fb3b2b746b7f3cd18531..b56f033fbae0f8f77d1700d70d7189ade372c8c8 100644 (file)
@@ -111,7 +111,10 @@ const char *Param_getErrStr(const Param *my)
 
 static void Param_strerror(const Param *my, const char *strerror)
 {
-       realloc(my->strerror, strlen(strerror));
-       strcpy(my->strerror, strerror);
+       (Param *) my;
+       my->strerror = realloc(my->strerror, strlen(strerror) + 1);
+       if(my->strerror != NULL) {
+               strcpy(my->strerror, strerror);
+       }
 }
 
index 3b93ebf3d4c6a8d7b26143926bf221c74f93c21c..4e03092f0a4ddcd2e0fa0c5993a4cf4ec4299c90 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "param.h"
 
-static void Param_strerror(const Param *, const char *);
+static void Param_strerror(Param *, const char *);
 
 int conParam(Param *my)
 {
@@ -46,17 +46,17 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
 
        result = PQexec(conn, query);
        if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror(my, "The PostgreSQL query result is not correct.\n");
+               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.\n");
                return -1;
        }
        fnum = PQfnumber(result, "value");
                      
        if ((*rows = PQntuples(result)) > maxrows) {
-               Param_strerror(my, "Result has to many rows. Returning only 'maxrows' rows.\n");
+               Param_strerror((Param *) my, "Result has to many rows. Returning only 'maxrows' rows.\n");
                for (i = 0 ; i < maxrows ; i++) {
                        val[i] = strtoul(PQgetvalue(result, i, fnum), &endptr, 0);
                        if(*endptr != '\0') {
-                               Param_strerror(my, "Value seems to be no integer.\n");
+                               Param_strerror((Param *) my, "Value seems to be no integer.\n");
                                retVal = -1;
                        }
                }
@@ -65,7 +65,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
                for (i = 0 ; i < *rows ; i++) {
                        val[i] = strtoul(PQgetvalue(result, i, fnum), &endptr, 0);
                        if(*endptr != '\0') {
-                               Param_strerror(my, "Value seems to be no integer.\n");
+                               Param_strerror((Param *) my, "Value seems to be no integer.\n");
                                retVal = -1;
                        }
                }
@@ -95,13 +95,13 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
 
        result = PQexec(conn, query);
        if(PQresultStatus(result) != PGRES_TUPLES_OK) {
-               Param_strerror(my, "The PostgreSQL query result is not correct.\n");
+               Param_strerror((Param *) my, "The PostgreSQL query result is not correct.\n");
                return -1;
        }
        fnum = PQfnumber(result, "value");
 
        if ((*rows = PQntuples(result)) > maxrows) {
-               Param_strerror(my, "Result has to many rows. Returning only 'maxrows' rows.\n");
+               Param_strerror((Param *) my, "Result has to many rows. Returning only 'maxrows' rows.\n");
                for (i = 0 ; i < maxrows ; i++) {
                        strcpy(val[i], PQgetvalue(result, i, fnum));
                }
@@ -125,9 +125,11 @@ const char *Param_getErrStr(const Param *my)
        return my->strerror;
 }
 
-static void Param_strerror(const Param *my, const char *strerror)
+static void Param_strerror(Param *my, const char *strerror)
 {
-       realloc(my->strerror, strlen(strerror));
-       strcpy(my->strerror, strerror);
+       my->strerror = realloc(my->strerror, strlen(strerror) + 1);
+       if(my->strerror != NULL) {
+               strcpy(my->strerror, strerror);
+       }
 }
 
index df5c10b05f3ba1aa5005492193d1b64972af1672..145266f331ae4dd0d21e1f88c6d509e2a3cafa50 100644 (file)
@@ -5,10 +5,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 #include "param.h"
 
-static void Param_strerror(const Param *, const char *);
+static void Param_strerror(Param *, const char *);
 
 int conParam(Param *my)
 {
@@ -27,7 +28,7 @@ int conParam(Param *my)
                if (*my->interp->result != 0) {
                        Param_strerror(my, my->interp->result);
                } else {
-                       Param_strerror(my, "Tcl interpreter cannot read file correctly and does not deliver an error string.\n");
+                       Param_strerror((Param *) my, "Tcl interpreter cannot read file correctly and does not deliver an error string.\n");
                }
                retVal = -1;
        } else {
@@ -45,28 +46,50 @@ int Param_getInt(const Param *my, const char *name, const char *idx, int *row, u
 {
        char valstr[PARAM_MAX_VALUE_LEN];
        char *endptr;
+
        if (Param_getString(my, name, idx, row, valstr) != 0) {
                return -1;
+       } else if(*row == 0) {
+               return 0;
        }
        if(valstr == NULL) {
                *row = 0;
        } else {
                *val = strtoul(valstr, &endptr, 0);
-               if (*endptr == '\0') {
-                       Param_strerror(my, "Value seems to be no integer.\n");
+               if (*endptr != '\0') {
+                       Param_strerror((Param *) my, "Value seems to be no integer.\n");
+                       *row = 0;
                        return -1;
+               } else {
+                       *row = 1;
                }
-               *row = 1;
        }
        return 0;
 }
 
 int Param_getString(const Param *my, const char *name, const char *idx, int *row, char *val)
 {
-       strcpy(val, Tcl_GetVar2(my->interp, (char *) name, (char *) idx, 0));
-       if (val == NULL) {
+       int retVal;
+       int i;
+       char lname[strlen(name) + 1];
+       char lidx[strlen(idx) + 1];
+       i = 0;
+       while(name[i] != '\0') {
+               lname[i] = tolower(name[i]);
+               i++;
+       }
+       lname[i] = '\0';
+       i = 0;
+       while(idx[i] != '\0') {
+               lidx[i] = tolower(idx[i]);
+               i++;
+       }
+       lidx[i] = '\0';
+
+       if(Tcl_GetVar2(my->interp, lname, lidx, 0) == 0) {
                *row = 0;
        } else {
+               strcpy(val, Tcl_GetVar2(my->interp, lname, lidx, 0));
                *row = 1;
        }
        return 0;
@@ -82,7 +105,7 @@ int Param_getIntArray(const Param *my, const char *name, const char *idx, int ma
        for (i = 0 ; i < maxrows ; i++) {
                sprintf(index,"%s%d", idx, i);
                if(((retVal |= Param_getInt(my, name, index, &row, &val[i])) == 0) && (row == 1)) {
-                       *rows++;
+                       (*rows)++;
                } else {
                        return retVal;
                }
@@ -101,7 +124,7 @@ int Param_getStringArray(const Param *my, const char *name, const char *idx, int
        for (i = 0 ; i < maxrows ; i++) {
                sprintf(index,"%s%d", idx, i);
                if(((retVal |= Param_getString(my, name, index, &row, val[i])) == 0) && (row == 1)) {
-                       *rows++;
+                       (*rows)++;
                } else {
                        return retVal;
                }
@@ -115,9 +138,11 @@ const char *Param_getErrStr(const Param *my)
        return my->strerror;
 }
 
-void Param_strerror(const Param *my, const char *strerror)
+void Param_strerror(Param *my, const char *strerror)
 {
-       realloc(my->strerror, strlen(strerror));
-       strcpy(my->strerror, strerror);
+       my->strerror = realloc(my->strerror, strlen(strerror) + 1);
+       if(my->strerror != NULL) {
+               strcpy(my->strerror, strerror);
+       }
 }
 
diff --git a/allParam/test/Makefile b/allParam/test/Makefile
new file mode 100644 (file)
index 0000000..c57c7cc
--- /dev/null
@@ -0,0 +1,46 @@
+# Tcl test
+CFLAGS = -I$(HOME)/include/tcl
+LOADLIBES = -L$(HOME)/lib/$(SYSTYPE) -ltclParam -ltcl -lm -ldl
+
+# File test
+#CFLAGS = -I$(HOME)/include/file
+#LOADLIBES = -L$(HOME)/lib/$(SYSTYPE) -lfileParam
+
+# Oracle test
+#ORACLE_HOME = /usr/local/oracle/product/8.0.5
+#CFLAGS = -I$(HOME)/include/ora
+#LOADLIBES = -L$(HOME)/lib/$(SYSTYPE) -L$(ORACLE_HOME)/lib \
+#  -loraParam -lsql -lclntsh -lcommon -lcore4 -lnlsrtl3
+
+# PostgreSQL test
+#CFLAGS = -I$(HOME)/include/psql
+#LOADLIBES = -L$(HOME)/lib/$(SYSTYPE) -lpsqlParam -lpq -lcrypt
+
+# Channel Access test
+#HOST_ARCH = Linux
+#EPICS_HOME = $(HOME)/hades/epics
+#EPICS_BASE = $(EPICS_HOME)/base
+#CFLAGS = -I$(HOME)/include/ca
+#LOADLIBES = -L$(HOME)/lib/$(SYSTYPE) -L$(EPICS_HOME)/lib/$(HOST_ARCH) \
+#  -lcaParam -lca -lCom
+
+TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
+  test12 test13 test14 test15 test16 test17 test18 test19 test20
+
+OBJS = suite.o $(addsuffix .o,$(TESTS))
+
+suite : $(OBJS)
+       $(CC) $(LDFLAGS) $(OBJS) $(LOADLIBES) -o $@
+
+new :
+       $(MAKE) -W suite.o suite
+
+suite.o : suite.c $(addsuffix .h, $(TESTS))
+$(addsuffix .o, $(TESTS)) : $(patsubst %.o,%.c,$@) $(patsubst %.o,%.h,$@)
+
+clean :
+       rm -f *.o
+
+bin_clean :
+       rm *.o suite
+
diff --git a/allParam/test/param.tcl b/allParam/test/param.tcl
new file mode 100644 (file)
index 0000000..76e67b8
--- /dev/null
@@ -0,0 +1,47 @@
+set crate_id(herakles) test0
+
+set race0(se_id) 100
+
+set race0(fefpgafile0) daq_cas/vme/race/conf/5frontend.rbt
+set race0(fefpgafile1) daq_cas/vme/race/conf/5frontend.rbt
+set race0(fefpgafile2) daq_cas/vme/race/conf/5frontend.rbt
+set race0(fefpgafile3) daq_cas/vme/race/conf/5frontend.rbt
+set race0(fefpgafile4) daq_cas/vme/race/conf/4frontend.rbt
+set race0(fefpgafile5) daq_cas/vme/race/conf/4frontend.rbt
+set race0(fefpgafile6) daq_cas/vme/race/conf/4frontend.rbt
+set race0(fefpgafile7) daq_cas/vme/race/conf/5frontend.rbt
+set race0(fefpgafile9) daq_cas/vme/race/conf/5frontend.rbt
+
+set tof_tdc0(threshold0) 0
+set tof_tdc0(threshold1) 0
+set tof_tdc0(threshold2) 0
+set tof_tdc0(threshold3) 0
+set tof_tdc0(threshold4) 0
+set tof_tdc0(threshold5) 0
+set tof_tdc0(threshold6) 0
+set tof_tdc0(threshold7) 0
+set tof_tdc0(threshold8) 0
+set tof_tdc0(threshold9) 0
+set tof_tdc0(threshold10) 0
+set tof_tdc0(threshold11) 0
+set tof_tdc0(threshold12) 0
+set tof_tdc0(threshold13) 0
+set tof_tdc0(threshold14) 0
+set tof_tdc0(threshold15) 0
+set tof_tdc0(threshold16) 0
+set tof_tdc0(threshold17) 0
+set tof_tdc0(threshold18) 0
+set tof_tdc0(threshold19) 0
+set tof_tdc0(threshold20) 0
+set tof_tdc0(threshold21) 0
+set tof_tdc0(threshold22) 0
+set tof_tdc0(threshold23) 0
+set tof_tdc0(threshold24) 0
+set tof_tdc0(threshold25) 0
+set tof_tdc0(threshold26) 0
+set tof_tdc0(threshold27) 0
+set tof_tdc0(threshold28) 0
+set tof_tdc0(threshold29) 0
+set tof_tdc0(threshold30) 0
+set tof_tdc0(threshold31) 0
+
diff --git a/allParam/test/suite.c b/allParam/test/suite.c
new file mode 100644 (file)
index 0000000..d7c40ea
--- /dev/null
@@ -0,0 +1,64 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <param.h>
+
+#include "test1.h"
+#include "test2.h"
+#include "test3.h"
+#include "test4.h"
+#include "test5.h"
+#include "test6.h"
+#include "test7.h"
+#include "test8.h"
+#include "test9.h"
+#include "test10.h"
+#include "test11.h"
+#include "test12.h"
+#include "test13.h"
+#include "test14.h"
+#include "test15.h"
+#include "test16.h"
+#include "test17.h"
+#include "test18.h"
+#include "test19.h"
+#include "test20.h"
+
+int main(int argc, char *argv[]) {
+       Param *param;
+       int errors = 0;
+
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       printf("================================================================================\n");
+       errors -= test1("Test 1", param);
+       errors -= test2("Test 2", param);
+       errors -= test3("Test 3", param);
+       errors -= test4("Test 4", param);
+       errors -= test5("Test 5", param);
+       errors -= test6("Test 6", param);
+       errors -= test7("Test 7", param);
+       errors -= test8("Test 8", param);
+       errors -= test9("Test 9", param);
+       errors -= test10("Test 10", param);
+       errors -= test11("Test 11", param);
+       errors -= test12("Test 12", param);
+       errors -= test13("Test 13", param);
+       errors -= test14("Test 14", param);
+       errors -= test15("Test 15", param);
+       errors -= test16("Test 16", param);
+       errors -= test17("Test 17", param);
+       errors -= test18("Test 18", param);
+       errors -= test19("Test 19", param);
+       errors -= test20("Test 20", param);
+
+       desParam(param);
+       free(param);
+
+       printf("================================================================================\n");
+       printf("%s : %d errors detected.\n", argv[0], errors);
+       printf("================================================================================\n");
+       return 0;
+}
+
diff --git a/allParam/test/test1.c b/allParam/test/test1.c
new file mode 100644 (file)
index 0000000..8b0360f
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test1.h"
+
+int test1(const char *testid, const Param *param) {
+       char *name = "crate_id";
+       char *idx = "herakles";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getString: Lowercase input on correct statements.\n", testid);
+
+       retVal = Param_getString(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "test0") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test1.h b/allParam/test/test1.h
new file mode 100644 (file)
index 0000000..d64f69e
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST1_H
+#define TEST1_H
+
+#include <param.h>
+
+int test1(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test10.c b/allParam/test/test10.c
new file mode 100644 (file)
index 0000000..1da27cd
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test10.h"
+
+int test10(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "bla";
+       unsigned long int result;
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getInt: Non-existing idx.\n", testid);
+
+       retVal = Param_getInt(param, name, idx, &rows, &result);
+       if ((rows == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test10.h b/allParam/test/test10.h
new file mode 100644 (file)
index 0000000..4b9e218
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST10_H
+#define TEST10_H
+
+#include <param.h>
+
+int test10(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test11.c b/allParam/test/test11.c
new file mode 100644 (file)
index 0000000..d8d780b
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test11.h"
+
+int test11(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "se_id";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getString: String is wanted but int-like value found.\n", testid);
+
+       retVal = Param_getString(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "100") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test11.h b/allParam/test/test11.h
new file mode 100644 (file)
index 0000000..2550cb0
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST11_H
+#define TEST11_H
+
+#include <param.h>
+
+int test11(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test12.c b/allParam/test/test12.c
new file mode 100644 (file)
index 0000000..b998a6d
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test12.h"
+
+int test12(const char *testid, const Param *param) {
+       char *name = "crate_id";
+       char *idx = "herakles";
+       unsigned long int result;
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getInt: Integer is wanted but string-like value found.\n", testid);
+
+       retVal = Param_getInt(param, name, idx, &rows, &result);
+       if ((rows == 0) && (retVal == -1)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test12.h b/allParam/test/test12.h
new file mode 100644 (file)
index 0000000..4ca71e0
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST12_H
+#define TEST12_H
+
+#include <param.h>
+
+int test12(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test13.c b/allParam/test/test13.c
new file mode 100644 (file)
index 0000000..90d9d5a
--- /dev/null
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test13.h"
+
+int test13(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "blub";
+       char *result[NUM1];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: Non-existing idx.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM1 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test13.h b/allParam/test/test13.h
new file mode 100644 (file)
index 0000000..0cc5448
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST13_H
+#define TEST13_H
+
+#include <param.h>
+
+#define NUM1 8
+
+int test13(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test14.c b/allParam/test/test14.c
new file mode 100644 (file)
index 0000000..e949e4a
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test14.h"
+
+int test14(const char *testid, const Param *param) {
+       char *name = "tof_tdc0";
+       char *idx = "blub";
+       unsigned long int result[NUM2];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: Non-existing idx.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+       if ((rows == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test14.h b/allParam/test/test14.h
new file mode 100644 (file)
index 0000000..a0bd53b
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST14_H
+#define TEST14_H
+
+#include <param.h>
+
+#define NUM2 32
+
+int test14(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test15.c b/allParam/test/test15.c
new file mode 100644 (file)
index 0000000..a5561b2
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test15.h"
+
+int test15(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "fefpgafile";
+       char *result[NUM3];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM3 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: To few array members available.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM3, &rows, result);
+       if ((rows == NUM1) &&
+               result[0] && (strcmp(result[0], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[1] && (strcmp(result[1], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[2] && (strcmp(result[2], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[3] && (strcmp(result[3], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[4] && (strcmp(result[4], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[5] && (strcmp(result[5], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[6] && (strcmp(result[6], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[7] && (strcmp(result[7], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM3 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test15.h b/allParam/test/test15.h
new file mode 100644 (file)
index 0000000..298af3e
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef TEST15_H
+#define TEST15_H
+
+#include <param.h>
+
+#define NUM1 8
+#define NUM3 16
+
+int test15(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test16.c b/allParam/test/test16.c
new file mode 100644 (file)
index 0000000..f2e5af3
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test16.h"
+
+int test16(const char *testid, const Param *param) {
+       char *name = "tof_tdc0";
+       char *idx = "threshold";
+       unsigned long int result[NUM4];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: To few array members available.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM4, &rows, result);
+       for(i = 0 ; i < NUM2 ; i++) {
+               resultsum &= (result[i] == 0);
+       }
+       if ((rows == NUM2) && resultsum && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test16.h b/allParam/test/test16.h
new file mode 100644 (file)
index 0000000..02d02fe
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef TEST16_H
+#define TEST16_H
+
+#include <param.h>
+
+#define NUM2 32
+#define NUM4 64
+
+int test16(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test17.c b/allParam/test/test17.c
new file mode 100644 (file)
index 0000000..b7ec3c3
--- /dev/null
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test17.h"
+
+int test17(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "fefpgafile";
+       char *result[NUM5];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM5 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: To many array members available.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM5, &rows, result);
+       if ((rows == NUM5) &&
+               result[0] && (strcmp(result[0], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[1] && (strcmp(result[1], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[2] && (strcmp(result[2], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[3] && (strcmp(result[3], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM5 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test17.h b/allParam/test/test17.h
new file mode 100644 (file)
index 0000000..f8a3d03
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef TEST17_H
+#define TEST17_H
+
+#include <param.h>
+
+#define NUM1 8
+#define NUM5 4
+
+int test17(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test18.c b/allParam/test/test18.c
new file mode 100644 (file)
index 0000000..55edf7d
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test18.h"
+
+int test18(const char *testid, const Param *param) {
+       char *name = "tof_tdc0";
+       char *idx = "threshold";
+       unsigned long int result[NUM6];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: To many array members available.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM6, &rows, result);
+       for(i = 0 ; i < NUM6 ; i++) {
+               resultsum &= (result[i] == 0);
+       }
+       if ((rows == NUM6) && resultsum && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test18.h b/allParam/test/test18.h
new file mode 100644 (file)
index 0000000..9ad80d2
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef TEST18_H
+#define TEST18_H
+
+#include <param.h>
+
+#define NUM2 32
+#define NUM6 16
+
+int test18(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test19.c b/allParam/test/test19.c
new file mode 100644 (file)
index 0000000..4a79ee6
--- /dev/null
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test19.h"
+
+int test19(const char *testid, const Param *param) {
+       char *name = "tof_tdc0";
+       char *idx = "threshold";
+       char *result[NUM2];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM2 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: String is wanted but Int-like values found.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM2, &rows, result);
+       if ((rows == NUM2) &&
+               result[0] && (strcmp(result[0], "0") == 0) &&
+               result[1] && (strcmp(result[1], "0") == 0) &&
+               result[2] && (strcmp(result[2], "0") == 0) &&
+               result[3] && (strcmp(result[3], "0") == 0) &&
+               result[4] && (strcmp(result[4], "0") == 0) &&
+               result[5] && (strcmp(result[5], "0") == 0) &&
+               result[6] && (strcmp(result[6], "0") == 0) &&
+               result[7] && (strcmp(result[7], "0") == 0) &&
+               result[8] && (strcmp(result[8], "0") == 0) &&
+               result[9] && (strcmp(result[9], "0") == 0) &&
+               result[10] && (strcmp(result[10], "0") == 0) &&
+               result[11] && (strcmp(result[11], "0") == 0) &&
+               result[12] && (strcmp(result[12], "0") == 0) &&
+               result[13] && (strcmp(result[13], "0") == 0) &&
+               result[14] && (strcmp(result[14], "0") == 0) &&
+               result[15] && (strcmp(result[15], "0") == 0) &&
+               result[16] && (strcmp(result[16], "0") == 0) &&
+               result[17] && (strcmp(result[17], "0") == 0) &&
+               result[18] && (strcmp(result[18], "0") == 0) &&
+               result[19] && (strcmp(result[19], "0") == 0) &&
+               result[20] && (strcmp(result[20], "0") == 0) &&
+               result[21] && (strcmp(result[21], "0") == 0) &&
+               result[22] && (strcmp(result[22], "0") == 0) &&
+               result[23] && (strcmp(result[23], "0") == 0) &&
+               result[24] && (strcmp(result[24], "0") == 0) &&
+               result[25] && (strcmp(result[25], "0") == 0) &&
+               result[26] && (strcmp(result[26], "0") == 0) &&
+               result[27] && (strcmp(result[27], "0") == 0) &&
+               result[28] && (strcmp(result[28], "0") == 0) &&
+               result[29] && (strcmp(result[29], "0") == 0) &&
+               result[30] && (strcmp(result[30], "0") == 0) &&
+               result[31] && (strcmp(result[31], "0") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM2 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test19.h b/allParam/test/test19.h
new file mode 100644 (file)
index 0000000..0e2d5bb
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST19_H
+#define TEST19_H
+
+#include <param.h>
+
+#define NUM2 32
+
+int test19(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test2.c b/allParam/test/test2.c
new file mode 100644 (file)
index 0000000..224a4bc
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test2.h"
+
+int test2(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "se_id";
+       unsigned long int result;
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getInt: Lowercase input on correct statements.\n", testid);
+
+       retVal = Param_getInt(param, name, idx, &rows, &result);
+       if ((rows == 1) && (result == 100) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result: \'%d\', return Value: %d.\n", testid, rows, result, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test2.h b/allParam/test/test2.h
new file mode 100644 (file)
index 0000000..9cd4a0b
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST2_H
+#define TEST2_H
+
+#include <param.h>
+
+int test2(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test20.c b/allParam/test/test20.c
new file mode 100644 (file)
index 0000000..e1b79ce
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test20.h"
+
+int test20(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "fefpgafile";
+       unsigned long int result[NUM1];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: Int is wanted but String-like values found.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == 0) && (retVal == -1)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test20.h b/allParam/test/test20.h
new file mode 100644 (file)
index 0000000..c4d0b6e
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST20_H
+#define TEST20_H
+
+#include <param.h>
+
+#define NUM1 8
+
+int test20(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test3.c b/allParam/test/test3.c
new file mode 100644 (file)
index 0000000..3610ff4
--- /dev/null
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test3.h"
+
+int test3(const char *testid, const Param *param) {
+       char *name = "race0";
+       char *idx = "fefpgafile";
+       char *result[NUM1];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: Lowercase input on correct statements.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == NUM1) &&
+               result[0] && (strcmp(result[0], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[1] && (strcmp(result[1], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[2] && (strcmp(result[2], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[3] && (strcmp(result[3], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[4] && (strcmp(result[4], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[5] && (strcmp(result[5], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[6] && (strcmp(result[6], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[7] && (strcmp(result[7], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result array:\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\nreturn Value: %d.\n", testid, rows,
+                       result[0],
+                       result[1],
+                       result[2],
+                       result[3],
+                       result[4],
+                       result[5],
+                       result[6],
+                       result[7],
+                       retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM1 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test3.h b/allParam/test/test3.h
new file mode 100644 (file)
index 0000000..4d053dd
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST3_H
+#define TEST3_H
+
+#include <param.h>
+
+#define NUM1 8
+
+int test3(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test4.c b/allParam/test/test4.c
new file mode 100644 (file)
index 0000000..947c52f
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test4.h"
+
+int test4(const char *testid, const Param *param) {
+       char *name = "tof_tdc0";
+       char *idx = "threshold";
+       unsigned long int result[NUM2];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: Lowercase input on correct statements.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+       for(i = 0 ; i < NUM2 ; i++) {
+               resultsum &=(result[i] == 0);
+       }
+       if ((rows == NUM2) && resultsum && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result array:\n", testid, rows);
+               for(i = 0 ; i < NUM2 ; i++) {
+                       printf("result[%d]: %d.\n", i, result[i]);
+               }
+               printf("return Value: %d.\n", retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test4.h b/allParam/test/test4.h
new file mode 100644 (file)
index 0000000..95e178d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST4_H
+#define TEST4_H
+
+#include <param.h>
+
+#define NUM2 32
+
+int test4(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test5.c b/allParam/test/test5.c
new file mode 100644 (file)
index 0000000..c987038
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test5.h"
+
+int test5(const char *testid, const Param *param) {
+       char *name = "CRATE_ID";
+       char *idx = "HERAKLES";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getString: Uppercase input on correct statements.\n", testid);
+
+       retVal = Param_getString(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "test0") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result: \'%s\', return Value: %d.\n", testid, rows, result, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test5.h b/allParam/test/test5.h
new file mode 100644 (file)
index 0000000..5459560
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST5_H
+#define TEST5_H
+
+#include <param.h>
+
+int test5(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test6.c b/allParam/test/test6.c
new file mode 100644 (file)
index 0000000..62d5e15
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test6.h"
+
+int test6(const char *testid, const Param *param) {
+       char *name = "RACE0";
+       char *idx = "SE_ID";
+       unsigned long int result;
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getInt: Uppercase input on correct statements.\n", testid);
+
+       retVal = Param_getInt(param, name, idx, &rows, &result);
+       if ((rows == 1) && (result == 100) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result: \'%d\', return Value: %d.\n", testid, rows, result, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test6.h b/allParam/test/test6.h
new file mode 100644 (file)
index 0000000..2673262
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST6_H
+#define TEST6_H
+
+#include <param.h>
+
+int test6(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test7.c b/allParam/test/test7.c
new file mode 100644 (file)
index 0000000..77ccc2a
--- /dev/null
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test7.h"
+
+int test7(const char *testid, const Param *param) {
+       char *name = "RACE0";
+       char *idx = "FEFPGAFILE";
+       char *result[NUM1];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+       printf("%s : Param_getStringArray: Uppercase input on correct statements.\n", testid);
+
+       retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == NUM1) &&
+               result[0] && (strcmp(result[0], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[1] && (strcmp(result[1], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[2] && (strcmp(result[2], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[3] && (strcmp(result[3], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               result[4] && (strcmp(result[4], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[5] && (strcmp(result[5], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[6] && (strcmp(result[6], "daq_cas/vme/race/conf/4frontend.rbt") == 0) &&
+               result[7] && (strcmp(result[7], "daq_cas/vme/race/conf/5frontend.rbt") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result array:\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\nreturn Value: %d.\n", testid, rows,
+                       result[0],
+                       result[1],
+                       result[2],
+                       result[3],
+                       result[4],
+                       result[5],
+                       result[6],
+                       result[7],
+                       retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       for (i = 0 ; i < NUM1 ; i++) {
+               free(result[i]);
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test7.h b/allParam/test/test7.h
new file mode 100644 (file)
index 0000000..0ba6047
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST7_H
+#define TEST7_H
+
+#include <param.h>
+
+#define NUM1 8
+
+int test7(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test8.c b/allParam/test/test8.c
new file mode 100644 (file)
index 0000000..cfed94e
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test8.h"
+
+int test8(const char *testid, const Param *param) {
+       char *name = "TOF_TDC0";
+       char *idx = "THRESHOLD";
+       unsigned long int result[NUM2];
+       int rows;
+       int resultsum = 1;
+       int i;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getIntArray: Uppercase input on correct statements.\n", testid);
+
+       retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result);
+       for(i = 0 ; i < NUM2 ; i++) {
+               resultsum &=(result[i] == 0);
+       }
+       if ((rows == NUM2) && resultsum && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, result array:\n", testid, rows);
+               for(i = 0 ; i < NUM2 ; i++) {
+                       printf("result[%d]: %d.\n", i, result[i]);
+               }
+               printf("return Value: %d.\n", retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test8.h b/allParam/test/test8.h
new file mode 100644 (file)
index 0000000..95e178d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef TEST4_H
+#define TEST4_H
+
+#include <param.h>
+
+#define NUM2 32
+
+int test4(const char *, const Param *);
+
+#endif
diff --git a/allParam/test/test9.c b/allParam/test/test9.c
new file mode 100644 (file)
index 0000000..da51da8
--- /dev/null
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <param.h>
+
+#include "test9.h"
+
+int test9(const char *testid, const Param *param) {
+       char *name = "crate_id";
+       char *idx = "blub";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+       printf("%s : Param_getString: Non-existing idx.\n", testid);
+
+       retVal = Param_getString(param, name, idx, &rows, result);
+       if ((rows == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+               printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal);
+               printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
+               myRetVal = -1;
+       }
+       return myRetVal;
+}
+
diff --git a/allParam/test/test9.h b/allParam/test/test9.h
new file mode 100644 (file)
index 0000000..c898869
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef TEST9_H
+#define TEST9_H
+
+#include <param.h>
+
+int test9(const char *, const Param *);
+
+#endif