--- /dev/null
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#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;
+}
+
--- /dev/null
+#ifndef I_STORE_H
+#define I_STORE_H
+
+int i_store(const char *);
+
+#endif
--- /dev/null
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#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;
+}
+
--- /dev/null
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#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;
+}
+