From: hades Date: Wed, 28 Mar 2001 16:47:49 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=6420d0e305c7974682e57b619f1b245d69b67ae9;p=daqdata.git *** empty log message *** --- diff --git a/allParam/test/int/i_store.c b/allParam/test/int/i_store.c new file mode 100644 index 0000000..db0518c --- /dev/null +++ b/allParam/test/int/i_store.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +#include + +#include "i_store.h" + +int i_store(const char *testid) { + Param *param; + const char *name = "tname"; + const char *idx = "tnewint"; + unsigned long int tostore = 42; + unsigned long int result; + int rows; + int retVal1; + int retVal2; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_storeInt: Simple.\n", testid); +#endif + + truncate("storage.tcl", 0); + + param = malloc(sizeof(Param)); + conParam(param); + + retVal1 = Param_storeInt(param, name, idx, tostore); + retVal2 = Param_getInt(param, name, idx, &rows, &result); + + desParam(param); + free(param); + + if ((rows == 1) && result && (result == tostore) && (retVal1 == 0) && (retVal2 == 0)) { + if(system("diff storage.tcl i_store.tcl")) { +#ifdef VERBOSE + printf("%s : Failed: Files \"storage.tcl\" and \"i_store.tcl\" differ.\n", testid); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } else { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, result: \'%ud\'\nreturn Value of store call: %d\nreturn Value of get call: %d.\n", testid, rows, result, retVal1, retVal2); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } + + return myRetVal; +} + diff --git a/allParam/test/int/i_store.h b/allParam/test/int/i_store.h new file mode 100644 index 0000000..6c0f2e2 --- /dev/null +++ b/allParam/test/int/i_store.h @@ -0,0 +1,6 @@ +#ifndef I_STORE_H +#define I_STORE_H + +int i_store(const char *); + +#endif diff --git a/allParam/test/int/i_store_existing.c b/allParam/test/int/i_store_existing.c new file mode 100644 index 0000000..3050ae7 --- /dev/null +++ b/allParam/test/int/i_store_existing.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +#include + +#include "i_store_existing.h" + +int i_store_existing(const char *testid) { + Param *param; + const char *name = "tname"; + const char *idx = "tint"; + unsigned long int tostore = 42; + unsigned long int result; + int rows; + int retVal1; + int retVal2; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_storeInt: Store a Parameter already existing in the source.\n", testid); +#endif + + truncate("storage.tcl", 0); + + param = malloc(sizeof(Param)); + conParam(param); + + retVal1 = Param_storeString(param, name, idx, tostore); + retVal2 = Param_getString(param, name, idx, &rows, &result); + + desParam(param); + free(param); + + if ((rows == 1) && result && (result == tostore) && (retVal1 == 0) && (retVal2 == 0)) { + if(system("diff storage.tcl i_store_existing.tcl")) { +#ifdef VERBOSE + printf("%s : Failed: Files \"storage.tcl\" and \"i_store_existing.tcl\" differ.\n", testid); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } else { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, result: \'%ud\'\nreturn Value of store call: %d\nreturn Value of get call: %d.\n", testid, rows, result, retVal1, retVal2); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } + + return myRetVal; +} + diff --git a/allParam/test/int/i_store_multiple.c b/allParam/test/int/i_store_multiple.c new file mode 100644 index 0000000..b51f55e --- /dev/null +++ b/allParam/test/int/i_store_multiple.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +#include + +#include "i_store_multiple.h" + +int i_store_multiple(const char *testid) { + Param *param; + const char *name = "tname"; + const char *idx = "tnewint"; + unsigned long int old = 13; + unsigned long int new = 26; + unsigned long int result; + int rows; + int retVal1; + int retVal2; + int retVal3; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_storeString: Storing a value multiple.\n", testid); +#endif + + truncate("storage.tcl", 0); + + param = malloc(sizeof(Param)); + conParam(param); + + retVal1 = Param_storeInt(param, name, idx, old); + retVal2 = Param_storeInt(param, name, idx, new); + retVal3 = Param_getInt(param, name, idx, &rows, &result); + + desParam(param); + free(param); + + if ((rows == 1) && result && (result == new) && (retVal1 == 0) && (retVal2 == 0) && (retVal3 == 0)) { + if(system("diff storage.tcl i_store_multiple.tcl")) { +#ifdef VERBOSE + printf("%s : Failed: Files \"storage.tcl\" and \"i_store_multiple.tcl\" differ.\n", testid); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } else { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, result: \'%ud\'\nreturn Value of first store call: %d\nreturn Value of second store call: %d\nreturn Value of get call: %d.\n", testid, rows, result, retVal1, retVal2, retVal3); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); + myRetVal = -1; +#else + printf("%s : Failed.\n", testid); +#endif + } + + return myRetVal; +} +