#include <unistd.h>
#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
found = 0;
retVal = 0;
}
- *val = tmpfile();
+ if((*val = tmpfile()) == NULL) {
+ Param_strerror((Param *) my, strerror(errno));
+ found = 0;
+ retVal = -1;
+ }
+
if(found == 1) {
ParamBlobResult resultS, *result = &resultS;
result->val = val;
static void Param_copyIntsToAllocMem(struct event_handler_args args)
{
+#if 1
int i;
+#endif
ParamIntResult *result = args.usr;
+#if 0
dbr_long_t *buffer = (dbr_long_t *) args.dbr;
-
+#endif
+
*(result->rows) = (args.count > result->maxrows) ?
result->maxrows :
args.count;
if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
+ memcpy(result->val, (dbr_long_t *) args.dbr, (sizeof(dbr_long_t) * *(result->rows)));
for(i = 0 ; i < *(result->rows) ; i++) {
- (result->val)[i] = buffer[i];
#if 0
- fprintf(stderr, "val[%d] received: %ld\n", i, (result->val)[i]);
+ (result->val)[i] = buffer[i];
#endif
+ fprintf(stderr, "val[%d] received: %ld\n", i, (result->val)[i]);
}
} else {
Param_strerror((Param *) result->my, ca_message(args.status));
{
ParamBlobResult *result = args.usr;
dbr_long_t *buffer = (dbr_long_t *) args.dbr;
-
- *(result->size) = args.count;
if(args.type == DBR_LONG && args.status == ECA_NORMAL) {
- fwrite(buffer, sizeof(dbr_long_t), *(result->size), *result->val);
- rewind(*result->val);
+ *(result->size) = *buffer;
+ fwrite(buffer + 1, 1, *(result->size), *(result->val));
+ fflush(*(result->val));
+ rewind(*(result->val));
} else {
Param_strerror((Param *) result->my, ca_message(args.status));
*(result->size) = 0;
#include "paramBlobRecord.h"
+#define EPICS_MAX_INDEX 4092
+
ParamBlobRecord::ParamBlobRecord(caServer& cas, const Param *p, const char *rn, const char *u) :
ParamRecord(cas, p, rn, u)
{
FILE *tmp;
if(Param_getBlob(param, name, idx, &size, &tmp) == 0) {
index = (unsigned int) ((size - 1) / sizeof(aitUint32)) + 2;
+ if (index > EPICS_MAX_INDEX) {
+ index = 0;
+ }
} else {
index = 0;
}
retVal = Param_getBlob(param, name, idx, &size, &blob);
index = 2 + (((unsigned int) size - 1) / sizeof(aitUint32));
- if((retVal != 0) || (index == 0)) {
+ if((retVal != 0) || (index == 0) || (index > EPICS_MAX_INDEX)) {
return S_cas_noRead;
} else {
aitUint32 *ourValue = new aitUint32[index];
retVal = Param_getBlob(param, name, idx, &size, &blob);
index = 2 + (((unsigned int) size - 1) / sizeof(aitUint32));
- if((retVal != 0) || (index == 0)) {
+ if((retVal != 0) || (index == 0) || (index > EPICS_MAX_INDEX)) {
return S_cas_noRead;
} else {
aitUint32 *ourValue = new aitUint32[index];
val->putConvert(intValue);
} else {
aitUint32 *intValue = new aitUint32[index];
- for (unsigned int k = 0 ; k < index ; k++) {
+ for (unsigned int k = 0 ; k < index ; k++) {
intValue[k] = ourValue[k];
-#if 0
+#if 1
fprintf(stderr, "intValue[%d] put: %d\n", k, intValue[k]);
#endif
}
int b_odd_size(const char *testid) {
Param *param;
char *name = "file";
- char *idx = "rname";
+ char *idx = "rnameodd";
FILE *result;
FILE *store;
size_t size;
conSetupParam(param, testid);
retVal = Param_getBlob(param, name, idx, &size, &result);
- if (((size == file->st_size) && (retVal == 0)) {
+ if ((size == file->st_size) && (retVal == 0)) {
int buf;
store = fopen("test1.blob", "w+");
while((buf = fgetc(result)) != EOF) {
set file(rname) test0.blob
set file(aname) /test0.blob
-set file(rnamellarge) test1.blob
+set file(rnamelarge) test1.blob
set file(rnameodd) test2.blob
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test1.h"
-
-int test1(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstring";
- 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, "test100") == 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;
-}
-
+++ /dev/null
-#ifndef TEST1_H
-#define TEST1_H
-
-#include <allParam.h>
-
-int test1(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test10.h"
-
-int test10(const char *testid, const Param *param) {
- char *name = "tname";
- 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;
-}
-
+++ /dev/null
-#ifndef TEST10_H
-#define TEST10_H
-
-#include <allParam.h>
-
-int test10(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test11.h"
-
-int test11(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tint";
- 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;
-}
-
+++ /dev/null
-#ifndef TEST11_H
-#define TEST11_H
-
-#include <allParam.h>
-
-int test11(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test12.h"
-
-int test12(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstring";
- 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;
-}
-
+++ /dev/null
-#ifndef TEST12_H
-#define TEST12_H
-
-#include <allParam.h>
-
-int test12(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test13.h"
-
-int test13(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "bla";
- 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;
-}
-
+++ /dev/null
-#ifndef TEST13_H
-#define TEST13_H
-
-#include <allParam.h>
-
-#define NUM1 8
-
-int test13(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test14.h"
-
-int test14(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "bla";
- unsigned long int result[NUM2];
- int rows;
- 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;
-}
-
+++ /dev/null
-#ifndef TEST14_H
-#define TEST14_H
-
-#include <allParam.h>
-
-#define NUM2 32
-
-int test14(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test15.h"
-
-int test15(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstringa";
- 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], "test1") == 0) &&
- result[1] && (strcmp(result[1], "test0") == 0) &&
- result[2] && (strcmp(result[2], "test3") == 0) &&
- result[3] && (strcmp(result[3], "test2") == 0) &&
- result[4] && (strcmp(result[4], "test5") == 0) &&
- result[5] && (strcmp(result[5], "test4") == 0) &&
- result[6] && (strcmp(result[6], "test7") == 0) &&
- result[7] && (strcmp(result[7], "test6") == 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;
-}
-
+++ /dev/null
-#ifndef TEST15_H
-#define TEST15_H
-
-#include <allParam.h>
-
-#define NUM1 8
-#define NUM3 16
-
-int test15(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test16.h"
-
-int test16(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tinta";
- 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] == i + 1 - 2*(i%2));
- }
- 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;
-}
-
+++ /dev/null
-#ifndef TEST16_H
-#define TEST16_H
-
-#include <allParam.h>
-
-#define NUM2 32
-#define NUM4 64
-
-int test16(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test17.h"
-
-int test17(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstringa";
- 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], "test1") == 0) &&
- result[1] && (strcmp(result[1], "test0") == 0) &&
- result[2] && (strcmp(result[2], "test3") == 0) &&
- result[3] && (strcmp(result[3], "test2") == 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;
-}
-
+++ /dev/null
-#ifndef TEST17_H
-#define TEST17_H
-
-#include <allParam.h>
-
-#define NUM1 8
-#define NUM5 4
-
-int test17(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test18.h"
-
-int test18(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tinta";
- 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] == i + 1 - 2*(i%2));
- }
- 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;
-}
-
+++ /dev/null
-#ifndef TEST18_H
-#define TEST18_H
-
-#include <allParam.h>
-
-#define NUM2 32
-#define NUM6 16
-
-int test18(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test19.h"
-
-int test19(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tinta";
- 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], "1") == 0) &&
- result[1] && (strcmp(result[1], "0") == 0) &&
- result[2] && (strcmp(result[2], "3") == 0) &&
- result[3] && (strcmp(result[3], "2") == 0) &&
- result[4] && (strcmp(result[4], "5") == 0) &&
- result[5] && (strcmp(result[5], "4") == 0) &&
- result[6] && (strcmp(result[6], "7") == 0) &&
- result[7] && (strcmp(result[7], "6") == 0) &&
- result[8] && (strcmp(result[8], "9") == 0) &&
- result[9] && (strcmp(result[9], "8") == 0) &&
- result[10] && (strcmp(result[10], "11") == 0) &&
- result[11] && (strcmp(result[11], "10") == 0) &&
- result[12] && (strcmp(result[12], "13") == 0) &&
- result[13] && (strcmp(result[13], "12") == 0) &&
- result[14] && (strcmp(result[14], "15") == 0) &&
- result[15] && (strcmp(result[15], "14") == 0) &&
- result[16] && (strcmp(result[16], "17") == 0) &&
- result[17] && (strcmp(result[17], "16") == 0) &&
- result[18] && (strcmp(result[18], "19") == 0) &&
- result[19] && (strcmp(result[19], "18") == 0) &&
- result[20] && (strcmp(result[20], "21") == 0) &&
- result[21] && (strcmp(result[21], "20") == 0) &&
- result[22] && (strcmp(result[22], "23") == 0) &&
- result[23] && (strcmp(result[23], "22") == 0) &&
- result[24] && (strcmp(result[24], "25") == 0) &&
- result[25] && (strcmp(result[25], "24") == 0) &&
- result[26] && (strcmp(result[26], "27") == 0) &&
- result[27] && (strcmp(result[27], "26") == 0) &&
- result[28] && (strcmp(result[28], "29") == 0) &&
- result[29] && (strcmp(result[29], "28") == 0) &&
- result[30] && (strcmp(result[30], "31") == 0) &&
- result[31] && (strcmp(result[31], "30") == 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;
-}
-
+++ /dev/null
-#ifndef TEST19_H
-#define TEST19_H
-
-#include <allParam.h>
-
-#define NUM2 32
-
-int test19(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test2.h"
-
-int test2(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tint";
- 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: \'%ld\', return Value: %d.\n", testid, rows, result, retVal);
- printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
- myRetVal = -1;
- }
- return myRetVal;
-}
-
+++ /dev/null
-#ifndef TEST2_H
-#define TEST2_H
-
-#include <allParam.h>
-
-int test2(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test20.h"
-
-int test20(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstringa";
- unsigned long int result[NUM1];
- int rows;
- 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;
-}
-
+++ /dev/null
-#ifndef TEST20_H
-#define TEST20_H
-
-#include <allParam.h>
-
-#define NUM1 8
-
-int test20(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test21.h"
-
-int test21(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstring";
- char *result[NUM1];
- int i;
- int rows;
- int retVal;
- int myRetVal;
-
- for (i = 0 ; i < NUM1 ; i++) {
- result[i] = malloc(PARAM_MAX_VALUE_LEN * sizeof(char));
- }
- printf("%s : Param_getStringArray: Request for a scalar value.\n", testid);
-
- retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result);
- if ((rows == 1) && result && (strcmp(result[0], "test100") == 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[0], retVal);
- printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
- myRetVal = -1;
- }
- for (i = 0 ; i < NUM1 ; i++) {
- free(result[i]);
- }
- return myRetVal;
-}
-
+++ /dev/null
-#ifndef TEST21_H
-#define TEST21_H
-
-#include <allParam.h>
-
-#define NUM1 8
-
-int test21(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test22.h"
-
-int test22(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstringa";
- char result[PARAM_MAX_VALUE_LEN];
- int rows;
- int retVal;
- int myRetVal;
-
- printf("%s : Param_getString: Request for Array value.\n", testid);
-
- retVal = Param_getString(param, name, idx, &rows, result);
- if ((rows == 1) &&
- result && (strcmp(result, "test1") == 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;
-}
-
+++ /dev/null
-#ifndef TEST22_H
-#define TEST22_H
-
-#include <allParam.h>
-
-int test22(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test3.h"
-
-int test3(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tstringa";
- 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], "test1") == 0) &&
- result[1] && (strcmp(result[1], "test0") == 0) &&
- result[2] && (strcmp(result[2], "test3") == 0) &&
- result[3] && (strcmp(result[3], "test2") == 0) &&
- result[4] && (strcmp(result[4], "test5") == 0) &&
- result[5] && (strcmp(result[5], "test4") == 0) &&
- result[6] && (strcmp(result[6], "test7") == 0) &&
- result[7] && (strcmp(result[7], "test6") == 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;
-}
-
+++ /dev/null
-#ifndef TEST3_H
-#define TEST3_H
-
-#include <allParam.h>
-
-#define NUM1 8
-
-int test3(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test4.h"
-
-int test4(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "tinta";
- 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] == i + 1 - 2*(i%2));
- }
- 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]: %ld.\n", i, result[i]);
- }
- printf("return Value: %d.\n", retVal);
- printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
- myRetVal = -1;
- }
- return myRetVal;
-}
-
+++ /dev/null
-#ifndef TEST4_H
-#define TEST4_H
-
-#include <allParam.h>
-
-#define NUM2 32
-
-int test4(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test5.h"
-
-int test5(const char *testid, const Param *param) {
- char *name = "TNAME";
- char *idx = "TSTRING";
- 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, "test100") == 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;
-}
-
+++ /dev/null
-#ifndef TEST5_H
-#define TEST5_H
-
-#include <allParam.h>
-
-int test5(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test6.h"
-
-int test6(const char *testid, const Param *param) {
- char *name = "TNAME";
- char *idx = "TINT";
- 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: \'%ld\', return Value: %d.\n", testid, rows, result, retVal);
- printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
- myRetVal = -1;
- }
- return myRetVal;
-}
-
+++ /dev/null
-#ifndef TEST6_H
-#define TEST6_H
-
-#include <allParam.h>
-
-int test6(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <allParam.h>
-
-#include "test7.h"
-
-int test7(const char *testid, const Param *param) {
- char *name = "TNAME";
- char *idx = "TSTRINGA";
- 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], "test1") == 0) &&
- result[1] && (strcmp(result[1], "test0") == 0) &&
- result[2] && (strcmp(result[2], "test3") == 0) &&
- result[3] && (strcmp(result[3], "test2") == 0) &&
- result[4] && (strcmp(result[4], "test5") == 0) &&
- result[5] && (strcmp(result[5], "test4") == 0) &&
- result[6] && (strcmp(result[6], "test7") == 0) &&
- result[7] && (strcmp(result[7], "test6") == 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;
-}
-
+++ /dev/null
-#ifndef TEST7_H
-#define TEST7_H
-
-#include <allParam.h>
-
-#define NUM1 8
-
-int test7(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test8.h"
-
-int test8(const char *testid, const Param *param) {
- char *name = "TNAME";
- char *idx = "TINTA";
- 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] == i + 1 - 2*(i%2));
- }
- 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]: %ld.\n", i, result[i]);
- }
- printf("return Value: %d.\n", retVal);
- printf("%s : Error string: %s\n", testid, Param_getErrStr(param));
- myRetVal = -1;
- }
- return myRetVal;
-}
-
+++ /dev/null
-#ifndef TEST8_H
-#define TEST8_H
-
-#include <allParam.h>
-
-#define NUM2 32
-
-int test8(const char *, const Param *);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-#include <allParam.h>
-
-#include "test9.h"
-
-int test9(const char *testid, const Param *param) {
- char *name = "tname";
- char *idx = "bla";
- 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;
-}
-
+++ /dev/null
-#ifndef TEST9_H
-#define TEST9_H
-
-#include <allParam.h>
-
-int test9(const char *, const Param *);
-
-#endif