]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Wed, 28 Mar 2001 15:06:09 +0000 (15:06 +0000)
committerhades <hades>
Wed, 28 Mar 2001 15:06:09 +0000 (15:06 +0000)
60 files changed:
allParam/test/Makefile
allParam/test/README
allParam/test/begin.c
allParam/test/blob/b_lowercase.c
allParam/test/blob/b_lowercase.h
allParam/test/blob/test0.blob [new file with mode: 0644]
allParam/test/blob/test1.blob [new file with mode: 0644]
allParam/test/blob/test2.blob [new file with mode: 0644]
allParam/test/end.c
allParam/test/filename/f_lowercase_abs.c [new file with mode: 0644]
allParam/test/filename/f_lowercase_abs.h [new file with mode: 0644]
allParam/test/filename/f_lowercase_rel.c
allParam/test/filename/f_lowercase_rel.h
allParam/test/filename/f_lowercase_rel_no_basedir.c [new file with mode: 0644]
allParam/test/filename/f_lowercase_rel_no_basedir.h [new file with mode: 0644]
allParam/test/filename/fa_lowercase.c [new file with mode: 0644]
allParam/test/filename/fa_lowercase.h [new file with mode: 0644]
allParam/test/filename/fa_lowercase_no_basedir.c [new file with mode: 0644]
allParam/test/filename/fa_lowercase_no_basedir.h [new file with mode: 0644]
allParam/test/middle.c
allParam/test/param.tcl
allParam/test/s_store.tcl [new file with mode: 0644]
allParam/test/s_store_existing.tcl [new file with mode: 0644]
allParam/test/s_store_multiple.tcl [new file with mode: 0644]
allParam/test/s_store_whitespace.tcl [new file with mode: 0644]
allParam/test/string/s_array.c
allParam/test/string/s_array.h
allParam/test/string/s_int_available.c
allParam/test/string/s_int_available.h
allParam/test/string/s_lowercase.c
allParam/test/string/s_lowercase.h
allParam/test/string/s_no_index.c
allParam/test/string/s_no_index.h
allParam/test/string/s_store.c [new file with mode: 0644]
allParam/test/string/s_store.h [new file with mode: 0644]
allParam/test/string/s_store_existing.c [new file with mode: 0644]
allParam/test/string/s_store_existing.h [new file with mode: 0644]
allParam/test/string/s_store_multiple.c [new file with mode: 0644]
allParam/test/string/s_store_multiple.h [new file with mode: 0644]
allParam/test/string/s_store_whitespace.c [new file with mode: 0644]
allParam/test/string/s_store_whitespace.h [new file with mode: 0644]
allParam/test/string/s_uppercase.c
allParam/test/string/s_uppercase.h
allParam/test/string/s_whitespace.c [new file with mode: 0644]
allParam/test/string/s_whitespace.h [new file with mode: 0644]
allParam/test/string/sa_int_available.c
allParam/test/string/sa_int_available.h
allParam/test/string/sa_long_array.c
allParam/test/string/sa_long_array.h
allParam/test/string/sa_lowercase.c
allParam/test/string/sa_lowercase.h
allParam/test/string/sa_no_index.c
allParam/test/string/sa_no_index.h
allParam/test/string/sa_scalar.c
allParam/test/string/sa_scalar.h
allParam/test/string/sa_short_array.c
allParam/test/string/sa_short_array.h
allParam/test/string/sa_uppercase.c
allParam/test/string/sa_uppercase.h
allParam/test/test_p.tcl

index fd8e4785c2cd34cf074d357a40c14ce2b5238d4c..552b797f44b001d7643a6529858181579996815c 100644 (file)
@@ -63,7 +63,8 @@ clean :
        cd filename ; $(MAKE) $@
        cd int ; $(MAKE) $@
        cd string ; $(MAKE) $@
-       rm -f *test_protocol.txt sqlnet.log *_s.tcl storage.tcl suite.c suite.o
+       rm -f *test_protocol.txt sqlnet.log *_s.tcl storage.tcl test?.blob \
+         suite.c suite.o
 
 bin_clean : clean
        rm -f *_suite
index 902868e50821dac81a15b3d228952bb5ce4fab10..6e4e73907938170ee4220a03e1cf9009346f4c2d 100644 (file)
@@ -2,7 +2,7 @@ Author:  Benjamin Sailer
          TUM/E12
          Benjamin.Sailer@ph.tum.de
 Version: 0.1
-Date:    2000-09-10
+Date:    2001-03-28
 
 test suite
 ==========
@@ -28,10 +28,31 @@ in the test directory. There is also included a timing information, which
 unfortunately is (depending on the shell you are using) not always written to
 the file but sometimes only to stderr. Note that channel access is not
 deterministic as timeouts can occur on a heavily used network, which can be
-tuned changing the TIMEOUT definition in ca/param.h. Of course the enviroment
-needed at runtime is also needed when testing (i.e. a channel access server
-has to provide the data in case of ca_test_suite and network connection to the
-database hosts are needed for ora_test_suite and psql_test_suite.
+tuned changing the TIMEOUT definition in ca/caParam.c. Of course the enviroment
+needed at runtime is also needed when testing (i.e. network connection to the
+database hosts are needed for ora_test_suite and psql_test_suite). As the
+parameter server is now part of this library package, the test of caParam also
+uses the server compiled here. The scripts in ./bin do the startup and kill of
+the server automatically when make <lib>_test is used.
+
+  To increase the verbosity of the tests, you can add a -DVERBOSE to the
+CFLAGS in the Makefile.
+
+  If a test_suite fails with a segmentation violation and the output in the
+test protocol therefore is no help, you can run the test manually (by typing
+
+$ ./<lib>_test_suite
+
+) to find out which test fails. By renaming the corresponding sources (i.e.
+
+$ cd int
+$ mv i_lowercase.c i_lowercase.c-
+$ mv i_lowercase.h i_lowercase.h-
+$ cd -
+$ make clean
+$ make <lib>_test
+
+), you can skip a single test.
 
   There is also a huge field of errors not tested yet (containing all overflows
 of name lengths, index lengths, param file lengths, array lengths and so on -
index 23fc0eba905f0c6089e71eac4e0b04a9c1361a58..10b222ccb506d5d46f9bfbf29e1a7902d063ff90 100644 (file)
@@ -1,5 +1,2 @@
-#include <stdlib.h>
 #include <stdio.h>
 
-#include <allParam.h>
-
index 1d411d33e338489ce65aa3c03b5756f23de3f4af..22aa4a896b56b7a2951337698ea9d0dd5b3d8e1b 100644 (file)
@@ -1,18 +1,18 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "b_lowercase.h"
 
-int b_lowercase(const char *testid, const Param *param) {
-       char *name = "tname";
-       char *idx = "tint";
-       char buf[256];
+int b_lowercase(const char *testid) {
+       Param *param;
+       char *name = "file";
+       char *idx = "rname";
        FILE *result;
        FILE *store;
        size_t size;
-       size_t bufsize;
        int retVal;
        int myRetVal;
 
@@ -20,25 +20,29 @@ int b_lowercase(const char *testid, const Param *param) {
        printf("%s : Param_getBlob: Lowercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getBlob(param, name, idx, &size, &result);
-       store = fopen("blob", "w+");
-       while(bufsize = fread(buf, 1, 256, result)) {
-               fwrite(buf, 1, bufsize, store);
-       }
-       fclose(result);
-       fclose(store);
        if ((size == 16368) && (retVal == 0)) {
-               if (!system("diff blob BLOB")) {
+               int buf;
+               store = fopen("test0.blob", "w+");
+               while((buf = fgetc(result)) != EOF) {
+                       putc(buf, store);
+               }
+               fclose(store);
+               if (!system("diff test0.blob blob/test0.blob")) {
                        myRetVal = 0;
                        printf("%s : Passed.\n", testid);
                } else {
 #ifdef VERBOSE
-                       printf("%s : Failed. Files \"blob\" and \"BLOB\" differ.\n", testid);
+                       printf("%s : Failed. Files \"test0.blob\" and \"blob/test0.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);
@@ -48,6 +52,10 @@ int b_lowercase(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 0019aaf7b95f7a488b61811d02b2c3df1572b2cc..ed246beea7373faf143b1bdcfd04b8f510909c7b 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef B_LOWERCASE_H
 #define B_LOWERCASE_H
 
-#include <allParam.h>
-
-int b_lowercase(const char *, const Param *);
+int b_lowercase(const char *);
 
 #endif
diff --git a/allParam/test/blob/test0.blob b/allParam/test/blob/test0.blob
new file mode 100644 (file)
index 0000000..ae56c07
Binary files /dev/null and b/allParam/test/blob/test0.blob differ
diff --git a/allParam/test/blob/test1.blob b/allParam/test/blob/test1.blob
new file mode 100644 (file)
index 0000000..6258757
Binary files /dev/null and b/allParam/test/blob/test1.blob differ
diff --git a/allParam/test/blob/test2.blob b/allParam/test/blob/test2.blob
new file mode 100644 (file)
index 0000000..289d706
Binary files /dev/null and b/allParam/test/blob/test2.blob differ
index d5982428ca74aeacfcf9fd8c4a21c451d5614a4a..9ff7310986dc1ed8245642158a5f386b836cf4ad 100644 (file)
@@ -1,7 +1,4 @@
 
-       desParam(param);
-       free(param);
-
        printf("================================================================================\n");
        printf("%s : %d errors detected.\n", argv[0], errors);
        printf("================================================================================\n");
diff --git a/allParam/test/filename/f_lowercase_abs.c b/allParam/test/filename/f_lowercase_abs.c
new file mode 100644 (file)
index 0000000..30629f9
--- /dev/null
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "f_lowercase_abs.h"
+
+int f_lowercase_abs(const char *testid) {
+       Param *param;
+       char *name = "file";
+       char *idx = "aname";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_getFilename: Lowercase input on correct statements.\n", testid);
+#endif
+
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       retVal = Param_getFilename(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "/test0.blob") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+#ifdef VERBOSE
+               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;
+#else
+               printf("%s : Failed.\n", testid);
+#endif
+       }
+
+       desParam(param);
+       free(param);
+
+       return myRetVal;
+}
+
diff --git a/allParam/test/filename/f_lowercase_abs.h b/allParam/test/filename/f_lowercase_abs.h
new file mode 100644 (file)
index 0000000..59f754e
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef F_LOWERCASE_ABS_H
+#define F_LOWERCASE_ABS_H
+
+int f_lowercase_abs(const char *);
+
+#endif
index 1cc9994d996be52d819a5374d096fbe408535ff8..bb5a955d1cb18e475584c421bd59ad260b8ce790 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "f_lowercase_rel.h"
 
-int f_lowercase_rel(const char *testid, const Param *param) {
+int f_lowercase_rel(const char *testid) {
+       Param *param;
        char *name = "file";
        char *idx = "rname";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,8 +19,11 @@ int f_lowercase_rel(const char *testid, const Param *param) {
        printf("%s : Param_getFilename: Lowercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getFilename(param, name, idx, &rows, result);
-       if ((rows == 1) && result && (strcmp(result, "test/blob/BLOB") == 0) && (retVal == 0)) {
+       if ((rows == 1) && result && (strcmp(result, "blob/test0.blob") == 0) && (retVal == 0)) {
                myRetVal = 0;
                printf("%s : Passed.\n", testid);
        } else {
@@ -30,6 +35,10 @@ int f_lowercase_rel(const char *testid, const Param *param) {
                printf("%s : Failed.\n", testid);
 #endif
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 1a3e4b568b3c992335c8a871d7cc98771c751604..994daea630c272799e10ffee532070381ae30a39 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef F_LOWERCASE_REL_H
 #define F_LOWERCASE_REL_H
 
-#include <allParam.h>
-
-int f_lowercase_rel(const char *, const Param *);
+int f_lowercase_rel(const char *);
 
 #endif
diff --git a/allParam/test/filename/f_lowercase_rel_no_basedir.c b/allParam/test/filename/f_lowercase_rel_no_basedir.c
new file mode 100644 (file)
index 0000000..2333c9b
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "f_lowercase_rel_no_basedir.h"
+
+int f_lowercase_rel_no_basedir(const char *testid) {
+       Param *param;
+       char *name = "file";
+       char *idx = "rname";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_getFilename: Lowercase input on correct statements.\n", testid);
+       printf("%s : No glob(basedir) specified in parameter source.\n", testid);
+#endif
+
+       param = malloc(sizeof(Param));
+       conSetupParam(param, "test");
+
+       retVal = Param_getFilename(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "test0.blob") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+#ifdef VERBOSE
+               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;
+#else
+               printf("%s : Failed.\n", testid);
+#endif
+       }
+
+       desParam(param);
+       free(param);
+
+       return myRetVal;
+}
+
diff --git a/allParam/test/filename/f_lowercase_rel_no_basedir.h b/allParam/test/filename/f_lowercase_rel_no_basedir.h
new file mode 100644 (file)
index 0000000..7fb6df1
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef F_LOWERCASE_REL_NO_BASEDIR_H
+#define F_LOWERCASE_REL_NO_BASEDIR_H
+
+int f_lowercase_rel_no_basedir(const char *);
+
+#endif
diff --git a/allParam/test/filename/fa_lowercase.c b/allParam/test/filename/fa_lowercase.c
new file mode 100644 (file)
index 0000000..2961e17
--- /dev/null
@@ -0,0 +1,74 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "fa_lowercase.h"
+
+#define NUM1 8
+
+int fa_lowercase(const char *testid) {
+       Param *param;
+       char *name = "file";
+       char *idx = "namea";
+       char *result[NUM1];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+#ifdef VERBOSE
+       printf("%s : Param_getFilenameArray: Lowercase input on correct statements.\n", testid);
+       printf("%s : glob(basedir) set to \"blob\" in the parameter source.\n", testid);
+#endif
+
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
+       retVal = Param_getFilenameArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == NUM1) &&
+               result[0] && (strcmp(result[0], "blob/test1.blob") == 0) &&
+               result[1] && (strcmp(result[1], "/test0.blob") == 0) &&
+               result[2] && (strcmp(result[2], "blob/test3.blob") == 0) &&
+               result[3] && (strcmp(result[3], "/test2.blob") == 0) &&
+               result[4] && (strcmp(result[4], "blob/test5.blob") == 0) &&
+               result[5] && (strcmp(result[5], "/test4.blob") == 0) &&
+               result[6] && (strcmp(result[6], "blob/test7.blob") == 0) &&
+               result[7] && (strcmp(result[7], "/test6.blob") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+#ifdef VERBOSE
+               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));
+#else
+               printf("%s : Failed.\n", testid);
+#endif
+               myRetVal = -1;
+       }
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               free(result[i]);
+       }
+
+       desParam(param);
+       free(param);
+
+       return myRetVal;
+}
+
diff --git a/allParam/test/filename/fa_lowercase.h b/allParam/test/filename/fa_lowercase.h
new file mode 100644 (file)
index 0000000..44d2002
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef FA_LOWERCASE_H
+#define FA_LOWERCASE_H
+
+int fa_lowercase(const char *);
+
+#endif
diff --git a/allParam/test/filename/fa_lowercase_no_basedir.c b/allParam/test/filename/fa_lowercase_no_basedir.c
new file mode 100644 (file)
index 0000000..c81af1d
--- /dev/null
@@ -0,0 +1,74 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "fa_lowercase_no_basedir.h"
+
+#define NUM1 8
+
+int fa_lowercase_no_basedir(const char *testid) {
+       Param *param;
+       char *name = "file";
+       char *idx = "namea";
+       char *result[NUM1];
+       int rows;
+       int retVal;
+       int myRetVal;
+       int i;
+
+#ifdef VERBOSE
+       printf("%s : Param_getFilenameArray: Lowercase input on correct statements.\n", testid);
+       printf("%s : No glob(basedir) specified in the parameter source.\n", testid);
+#endif
+
+       param = malloc(sizeof(Param));
+       conSetupParam(param, "test");
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
+       retVal = Param_getFilenameArray(param, name, idx, NUM1, &rows, result);
+       if ((rows == NUM1) &&
+               result[0] && (strcmp(result[0], "test1.blob") == 0) &&
+               result[1] && (strcmp(result[1], "/test0.blob") == 0) &&
+               result[2] && (strcmp(result[2], "test3.blob") == 0) &&
+               result[3] && (strcmp(result[3], "/test2.blob") == 0) &&
+               result[4] && (strcmp(result[4], "test5.blob") == 0) &&
+               result[5] && (strcmp(result[5], "/test4.blob") == 0) &&
+               result[6] && (strcmp(result[6], "test7.blob") == 0) &&
+               result[7] && (strcmp(result[7], "/test6.blob") == 0) &&
+               (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+#ifdef VERBOSE
+               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));
+#else
+               printf("%s : Failed.\n", testid);
+#endif
+               myRetVal = -1;
+       }
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               free(result[i]);
+       }
+
+       desParam(param);
+       free(param);
+
+       return myRetVal;
+}
+
diff --git a/allParam/test/filename/fa_lowercase_no_basedir.h b/allParam/test/filename/fa_lowercase_no_basedir.h
new file mode 100644 (file)
index 0000000..45d09e3
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef FA_LOWERCASE_NO_BASEDIR_H
+#define FA_LOWERCASE_NO_BASEDIR_H
+
+int fa_lowercase_no_basedir(const char *);
+
+#endif
index c623f51e57fbc8261426a29c1c7e5442d490f699..9ccd0534215cb23be9a0266306a99e2ad96f611a 100644 (file)
@@ -1,11 +1,7 @@
 
 int main(int argc, char *argv[]) {
-       Param *param;
        int errors = 0;
 
-       param = malloc(sizeof(Param));
-       conParam(param);
-
        printf("================================================================================\n");
        printf("%s : Starting test ...\n", argv[0]);
        printf("================================================================================\n");
index ab1740da7ae0fc8f91dc3a4979232e92adb3d6c0..1f3be2833089b0fe5b2dc7903cd87dd869609415 100644 (file)
@@ -1,7 +1,9 @@
 set glob(basedir) blob
 
-set file(rname) test.blob
-set file(aname) /test.blob
+set file(rname) test0.blob
+set file(aname) /test0.blob
+set file(rnamellarge) test1.blob
+set file(rnameodd) test2.blob
 
 set file(namea0) test1.blob
 set file(namea1) /test0.blob
@@ -13,6 +15,7 @@ set file(namea6) test7.blob
 set file(namea7) /test6.blob
 set file(namea9) test10.blob
 
+set tname(twhitespace) "test100 whith whitespace"
 set tname(tstring) test100
 
 set tname(tint) 100
diff --git a/allParam/test/s_store.tcl b/allParam/test/s_store.tcl
new file mode 100644 (file)
index 0000000..1c9a1c8
--- /dev/null
@@ -0,0 +1 @@
+set tname(tnewstr)     "tnewvalue"
diff --git a/allParam/test/s_store_existing.tcl b/allParam/test/s_store_existing.tcl
new file mode 100644 (file)
index 0000000..6a9e774
--- /dev/null
@@ -0,0 +1 @@
+set tname(tstring)     "tnewvalue"
diff --git a/allParam/test/s_store_multiple.tcl b/allParam/test/s_store_multiple.tcl
new file mode 100644 (file)
index 0000000..5774114
--- /dev/null
@@ -0,0 +1,2 @@
+set tname(tnewstr)     "toldvaluex"
+set tname(tnewstr)     "tnewvalue"
diff --git a/allParam/test/s_store_whitespace.tcl b/allParam/test/s_store_whitespace.tcl
new file mode 100644 (file)
index 0000000..af6f6c2
--- /dev/null
@@ -0,0 +1 @@
+set tname(tnewstr)     "test new value"
index e0b97b65ce56096e3eb3024c57424ded12a13a19..233b1c28bfdcc005e724b7df9a43f4e89d5b0a94 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "s_array.h"
 
-int s_array(const char *testid, const Param *param) {
+int s_array(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstringa";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,6 +19,9 @@ int s_array(const char *testid, const Param *param) {
        printf("%s : Param_getString: Request for Array value.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getString(param, name, idx, &rows, result);
        if ((rows == 1) &&
                result && (strcmp(result, "test1") == 0) &&
@@ -32,6 +37,10 @@ int s_array(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 107f344017dc81636b09ef9fe3f06b163db35ebb..9bc19e8a51b647bfd50b4d68e8f93c9fa928ba0c 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef S_ARRAY_H
 #define S_ARRAY_H
 
-#include <allParam.h>
-
-int s_array(const char *, const Param *);
+int s_array(const char *);
 
 #endif
index adde0a9bdf8512dc975a89b876eed1e12082f2a8..a90930fca9c34636d5ec4bd67b49cce4d6fa9855 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "s_int_available.h"
 
-int s_int_available(const char *testid, const Param *param) {
+int s_int_available(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tint";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,6 +19,9 @@ int s_int_available(const char *testid, const Param *param) {
        printf("%s : Param_getString: String is wanted but int-like value found.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getString(param, name, idx, &rows, result);
        if ((rows == 1) && result && (strcmp(result, "100") == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -30,6 +35,10 @@ int s_int_available(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 90e8436f9327d05ffcc855061433017e3c5fd2f3..333ef6e1437ddb5396329ae64477808eca5108fc 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef S_INT_AVAILABLE_H
 #define S_INT_AVAILABLE_H
 
-#include <allParam.h>
-
-int s_int_available(const char *, const Param *);
+int s_int_available(const char *);
 
 #endif
index 452ccd0d5c870bececeb99cf4a4ec212c9dbda2a..d03b0d5b2d592bc21a34747067b66141898c8627 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "s_lowercase.h"
 
-int s_lowercase(const char *testid, const Param *param) {
+int s_lowercase(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstring";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,6 +19,9 @@ int s_lowercase(const char *testid, const Param *param) {
        printf("%s : Param_getString: Lowercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getString(param, name, idx, &rows, result);
        if ((rows == 1) && result && (strcmp(result, "test100") == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -30,6 +35,10 @@ int s_lowercase(const char *testid, const Param *param) {
                printf("%s : Failed.\n", testid);
 #endif
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 37a1d34fdc639c6503b55d12b9de7cd869053ae4..07f419af9178b1b1780fa6329b9a0ba86276402b 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef S_LOWERCASE_H
 #define S_LOWERCASE_H
 
-#include <allParam.h>
-
-int s_lowercase(const char *, const Param *);
+int s_lowercase(const char *);
 
 #endif
index 6e8d5a3fe3921c89405a4eafb9141ecca20996c3..dc5c1866c2b0f1d8c4bc0aa5c86db7ed76d117d6 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "s_no_index.h"
 
-int s_no_index(const char *testid, const Param *param) {
+int s_no_index(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "bla";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,6 +19,9 @@ int s_no_index(const char *testid, const Param *param) {
        printf("%s : Param_getString: Non-existing idx.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getString(param, name, idx, &rows, result);
        if ((rows == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -30,6 +35,10 @@ int s_no_index(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 3f61605b76e5afe221d5fe7d46e8fb372eedf40d..aff578e7aeabb75ce4f943d13fdebbecaed2bcf2 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef S_NO_INDEX_H
 #define S_NO_INDEX_H
 
-#include <allParam.h>
-
-int s_no_index(const char *, const Param *);
+int s_no_index(const char *);
 
 #endif
diff --git a/allParam/test/string/s_store.c b/allParam/test/string/s_store.c
new file mode 100644 (file)
index 0000000..bf92dc1
--- /dev/null
@@ -0,0 +1,61 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_store.h"
+
+int s_store(const char *testid) {
+       Param *param;
+       const char *name = "tname";
+       const char *idx = "tnewstr";
+       const char *tostore = "tnewvalue";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal1;
+       int retVal2;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_storeString: Simple.\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 && (strcmp(result, tostore) == 0) && (retVal1 == 0) && (retVal2 == 0)) {
+               if(system("diff storage.tcl s_store.tcl")) {
+#ifdef VERBOSE
+                       printf("%s : Failed: Files \"storage.tcl\" and \"s_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: \'%s\'\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/string/s_store.h b/allParam/test/string/s_store.h
new file mode 100644 (file)
index 0000000..f39c079
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef S_STORE_H
+#define S_STORE_H
+
+int s_store(const char *);
+
+#endif
diff --git a/allParam/test/string/s_store_existing.c b/allParam/test/string/s_store_existing.c
new file mode 100644 (file)
index 0000000..01ffd93
--- /dev/null
@@ -0,0 +1,61 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_store_existing.h"
+
+int s_store_existing(const char *testid) {
+       Param *param;
+       const char *name = "tname";
+       const char *idx = "tstring";
+       const char *tostore = "tnewvalue";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal1;
+       int retVal2;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_storeString: 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 && (strcmp(result, tostore) == 0) && (retVal1 == 0) && (retVal2 == 0)) {
+               if(system("diff storage.tcl s_store_existing.tcl")) {
+#ifdef VERBOSE
+                       printf("%s : Failed: Files \"storage.tcl\" and \"s_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: \'%s\'\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/string/s_store_existing.h b/allParam/test/string/s_store_existing.h
new file mode 100644 (file)
index 0000000..becab49
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef S_STORE_H
+#define S_STORE_H
+
+int s_store_existing(const char *);
+
+#endif
diff --git a/allParam/test/string/s_store_multiple.c b/allParam/test/string/s_store_multiple.c
new file mode 100644 (file)
index 0000000..e994363
--- /dev/null
@@ -0,0 +1,64 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_store_multiple.h"
+
+int s_store_multiple(const char *testid) {
+       Param *param;
+       const char *name = "tname";
+       const char *idx = "tnewstr";
+       const char *old = "toldvaluex";
+       const char *new = "tnewvalue";
+       char result[PARAM_MAX_VALUE_LEN];
+       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_storeString(param, name, idx, old);
+       retVal2 = Param_storeString(param, name, idx, new);
+       retVal3 = Param_getString(param, name, idx, &rows, result);
+
+       desParam(param);
+       free(param);
+
+       if ((rows == 1) && result && (strcmp(result, new) == 0) && (retVal1 == 0) && (retVal2 == 0) && (retVal3 == 0)) {
+               if(system("diff storage.tcl s_store_multiple.tcl")) {
+#ifdef VERBOSE
+                       printf("%s : Failed: Files \"storage.tcl\" and \"s_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: \'%s\'\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;
+}
+
diff --git a/allParam/test/string/s_store_multiple.h b/allParam/test/string/s_store_multiple.h
new file mode 100644 (file)
index 0000000..b9983ef
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef S_STORE_MULTIPLE_H
+#define S_STORE_MULTIPLE_H
+
+int s_store_multiple(const char *);
+
+#endif
diff --git a/allParam/test/string/s_store_whitespace.c b/allParam/test/string/s_store_whitespace.c
new file mode 100644 (file)
index 0000000..a2da2d9
--- /dev/null
@@ -0,0 +1,61 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_store_whitespace.h"
+
+int s_store_whitespace(const char *testid) {
+       Param *param;
+       const char *name = "tname";
+       const char *idx = "tnewstr";
+       const char *tostore = "test new value";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal1;
+       int retVal2;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_storeString: Store a string containing a whitespace.\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 && (strcmp(result, tostore) == 0) && (retVal1 == 0) && (retVal2 == 0)) {
+               if(system("diff storage.tcl s_store_whitespace.tcl")) {
+#ifdef VERBOSE
+                       printf("%s : Failed: Files \"storage.tcl\" and \"s_store_whitespace.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: \'%s\', return Value of store call: %d, return 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/string/s_store_whitespace.h b/allParam/test/string/s_store_whitespace.h
new file mode 100644 (file)
index 0000000..2d027f2
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef S_STORE_WHITESPACE_H
+#define S_STORE_WHITESPACE_H
+
+int s_store_whitespace(const char *);
+
+#endif
index c87a4edd083136c4ee43a944db313062fa14cfeb..147a4c69bcf02bb210592f4c04342b3574c8c897 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <allParam.h>
 
 #include "s_uppercase.h"
 
-int s_uppercase(const char *testid, const Param *param) {
+int s_uppercase(const char *testid) {
+       Param *param;
        char *name = "TNAME";
        char *idx = "TSTRING";
        char result[PARAM_MAX_VALUE_LEN];
@@ -17,6 +19,9 @@ int s_uppercase(const char *testid, const Param *param) {
        printf("%s : Param_getString: Uppercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
        retVal = Param_getString(param, name, idx, &rows, result);
        if ((rows == 1) && result && (strcmp(result, "test100") == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -30,6 +35,10 @@ int s_uppercase(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 442510aad65b0dd7e4153a6b7ba405f93b54addc..bc665a59a87955ffc028a465ae089a6eaaf4757c 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef S_UPPERCASE_H
 #define S_UPPERCASE_H
 
-#include <allParam.h>
-
-int s_uppercase(const char *, const Param *);
+int s_uppercase(const char *);
 
 #endif
diff --git a/allParam/test/string/s_whitespace.c b/allParam/test/string/s_whitespace.c
new file mode 100644 (file)
index 0000000..9a30a22
--- /dev/null
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <allParam.h>
+
+#include "s_whitespace.h"
+
+int s_whitespace(const char *testid) {
+       Param *param;
+       char *name = "tname";
+       char *idx = "twhitespace";
+       char result[PARAM_MAX_VALUE_LEN];
+       int rows;
+       int retVal;
+       int myRetVal;
+
+#ifdef VERBOSE
+       printf("%s : Param_getString: Lowercase input on correct statements.\n", testid);
+#endif
+
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       retVal = Param_getString(param, name, idx, &rows, result);
+       if ((rows == 1) && result && (strcmp(result, "test100 whith whitespace") == 0) && (retVal == 0)) {
+               myRetVal = 0;
+               printf("%s : Passed.\n", testid);
+       } else {
+#ifdef VERBOSE
+               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;
+#else
+               printf("%s : Failed.\n", testid);
+#endif
+       }
+
+       desParam(param);
+       free(param);
+
+       return myRetVal;
+}
+
diff --git a/allParam/test/string/s_whitespace.h b/allParam/test/string/s_whitespace.h
new file mode 100644 (file)
index 0000000..e390993
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef S_WHITESPACE_H
+#define S_WHITESPACE_H
+
+int s_whitespace(const char *);
+
+#endif
index 73fb1a3dad544a684d7558a6f5c44d3a49d1bd52..48b5abefdee53023a7a667b6a1b55a8ab324872b 100644 (file)
@@ -1,12 +1,15 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_int_available.h"
 
-int sa_int_available(const char *testid, const Param *param) {
+#define NUM2 32
+
+int sa_int_available(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tinta";
        char *result[NUM2];
@@ -15,13 +18,17 @@ int sa_int_available(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM2 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: String is wanted but Int-like values found.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM2 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM2, &rows, result);
        if ((rows == NUM2) &&
                result[0] && (strcmp(result[0], "1") == 0) &&
@@ -71,6 +78,10 @@ int sa_int_available(const char *testid, const Param *param) {
        for (i = 0 ; i < NUM2 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index d73f9c42e8d170888440387c8e242aa7eca4e233..1f6984be30c25c59eb631a1db1f66c50ee4756c0 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef SA_INT_AVAILABLE_H
 #define SA_INT_AVAILABLE_H
 
-#include <allParam.h>
-
-#define NUM2 32
-
-int sa_int_available(const char *, const Param *);
+int sa_int_available(const char *);
 
 #endif
index 7e459e9e60bb850947d25948efbc11b84b01fe5c..f78ad1531e7a643683ea98f36b9f9290234dfdf7 100644 (file)
@@ -1,12 +1,16 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_long_array.h"
 
-int sa_long_array(const char *testid, const Param *param) {
+#define NUM1 8
+#define NUM5 4
+
+int sa_long_array(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstringa";
        char *result[NUM5];
@@ -15,13 +19,17 @@ int sa_long_array(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM5 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: To many array members available.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM5 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM5, &rows, result);
        if ((rows == NUM5) &&
                result[0] && (strcmp(result[0], "test1") == 0) &&
@@ -43,6 +51,10 @@ int sa_long_array(const char *testid, const Param *param) {
        for (i = 0 ; i < NUM5 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index d87e4e58fcdcf5fd495b869f6783fc404fb1b30b..7529248abfff7bd55fe3580c3cb909bd8152ed05 100644 (file)
@@ -1,11 +1,6 @@
 #ifndef SA_LONG_ARRAY_H
 #define SA_LONG_ARRAY_H
 
-#include <allParam.h>
-
-#define NUM1 8
-#define NUM5 4
-
-int sa_long_array(const char *, const Param *);
+int sa_long_array(const char *);
 
 #endif
index 6c38c2d3fce27fa00af64b5a75bd6a4c35cf9740..2bef8536c375ecd100aaa65d075fd026c75751b8 100644 (file)
@@ -1,12 +1,15 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_lowercase.h"
 
-int sa_lowercase(const char *testid, const Param *param) {
+#define NUM1 8
+
+int sa_lowercase(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstringa";
        char *result[NUM1];
@@ -15,13 +18,17 @@ int sa_lowercase(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM1 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: Lowercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
        if ((rows == NUM1) &&
                result[0] && (strcmp(result[0], "test1") == 0) &&
@@ -53,9 +60,14 @@ int sa_lowercase(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
        for (i = 0 ; i < NUM1 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 07ec0c5a25a3dc901e1cee3a88549dd416cef416..e6169b01f939bdbc768d88fbb19522262815ed77 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef SA_LOWERCASE_H
 #define SA_LOWERCASE_H
 
-#include <allParam.h>
-
-#define NUM1 8
-
-int sa_lowercase(const char *, const Param *);
+int sa_lowercase(const char *);
 
 #endif
index dac8f49887ec14581ea4bbb1543d19a4ef7871fe..0baab58d91e271f5ba687e83e2ec1ead74af872c 100644 (file)
@@ -1,12 +1,15 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_no_index.h"
 
-int sa_no_index(const char *testid, const Param *param) {
+#define NUM1 8
+
+int sa_no_index(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "bla";
        char *result[NUM1];
@@ -15,13 +18,17 @@ int sa_no_index(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM1 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: Non-existing idx.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
        if ((rows == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -35,9 +42,14 @@ int sa_no_index(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
        for (i = 0 ; i < NUM1 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index fda7240e7edd9290fd3974f22e08a969ba59ed67..9847930d37a4e8312cf4bb678eab2e9f61eb3e29 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef SA_NO_INDEX_H
 #define SA_NO_INDEX_H
 
-#include <allParam.h>
-
-#define NUM1 8
-
-int sa_no_index(const char *, const Param *);
+int sa_no_index(const char *);
 
 #endif
index 4699bf8fb66ddd602ad51e0bbf2b8e4c6f58c151..f072735829a3528f6f08284fdd78251088ca91e1 100644 (file)
@@ -1,12 +1,15 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_scalar.h"
 
-int sa_scalar(const char *testid, const Param *param) {
+#define NUM1 8
+
+int sa_scalar(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstring";
        char *result[NUM1];
@@ -15,13 +18,17 @@ int sa_scalar(const char *testid, const Param *param) {
        int retVal;
        int myRetVal;
 
-       for (i = 0 ; i < NUM1 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: Request for a scalar value.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
        if ((rows == 1) && result && (strcmp(result[0], "test100") == 0) && (retVal == 0)) {
                myRetVal = 0;
@@ -35,9 +42,14 @@ int sa_scalar(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
        for (i = 0 ; i < NUM1 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 1eff646921f3ed74008356c0c116c7594d729e16..9f38e423a5ea1fb134ad1c146cb21a2386eb62b6 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef SA_SCALAR_H
 #define SA_SCALAR_H
 
-#include <allParam.h>
-
-#define NUM1 8
-
-int sa_scalar(const char *, const Param *);
+int sa_scalar(const char *);
 
 #endif
index f46e62cf81660ed0b5a1a0cc7d9a839519702d9e..6296ab7d43e87128dcdaa5466f398bcf2f6be1ad 100644 (file)
@@ -1,12 +1,16 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_short_array.h"
 
-int sa_short_array(const char *testid, const Param *param) {
+#define NUM1 8
+#define NUM3 16
+
+int sa_short_array(const char *testid) {
+       Param *param;
        char *name = "tname";
        char *idx = "tstringa";
        char *result[NUM3];
@@ -15,13 +19,17 @@ int sa_short_array(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM3 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: To few array members available.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM3 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM3, &rows, result);
        if ((rows == NUM1) &&
                result[0] && (strcmp(result[0], "test1") == 0) &&
@@ -44,9 +52,14 @@ int sa_short_array(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
        for (i = 0 ; i < NUM3 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 95fd0d6c460d279b491697d933571dd0a2194876..d46d5c5d8338d069a8f69ced24caf15175400b37 100644 (file)
@@ -1,11 +1,6 @@
 #ifndef SA_SHORT_ARRAY_H
 #define SA_SHORT_ARRAY_H
 
-#include <allParam.h>
-
-#define NUM1 8
-#define NUM3 16
-
-int sa_short_array(const char *, const Param *);
+int sa_short_array(const char *);
 
 #endif
index 33c3dad23c214186368c6701796e9ab93ea5a9ed..b5dbb3dc1236c68ffd12c911ce6e9a29c32204b5 100644 (file)
@@ -1,12 +1,15 @@
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <allParam.h>
 
 #include "sa_uppercase.h"
 
-int sa_uppercase(const char *testid, const Param *param) {
+#define NUM1 8
+
+int sa_uppercase(const char *testid) {
+       Param *param;
        char *name = "TNAME";
        char *idx = "TSTRINGA";
        char *result[NUM1];
@@ -15,13 +18,17 @@ int sa_uppercase(const char *testid, const Param *param) {
        int myRetVal;
        int i;
 
-       for (i = 0 ; i < NUM1 ; i++) {
-               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
-       }
 #ifdef VERBOSE
        printf("%s : Param_getStringArray: Uppercase input on correct statements.\n", testid);
 #endif
 
+       param = malloc(sizeof(Param));
+       conParam(param);
+
+       for (i = 0 ; i < NUM1 ; i++) {
+               result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
+       }
+
        retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
        if ((rows == NUM1) &&
                result[0] && (strcmp(result[0], "test1") == 0) &&
@@ -53,9 +60,14 @@ int sa_uppercase(const char *testid, const Param *param) {
 #endif
                myRetVal = -1;
        }
+
        for (i = 0 ; i < NUM1 ; i++) {
                free(result[i]);
        }
+
+       desParam(param);
+       free(param);
+
        return myRetVal;
 }
 
index 2ab07e653036261c8f86af1e35f8e40a09f2e2d4..96b634bc256746285ab0494bdda2b011a2cbfac8 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef SA_UPPERCASE_H
 #define SA_UPPERCASE_H
 
-#include <allParam.h>
-
-#define NUM1 8
-
-int sa_uppercase(const char *, const Param *);
+int sa_uppercase(const char *);
 
 #endif
index 146eeaeade32f8f4fa00a8f6777c517a001c0112..b50fe28cfa5a3798c93679adacc9fd411ffc0656 100644 (file)
@@ -1,5 +1,7 @@
-set file(rname) test.blob
-set file(aname) /test.blob
+set file(rname) test0.blob
+set file(aname) /test0.blob
+set file(rnamellarge) test1.blob
+set file(rnameodd) test2.blob
 
 set file(namea0) test1.blob
 set file(namea1) /test0.blob