From 06900fb0e1f29f834dc873bc362e05ee2fa44f23 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 27 Mar 2001 14:07:20 +0000 Subject: [PATCH] *** empty log message *** --- allParam/VERSION | 2 +- allParam/ca/client/caParam.c | 13 +- allParam/ca/server/paramBlobRecord.cc | 18 +- allParam/ca/server/paramFilenameRecord.cc | 68 +- allParam/ca/server/paramIntRecord.cc | 14 +- allParam/ca/server/paramRecordSet.cc | 4 + allParam/ca/server/paramStringRecord.cc | 81 ++- allParam/ca/server/record.cc | 4 +- allParam/tcl/tclParam.c | 1 - allParam/test/Makefile | 180 +++--- allParam/test/bin/echoobjs.sh | 2 +- allParam/test/bin/main.sh | 2 +- allParam/test/blob/BLOB | 739 ++++++++++++++++++++++ allParam/test/blob/Makefile | 12 + allParam/test/filename/Makefile | 12 + allParam/test/int/Makefile | 12 + allParam/test/int/i_lowercase.c | 35 + allParam/test/int/i_lowercase.h | 8 + allParam/test/int/i_no_index.c | 35 + allParam/test/int/i_no_index.h | 8 + allParam/test/int/i_string_available.c | 35 + allParam/test/int/i_string_available.h | 8 + allParam/test/int/i_uppercase.c | 35 + allParam/test/int/i_uppercase.h | 8 + allParam/test/int/ia_long_array.c | 40 ++ allParam/test/int/ia_long_array.h | 11 + allParam/test/int/ia_lowercase.c | 44 ++ allParam/test/int/ia_lowercase.h | 10 + allParam/test/int/ia_no_index.c | 35 + allParam/test/int/ia_no_index.h | 10 + allParam/test/int/ia_short_array.c | 40 ++ allParam/test/int/ia_short_array.h | 11 + allParam/test/int/ia_string_available.c | 35 + allParam/test/int/ia_string_available.h | 10 + allParam/test/int/ia_uppercase.c | 44 ++ allParam/test/int/ia_uppercase.h | 10 + allParam/test/string/Makefile | 12 + allParam/test/string/s_array.c | 37 ++ allParam/test/string/s_array.h | 8 + allParam/test/string/s_int_available.c | 35 + allParam/test/string/s_int_available.h | 8 + allParam/test/string/s_lowercase.c | 35 + allParam/test/string/s_lowercase.h | 8 + allParam/test/string/s_no_index.c | 35 + allParam/test/string/s_no_index.h | 8 + allParam/test/string/s_uppercase.c | 35 + allParam/test/string/s_uppercase.h | 8 + allParam/test/string/sa_int_available.c | 76 +++ allParam/test/string/sa_int_available.h | 10 + allParam/test/string/sa_long_array.c | 48 ++ allParam/test/string/sa_long_array.h | 11 + allParam/test/string/sa_lowercase.c | 61 ++ allParam/test/string/sa_lowercase.h | 10 + allParam/test/string/sa_no_index.c | 43 ++ allParam/test/string/sa_no_index.h | 10 + allParam/test/string/sa_scalar.c | 43 ++ allParam/test/string/sa_scalar.h | 10 + allParam/test/string/sa_short_array.c | 52 ++ allParam/test/string/sa_short_array.h | 11 + allParam/test/string/sa_uppercase.c | 61 ++ allParam/test/string/sa_uppercase.h | 10 + allParam/test/suite.c | 89 +-- 62 files changed, 2237 insertions(+), 173 deletions(-) create mode 100644 allParam/test/blob/BLOB create mode 100644 allParam/test/blob/Makefile create mode 100644 allParam/test/filename/Makefile create mode 100644 allParam/test/int/Makefile create mode 100644 allParam/test/int/i_lowercase.c create mode 100644 allParam/test/int/i_lowercase.h create mode 100644 allParam/test/int/i_no_index.c create mode 100644 allParam/test/int/i_no_index.h create mode 100644 allParam/test/int/i_string_available.c create mode 100644 allParam/test/int/i_string_available.h create mode 100644 allParam/test/int/i_uppercase.c create mode 100644 allParam/test/int/i_uppercase.h create mode 100644 allParam/test/int/ia_long_array.c create mode 100644 allParam/test/int/ia_long_array.h create mode 100644 allParam/test/int/ia_lowercase.c create mode 100644 allParam/test/int/ia_lowercase.h create mode 100644 allParam/test/int/ia_no_index.c create mode 100644 allParam/test/int/ia_no_index.h create mode 100644 allParam/test/int/ia_short_array.c create mode 100644 allParam/test/int/ia_short_array.h create mode 100644 allParam/test/int/ia_string_available.c create mode 100644 allParam/test/int/ia_string_available.h create mode 100644 allParam/test/int/ia_uppercase.c create mode 100644 allParam/test/int/ia_uppercase.h create mode 100644 allParam/test/string/Makefile create mode 100644 allParam/test/string/s_array.c create mode 100644 allParam/test/string/s_array.h create mode 100644 allParam/test/string/s_int_available.c create mode 100644 allParam/test/string/s_int_available.h create mode 100644 allParam/test/string/s_lowercase.c create mode 100644 allParam/test/string/s_lowercase.h create mode 100644 allParam/test/string/s_no_index.c create mode 100644 allParam/test/string/s_no_index.h create mode 100644 allParam/test/string/s_uppercase.c create mode 100644 allParam/test/string/s_uppercase.h create mode 100644 allParam/test/string/sa_int_available.c create mode 100644 allParam/test/string/sa_int_available.h create mode 100644 allParam/test/string/sa_long_array.c create mode 100644 allParam/test/string/sa_long_array.h create mode 100644 allParam/test/string/sa_lowercase.c create mode 100644 allParam/test/string/sa_lowercase.h create mode 100644 allParam/test/string/sa_no_index.c create mode 100644 allParam/test/string/sa_no_index.h create mode 100644 allParam/test/string/sa_scalar.c create mode 100644 allParam/test/string/sa_scalar.h create mode 100644 allParam/test/string/sa_short_array.c create mode 100644 allParam/test/string/sa_short_array.h create mode 100644 allParam/test/string/sa_uppercase.c create mode 100644 allParam/test/string/sa_uppercase.h diff --git a/allParam/VERSION b/allParam/VERSION index c946ee6..1180819 100644 --- a/allParam/VERSION +++ b/allParam/VERSION @@ -1 +1 @@ -0.1.6 +0.1.7 diff --git a/allParam/ca/client/caParam.c b/allParam/ca/client/caParam.c index 53ca1e5..c35c436 100644 --- a/allParam/ca/client/caParam.c +++ b/allParam/ca/client/caParam.c @@ -500,7 +500,18 @@ static void Param_copyBlobToAllocMem(struct event_handler_args args) *(result->size) = args.count; if(args.type == DBR_LONG && args.status == ECA_NORMAL) { - fwrite(buffer, sizeof(dbr_long_t), *(result->size), result->val); +#if 0 + FILE *reference; +#endif + fprintf(stderr, "Seems to be the right type of data.\n"); + fprintf(stderr, "%d blocks of each %d bytes length read.\n", *(result->size), sizeof(dbr_long_t)); +#if 0 + reference = fopen("xx", "w+b"); + fwrite(buffer, sizeof(dbr_long_t), *(result->size), reference); + fclose(reference); +#endif + fwrite(buffer, sizeof(dbr_long_t), *(result->size), *result->val); + rewind(*result->val); } else { Param_strerror((Param *) result->my, ca_message(args.status)); *(result->size) = 0; diff --git a/allParam/ca/server/paramBlobRecord.cc b/allParam/ca/server/paramBlobRecord.cc index 3d63606..a67c416 100644 --- a/allParam/ca/server/paramBlobRecord.cc +++ b/allParam/ca/server/paramBlobRecord.cc @@ -10,7 +10,15 @@ extern "C" { ParamBlobRecord::ParamBlobRecord(caServer& cas, const Param *p, const char *rn, const char *u) : ParamRecord(cas, p, rn, u) { - index = 0; + size_t size; + FILE *tmp; + if(Param_getBlob(param, name, idx, &size, &tmp) == 0) { + index = (unsigned int) (size + 1) / sizeof(aitUint32); + } else { + index = 0; + } + fclose(tmp); + funcTable.installReadFunc("units", &Record::readUnits); funcTable.installReadFunc("status", &Record::readStatus); funcTable.installReadFunc("severity", &Record::readSeverity); @@ -75,7 +83,7 @@ caStatus ParamBlobRecord::scan() FILE *blob; size_t size; int retVal; - ArrayDestructor *pDest; + ArrayDestructor *pDest = new ArrayDestructor; caServer *pCAS = this->getCAS(); @@ -86,12 +94,14 @@ caStatus ParamBlobRecord::scan() } else { aitUint32 *ourValue = new aitUint32[index]; fread(ourValue, sizeof(aitUint32), index, blob); +#if 0 + size_t howmuch = fread(ourValue, sizeof(aitUint32), index, blob); + fprintf(stderr, "Called fread() with size %d\nnmemb %d\nRead %d\n", (int) sizeof(aitUint32), (int) index, (int) howmuch); +#endif fclose(blob); val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); - pDest = new ArrayDestructor; - val->putRef(ourValue, pDest); } diff --git a/allParam/ca/server/paramFilenameRecord.cc b/allParam/ca/server/paramFilenameRecord.cc index b0637a2..62a51b9 100644 --- a/allParam/ca/server/paramFilenameRecord.cc +++ b/allParam/ca/server/paramFilenameRecord.cc @@ -9,7 +9,21 @@ extern "C" { ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) : ParamRecord(cas, p, rn, u) { - index = 0; + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = (unsigned int) rows; + } else { + index = 0; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + funcTable.installReadFunc("units", &Record::readUnits); funcTable.installReadFunc("status", &Record::readStatus); funcTable.installReadFunc("severity", &Record::readSeverity); @@ -53,12 +67,22 @@ epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value) { - if(index == 1) { - aitString stringValue = new aitString; + gddAppFuncTableStatus retVal; + int pretVal; + int rows; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } - stringValue = ourValue[0]; + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; value.putConvert(stringValue); + retVal = S_casApp_success; } else { aitString *stringValue; stringValue = new aitString[index]; @@ -67,36 +91,52 @@ gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value) } value.putRef(stringValue); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; } - return S_casApp_success; + return retVal; } caStatus ParamFilenameRecord::scan() { caStatus retVal; caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; - if(index == 1) { - aitString stringValue = new aitString; - val = new gddScalar(gddAppType_value, aitEnumString); + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } - stringValue = ourValue[0]; + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + val = new gddScalar(gddAppType_value, aitEnumString); val->putConvert(stringValue); + retVal = S_casApp_success; } else { aitString *stringValue; - - val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); - stringValue = new aitString[index]; for (unsigned int k = 0 ; k < index ; k++) { stringValue[k] = ourValue[k]; } - ArrayDestructor *pDest = new ArrayDestructor; + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; } val->setStat(epicsAlarmNone); @@ -107,7 +147,7 @@ caStatus ParamFilenameRecord::scan() this->postEvent (select, *val); } - retVal = S_cas_success; + delete pDest; return retVal; } diff --git a/allParam/ca/server/paramIntRecord.cc b/allParam/ca/server/paramIntRecord.cc index fdbfa6f..378fff3 100644 --- a/allParam/ca/server/paramIntRecord.cc +++ b/allParam/ca/server/paramIntRecord.cc @@ -9,7 +9,14 @@ extern "C" { ParamIntRecord::ParamIntRecord(caServer& cas, const Param *p, const char *rn, const char *u) : ParamRecord(cas, p, rn, u) { - index = 0; + int rows; + unsigned long int tmp[PARAM_MAX_ARRAY_LEN]; + + if(Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = rows == 0 ? 1 : (unsigned int) rows; + } else { + index = 1; + } funcTable.installReadFunc("units", &Record::readUnits); funcTable.installReadFunc("status", &Record::readStatus); funcTable.installReadFunc("severity", &Record::readSeverity); @@ -55,6 +62,7 @@ gddAppFuncTableStatus ParamIntRecord::readValue(gdd &value) retVal = Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); index = (unsigned int) rows; if((retVal != 0) || (index == 0)) { + index = 1; return S_cas_noRead; } else if(index == 1) { aitUint32 intValue; @@ -81,11 +89,12 @@ caStatus ParamIntRecord::scan() int rows; int retVal; - ArrayDestructor *pDest; + ArrayDestructor *pDest = new ArrayDestructor; retVal = Param_getIntArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); index = (unsigned int) rows; if((retVal != 0) || (index == 0)) { + index = 1; return S_cas_noRead; } else if(index == 1) { aitUint32 intValue; @@ -95,7 +104,6 @@ caStatus ParamIntRecord::scan() val->putConvert(intValue); } else { - pDest = new ArrayDestructor; aitUint32 *intValue = new aitUint32[index]; for (unsigned int k = 0 ; k < index ; k++) { intValue[k] = ourValue[k]; diff --git a/allParam/ca/server/paramRecordSet.cc b/allParam/ca/server/paramRecordSet.cc index b2c624b..de883a2 100644 --- a/allParam/ca/server/paramRecordSet.cc +++ b/allParam/ca/server/paramRecordSet.cc @@ -131,15 +131,19 @@ pvCreateReturn ParamRecordSet::createPV(const casCtx &ctx, const char *pPVName) switch (type) { case('I'): retVal = (pvs[numPv++] = new ParamIntRecord(*this, pParam(setup), pPVName, "Integer")); + syslog(LOG_DEBUG, "Created Integer Record %s", pPVName); break; case('S'): retVal = (pvs[numPv++] = new ParamStringRecord(*this, pParam(setup), pPVName, "String")); + syslog(LOG_DEBUG, "Created String Record %s", pPVName); break; case('F'): retVal = (pvs[numPv++] = new ParamFilenameRecord(*this, pParam(setup), pPVName, "Filename")); + syslog(LOG_DEBUG, "Created Filename Record %s", pPVName); break; case('B'): retVal = (pvs[numPv++] = new ParamBlobRecord(*this, pParam(setup), pPVName, "Binary Large OBject")); + syslog(LOG_DEBUG, "Created Blob Record %s", pPVName); break; } return retVal; diff --git a/allParam/ca/server/paramStringRecord.cc b/allParam/ca/server/paramStringRecord.cc index 060228c..b5fde08 100644 --- a/allParam/ca/server/paramStringRecord.cc +++ b/allParam/ca/server/paramStringRecord.cc @@ -9,7 +9,21 @@ extern "C" { ParamStringRecord::ParamStringRecord(caServer& cas, const Param *p, const char *rn, const char *u) : ParamRecord(cas, p, rn, u) { - index = 0; + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = rows == 0 ? 1 : (unsigned int) rows; + } else { + index = 1; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + funcTable.installReadFunc("units", &Record::readUnits); funcTable.installReadFunc("status", &Record::readStatus); funcTable.installReadFunc("severity", &Record::readSeverity); @@ -53,12 +67,23 @@ epicsShareFunc aitIndex ParamStringRecord::maxBound(unsigned dimension) const gddAppFuncTableStatus ParamStringRecord::readValue(gdd &value) { - if(index == 1) { - aitString stringValue = new aitString; + gddAppFuncTableStatus retVal; + int pretVal; + int rows; - stringValue = ourValue[0]; + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + index = 1; + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; value.putConvert(stringValue); + retVal = S_casApp_success; } else { aitString *stringValue; stringValue = new aitString[index]; @@ -67,36 +92,53 @@ gddAppFuncTableStatus ParamStringRecord::readValue(gdd &value) } value.putRef(stringValue); + retVal = S_casApp_success; } - return S_casApp_success; + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + return retVal; } caStatus ParamStringRecord::scan() { caStatus retVal; caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; - if(index == 1) { - aitString stringValue = new aitString; - val = new gddScalar(gddAppType_value, aitEnumString); + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } - stringValue = ourValue[0]; + pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + index = 1; + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + val = new gddScalar(gddAppType_value, aitEnumString); val->putConvert(stringValue); + retVal = S_casApp_success; } else { aitString *stringValue; - - val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); - stringValue = new aitString[index]; for (unsigned int k = 0 ; k < index ; k++) { stringValue[k] = ourValue[k]; } - ArrayDestructor *pDest = new ArrayDestructor; + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; } val->setStat(epicsAlarmNone); @@ -107,7 +149,7 @@ caStatus ParamStringRecord::scan() this->postEvent (select, *val); } - retVal = S_cas_success; + delete pDest; return retVal; } @@ -122,11 +164,12 @@ caStatus ParamStringRecord::write(const casCtx &ctx, gdd &value) aitString stringValue; value.getConvert(stringValue); - - char ourValue[PARAM_MAX_VALUE_LEN]; - strcpy(ourValue, (const char *) stringValue); - - Param_storeString(param, name, idx, ourValue); +#if 0 + char ourScalarValue[PARAM_MAX_VALUE_LEN]; + strcpy(ourScalarValue, (const char *) stringValue); + Param_storeString(param, name, idx, ourScalarValue); +#endif + Param_storeString(param, name, idx, (const char *) stringValue); return S_cas_success; } diff --git a/allParam/ca/server/record.cc b/allParam/ca/server/record.cc index 900cde7..51ca0a3 100644 --- a/allParam/ca/server/record.cc +++ b/allParam/ca/server/record.cc @@ -53,12 +53,12 @@ gddAppFuncTableStatus Record::readUnits(gdd &value) { } gddAppFuncTableStatus Record::readStatus(gdd &value) { - value.putConvert(alarmStatus); + value.putConvert((unsigned int) alarmStatus); return S_casApp_success; } gddAppFuncTableStatus Record::readSeverity(gdd &value) { - value.putConvert(alarmSeverity); + value.putConvert((unsigned int) alarmSeverity); return S_casApp_success; } diff --git a/allParam/tcl/tclParam.c b/allParam/tcl/tclParam.c index ff0a13a..966db9e 100644 --- a/allParam/tcl/tclParam.c +++ b/allParam/tcl/tclParam.c @@ -265,7 +265,6 @@ int Param_getBlob(const Param *my, const char *name, const char *idx, size_t *si struct stat fileS, *file = &fileS; stat(filename, file); *size = (size_t) file->st_size; - fprintf(stderr, "Result: %d.\n", *size); *val = stream; } return retVal; diff --git a/allParam/test/Makefile b/allParam/test/Makefile index dd06f41..f5f4fcf 100644 --- a/allParam/test/Makefile +++ b/allParam/test/Makefile @@ -1,110 +1,126 @@ TIME = time -MV = ./mv.sh # Channel Access test -# Linux -HOST_ARCH = Linux -EPICS_BASE = $(EPICS_HOME)/base -CACFLAGS = -g -ansi -Wall -I../ca -LOADCALIBES = -L../ca -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom -# LynxOS -#HOST_ARCH = LynxOS -#EPICS_BASE = $(EPICS_HOME)/base -#CACFLAGS = -g -ansi -Wall -I../ca -#LOADCALIBES = -L../ca -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom -lnetinet - +LOADCALIBES = -L../ca/client -L$(EPICS_BASE)/lib/$(HOST_ARCH) -lcaParam -lca -lCom # File test -FILECFLAGS = -g -ansi -Wall -I../file LOADFILELIBES = -L../file -lfileParam - # Oracle test ORACLE_HOME = /usr/local/oracle/product/8.0.5 -ORACFLAGS = -g -ansi -Wall -I../ora LOADORALIBES = -L../ora -L$(ORACLE_HOME)/lib \ -loraParam -lsql -lclntsh -lcommon -lcore4 -lnlsrtl3 - # PostgreSQL test -PSQLCFLAGS = -g -ansi -Wall -I../psql LOADPSQLLIBES = -L../psql -lpsqlParam -lpq -lcrypt - # Tcl test -TCLCFLAGS = -g -ansi -Wall -I../tcl -LOADTCLLIBES = -L../tcl -ltclParam -ltcl8.0 -lm -ldl - -HEADERS = test1.h test2.h test3.h test4.h test5.h test6.h test7.h test8.h \ - test9.h test10.h test11.h test12.h test13.h test14.h test15.h test16.h \ - test17.h test18.h test19.h test20.h test21.h test22.h - -OBJS = suite.o test1.o test2.o test3.o test4.o test5.o test6.o test7.o \ - test8.o test9.o test10.o test11.o test12.o test13.o test14.o test15.o \ - test16.o test17.o test18.o test19.o test20.o test21.o test22.o - -CAOBJS = ca_suite.o ca_test1.o ca_test2.o ca_test3.o ca_test4.o ca_test5.o \ - ca_test6.o ca_test7.o ca_test8.o ca_test9.o ca_test10.o ca_test11.o \ - ca_test12.o ca_test13.o ca_test14.o ca_test15.o ca_test16.o ca_test17.o \ - ca_test18.o ca_test19.o ca_test20.o ca_test21.o ca_test22.o +LOADTCLLIBES = -L../tcl -ltclParam -ltcl -lm -ldl -FILEOBJS = file_suite.o file_test1.o file_test2.o file_test3.o file_test4.o \ - file_test5.o file_test6.o file_test7.o file_test8.o file_test9.o \ - file_test10.o file_test11.o file_test12.o file_test13.o file_test14.o \ - file_test15.o file_test16.o file_test17.o file_test18.o file_test19.o \ - file_test20.o file_test21.o file_test22.o +#HEADERS = blob/*.h filename/*.h int/*.h string/*.h +HEADERS = int/*.h string/*.h -ORAOBJS = ora_suite.o ora_test1.o ora_test2.o ora_test3.o ora_test4.o \ - ora_test5.o ora_test6.o ora_test7.o ora_test8.o ora_test9.o ora_test10.o \ - ora_test11.o ora_test12.o ora_test13.o ora_test14.o ora_test15.o \ - ora_test16.o ora_test17.o ora_test18.o ora_test19.o ora_test20.o \ - ora_test21.o ora_test22.o +VPATH=.:blob:filename:int:string -PSQLOBJS = psql_suite.o psql_test1.o psql_test2.o psql_test3.o psql_test4.o \ - psql_test5.o psql_test6.o psql_test7.o psql_test8.o psql_test9.o \ - psql_test10.o psql_test11.o psql_test12.o psql_test13.o psql_test14.o \ - psql_test15.o psql_test16.o psql_test17.o psql_test18.o psql_test19.o \ - psql_test20.o psql_test21.o psql_test22.o +CFLAGS = -I../include +#OBJS = suite.o blobobjs filenameobjs intobjs stringobjs +#OBJS_V = suite.o blobobjs_v filenameobjs_v intobjs_v stringobjs_v +OBJS = suite.o intobjs stringobjs +OBJS_V = suite.o intobjs_v stringobjs_v -TCLOBJS = tcl_suite.o tcl_test1.o tcl_test2.o tcl_test3.o tcl_test4.o \ - tcl_test5.o tcl_test6.o tcl_test7.o tcl_test8.o tcl_test9.o tcl_test10.o \ - tcl_test11.o tcl_test12.o tcl_test13.o tcl_test14.o tcl_test15.o \ - tcl_test16.o tcl_test17.o tcl_test18.o tcl_test19.o tcl_test20.o \ - tcl_test21.o tcl_test22.o - LIBS = ca file ora psql tcl ca_test file_test ora_test psql_test tcl_test : $(RM) $@_suite $(MAKE) $@_suite + bin/pre_$@.sh $(TIME) ./$@_suite > $@_protocol.txt 2>&1 + bin/post_$@.sh -ca_test_suite : - $(MAKE) $(OBJS) "CFLAGS=$(CACFLAGS)" - $(MV) ca_ $(OBJS) - $(CC) $(LDFLAGS) $(CAOBJS) $(LOADCALIBES) -o $@ -file_test_suite : - $(MAKE) $(OBJS) "CFLAGS=$(FILECFLAGS)" - $(MV) file_ $(OBJS) - $(CC) $(LDFLAGS) $(FILEOBJS) $(LOADFILELIBES) -o $@ -ora_test_suite : - $(MAKE) $(OBJS) "CFLAGS=$(ORACFLAGS)" - $(MV) ora_ $(OBJS) - $(CC) $(LDFLAGS) $(ORAOBJS) $(LOADORALIBES) -o $@ -psql_test_suite : - $(MAKE) $(OBJS) "CFLAGS=$(PSQLCFLAGS)" - $(MV) psql_ $(OBJS) - $(CC) $(LDFLAGS) $(PSQLOBJS) $(LOADPSQLLIBES) -o $@ -tcl_test_suite : - $(MAKE) $(OBJS) "CFLAGS=$(TCLCFLAGS)" - $(MV) tcl_ $(OBJS) - $(CC) $(LDFLAGS) $(TCLOBJS) $(LOADTCLLIBES) -o $@ +ca_test_v file_test_v ora_test_v psql_test_v tcl_test_v : + $(RM) $@_suite + $(MAKE) $@_suite + bin/pre_$@.sh + $(TIME) ./$@_suite > $@_protocol.txt 2>&1 + bin/post_$@.sh + +#ca_test_v_suite : $(OBJS_V) +# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ +# $(LOADCALIBES) -o $@ +ca_test_v_suite : $(OBJS_V) + $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \ + $(LOADCALIBES) -o $@ +#file_test_v_suite : $(OBJS_V) +# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ +# $(LOADFILELIBES) -o $@ +file_test_v_suite : $(OBJS_V) + $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \ + $(LOADFILELIBES) -o $@ +ora_test_v_suite : $(OBJS_V) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADORALIBES) -o $@ +psql_test_v_suite : $(OBJS_V) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADPSQLLIBES) -o $@ +tcl_test_v_suite : $(OBJS_V) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADTCLLIBES) -o $@ + +#ca_test_suite : $(OBJS) +# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ +# $(LOADCALIBES) -o $@ +ca_test_suite : $(OBJS) + $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \ + $(LOADCALIBES) -o $@ +#file_test_suite : $(OBJS) +# $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ +# $(LOADFILELIBES) -o $@ +file_test_suite : $(OBJS) + $(CC) $(LDFLAGS) suite.o int/*.o string/*.o \ + $(LOADFILELIBES) -o $@ +ora_test_suite : $(OBJS) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADORALIBES) -o $@ +psql_test_suite : $(OBJS) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADPSQLLIBES) -o $@ +tcl_test_suite : $(OBJS) + $(CC) $(LDFLAGS) suite.o blob/*.o filename/*.o int/*.o string/*.o \ + $(LOADTCLLIBES) -o $@ suite.o : suite.c $(HEADERS) +suite.c : + bin/main.sh + +blobobjs : + cd blob ; $(MAKE) clean + cd blob ; $(MAKE) "CFLAGS=-I../../include" +filenameobjs : + cd filename ; $(MAKE) clean + cd filename ; $(MAKE) "CFLAGS=-I../../include" +intobjs : + cd int ; $(MAKE) clean + cd int ; $(MAKE) "CFLAGS=-I../../include" +stringobjs : + cd string ; $(MAKE) clean + cd string ; $(MAKE) "CFLAGS=-I../../include" + +blobobjs_v : + cd blob ; $(MAKE) clean + cd blob ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include" +filenameobjs_v : + cd filename ; $(MAKE) clean + cd filename ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include" +intobjs_v : + cd int ; $(MAKE) clean + cd int ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include" +stringobjs_v : + cd string ; $(MAKE) clean + cd string ; $(MAKE) "CFLAGS=-DVERBOSE -I../../include" clean : - rm -f *.o *test_protocol.txt sqlnet.log - -bin_clean : - rm -f *.o *_suite *test_protocol.txt sqlnet.log - -ca_test file_test ora_test psql_test tcl_test : dummy - -dummy : + cd blob ; $(MAKE) $@ + cd filename ; $(MAKE) $@ + cd int ; $(MAKE) $@ + cd string ; $(MAKE) $@ + rm -f *test_protocol.txt sqlnet.log *_s.tcl storage.tcl suite.c suite.o + +bin_clean : clean + rm -f *_suite diff --git a/allParam/test/bin/echoobjs.sh b/allParam/test/bin/echoobjs.sh index c113e14..84ee8bc 100644 --- a/allParam/test/bin/echoobjs.sh +++ b/allParam/test/bin/echoobjs.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo "all : $(sed s/.c/.o/g << EOF +echo "all : $(sed s/[\.]c/.o/g << EOF $(echo *.c) EOF )" diff --git a/allParam/test/bin/main.sh b/allParam/test/bin/main.sh index bf91763..03143c4 100644 --- a/allParam/test/bin/main.sh +++ b/allParam/test/bin/main.sh @@ -13,7 +13,7 @@ done cat middle.c >> $SUITE for i in */*.c ; do - echo " errors -= $(basename $i .c)(\"$(dirname $i)/$(basename $i .c)\", param);" >> $SUITE + echo " errors -= $(basename $i \.c)(\"$(dirname $i)/$(basename $i \.c)\", param);" >> $SUITE done cat end.c >> $SUITE diff --git a/allParam/test/blob/BLOB b/allParam/test/blob/BLOB new file mode 100644 index 0000000..357e873 --- /dev/null +++ b/allParam/test/blob/BLOB @@ -0,0 +1,739 @@ +E 199509L + +extern "C" { + #include +} + +#include "paramStringRecord.h" + +ParamStringRecord::ParamStringRecord(caServer& cas, const Param *p, const char *rn, const char *u) : + ParamRecord(cas, p, rn, u) +{ + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = rows == 0 ? 1 : (unsigned int) rows; + } else { + index = 1; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + + funcTable.installReadFunc("units", &Record::readUnits); + funcTable.installReadFunc("status", &Record::readStatus); + funcTable.installReadFunc("severity", &Record::readSeverity); + + funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl); + funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl); + funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr); + funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr); + funcTable.installReadFunc("precision", &ParamRecord::readPrecision); + + funcTable.installReadFunc("value", &ParamStringRecord::readValue); +} + +ParamStringRecord::~ParamStringRecord() +{ + for(unsigned int k = 0 ; k < index ; k++) { + delete ourValue[k]; + } +} + +epicsShareFunc aitEnum ParamStringRecord::bestExternalType() const +{ + return aitEnumString; +} + +epicsShareFunc unsigned ParamStringRecord::maxDimension() const +{ + return 1u; +} + +epicsShareFunc aitIndex ParamStringRecord::maxBound(unsigned dimension) const +{ + aitIndex retVal; + if(dimension == 0) { + retVal = index; + } else { + retVal = 1u; + } + return retVal; +} + +gddAppFuncTableStatus ParamStringRecord::readValue(gdd &value) +{ + gddAppFuncTableStatus retVal; + int pretVal; + int rows; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + index = 1; + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + value.putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + value.putRef(stringValue); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + return retVal; +} + +caStatus ParamStringRecord::scan() +{ + caStatus retVal; + caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getStringArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + index = 1; + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + val = new gddScalar(gddAppType_value, aitEnumString); + val->putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); + + val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + val->setStat(epicsAlarmNone); + val->setSevr(epicsSevNone); + + if (this->interest == aitTrue && pCAS != NULL) { + casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask); + this->postEvent (select, *val); + } + + delete pDest; + + return retVal; +} + +caStatus ParamStringRecord::read(const casCtx &ctx, gdd &prototype) +{ + return ((scan() == S_cas_success) && funcTable.read(*this, prototype)); +} + +caStatus ParamStringRecord::write(const casCtx &ctx, gdd &value) +{ + aitString stringValue; + + value.getConvert(stringValue); +#if 0 + char ourScalarValue[PARAM_MAX_VALUE_LEN]; + strcpy(ourScalarValue, (const char *) stringValue); + Param_storeString(param, name, idx, ourScalarValue); +#endif + Param_storeString(param, name, idx, (const char *) stringValue); + + return S_cas_success; +} + +#define _POSIX_C_SOURCE 199509L + +extern "C" { + #include +} + +#include "paramFilenameRecord.h" + +ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) : + ParamRecord(cas, p, rn, u) +{ + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = (unsigned int) rows; + } else { + index = 0; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + + funcTable.installReadFunc("units", &Record::readUnits); + funcTable.installReadFunc("status", &Record::readStatus); + funcTable.installReadFunc("severity", &Record::readSeverity); + + funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl); + funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl); + funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr); + funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr); + funcTable.installReadFunc("precision", &ParamRecord::readPrecision); + + funcTable.installReadFunc("value", &ParamFilenameRecord::readValue); +} + +ParamFilenameRecord::~ParamFilenameRecord() +{ + for(unsigned int k = 0 ; k < index ; k++) { + delete ourValue[k]; + } +} + +epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const +{ + return aitEnumString; +} + +epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const +{ + return 1u; +} + +epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const +{ + aitIndex retVal; + if(dimension == 0) { + retVal = index; + } else { + retVal = 1u; + } + return retVal; +} + +gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value) +{ + gddAppFuncTableStatus retVal; + int pretVal; + int rows; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + value.putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + value.putRef(stringValue); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + return retVal; +} + +caStatus ParamFilenameRecord::scan() +{ + caStatus retVal; + caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + val = new gddScalar(gddAppType_value, aitEnumString); + val->putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); + + val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + val->setStat(epicsAlarmNone); + val->setSevr(epicsSevNone); + + if (this->interest == aitTrue && pCAS != NULL) { + casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask); + this->postEvent (select, *val); + } + + delete pDest; + + return retVal; +} + +caStatus ParamFilenameRecord::read(const casCtx &ctx, gdd &prototype) +{ + return ((scan() == S_cas_success) && funcTable.read(*this, prototype)); +} + +caStatus ParamFilenameRecord::write(const casCtx &ctx, gdd &value) +{ + return S_cas_noWrite; +} + +#define _POSIX_C_SOURCE 199509L + +extern "C" { + #include +} + +#include "paramFilenameRecord.h" + +ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) : + ParamRecord(cas, p, rn, u) +{ + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = (unsigned int) rows; + } else { + index = 0; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + + funcTable.installReadFunc("units", &Record::readUnits); + funcTable.installReadFunc("status", &Record::readStatus); + funcTable.installReadFunc("severity", &Record::readSeverity); + + funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl); + funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl); + funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr); + funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr); + funcTable.installReadFunc("precision", &ParamRecord::readPrecision); + + funcTable.installReadFunc("value", &ParamFilenameRecord::readValue); +} + +ParamFilenameRecord::~ParamFilenameRecord() +{ + for(unsigned int k = 0 ; k < index ; k++) { + delete ourValue[k]; + } +} + +epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const +{ + return aitEnumString; +} + +epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const +{ + return 1u; +} + +epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const +{ + aitIndex retVal; + if(dimension == 0) { + retVal = index; + } else { + retVal = 1u; + } + return retVal; +} + +gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value) +{ + gddAppFuncTableStatus retVal; + int pretVal; + int rows; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + value.putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + value.putRef(stringValue); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + return retVal; +} + +caStatus ParamFilenameRecord::scan() +{ + caStatus retVal; + caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + val = new gddScalar(gddAppType_value, aitEnumString); + val->putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); + + val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + val->setStat(epicsAlarmNone); + val->setSevr(epicsSevNone); + + if (this->interest == aitTrue && pCAS != NULL) { + casEventMask select(pCAS->valueEventMask|pCAS->logEventMask|pCAS->alarmEventMask); + this->postEvent (select, *val); + } + + delete pDest; + + return retVal; +} + +caStatus ParamFilenameRecord::read(const casCtx &ctx, gdd &prototype) +{ + return ((scan() == S_cas_success) && funcTable.read(*this, prototype)); +} + +caStatus ParamFilenameRecord::write(const casCtx &ctx, gdd &value) +{ + return S_cas_noWrite; +} + +#define _POSIX_C_SOURCE 199509L + +extern "C" { + #include +} + +#include "paramFilenameRecord.h" + +ParamFilenameRecord::ParamFilenameRecord(caServer& cas, const Param *p, const char *rn, const char *u) : + ParamRecord(cas, p, rn, u) +{ + int rows; + char *tmp[PARAM_MAX_ARRAY_LEN]; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + tmp[i] = new char[PARAM_MAX_VALUE_LEN]; + } + if(Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, tmp) == 0) { + index = (unsigned int) rows; + } else { + index = 0; + } + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] tmp[i]; + } + + funcTable.installReadFunc("units", &Record::readUnits); + funcTable.installReadFunc("status", &Record::readStatus); + funcTable.installReadFunc("severity", &Record::readSeverity); + + funcTable.installReadFunc("controlLow", &ParamRecord::readLowCtrl); + funcTable.installReadFunc("controlHigh", &ParamRecord::readHighCtrl); + funcTable.installReadFunc("graphicLow", &ParamRecord::readLopr); + funcTable.installReadFunc("graphicHigh", &ParamRecord::readHopr); + funcTable.installReadFunc("precision", &ParamRecord::readPrecision); + + funcTable.installReadFunc("value", &ParamFilenameRecord::readValue); +} + +ParamFilenameRecord::~ParamFilenameRecord() +{ + for(unsigned int k = 0 ; k < index ; k++) { + delete ourValue[k]; + } +} + +epicsShareFunc aitEnum ParamFilenameRecord::bestExternalType() const +{ + return aitEnumString; +} + +epicsShareFunc unsigned ParamFilenameRecord::maxDimension() const +{ + return 1u; +} + +epicsShareFunc aitIndex ParamFilenameRecord::maxBound(unsigned dimension) const +{ + aitIndex retVal; + if(dimension == 0) { + retVal = index; + } else { + retVal = 1u; + } + return retVal; +} + +gddAppFuncTableStatus ParamFilenameRecord::readValue(gdd &value) +{ + gddAppFuncTableStatus retVal; + int pretVal; + int rows; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + value.putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + value.putRef(stringValue); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + return retVal; +} + +caStatus ParamFilenameRecord::scan() +{ + caStatus retVal; + caServer *pCAS = this->getCAS(); + int pretVal; + int rows; + ArrayDestructor *pDest = new ArrayDestructor; + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + ourValue[i] = new char[PARAM_MAX_VALUE_LEN]; + } + + pretVal = Param_getFilenameArray(param, name, idx, PARAM_MAX_ARRAY_LEN, &rows, ourValue); + if((pretVal != 0) || ((index = (unsigned int) rows ) == 0)) { + retVal = S_cas_noRead; + } else if(index == 1) { + aitString stringValue = ourValue[0]; + + val = new gddScalar(gddAppType_value, aitEnumString); + val->putConvert(stringValue); + retVal = S_casApp_success; + } else { + aitString *stringValue; + stringValue = new aitString[index]; + for (unsigned int k = 0 ; k < index ; k++) { + stringValue[k] = ourValue[k]; + } + + val = new gddAtomic(gddAppType_value, aitEnumString, 1, index); + + val->putRef(stringValue, pDest); + retVal = S_casApp_success; + } + + for (int i = 0 ; i < PARAM_MAX_ARRAY_LEN ; i++) { + delete [] ourValue[i]; + } + + val->setStat(epicsAlarmNone); +} xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx +xxx diff --git a/allParam/test/blob/Makefile b/allParam/test/blob/Makefile new file mode 100644 index 0000000..b5f1af9 --- /dev/null +++ b/allParam/test/blob/Makefile @@ -0,0 +1,12 @@ +all : + $(MAKE) depend "CFLAGS=$(CFLAGS)" + $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)" + +depend : + rm -f Makefile.dep + ../bin/echoobjs.sh > Makefile.dep + gcc -MM $(CFLAGS) *.c >> Makefile.dep + +clean : + rm -f Makefile.dep *.o + diff --git a/allParam/test/filename/Makefile b/allParam/test/filename/Makefile new file mode 100644 index 0000000..b5f1af9 --- /dev/null +++ b/allParam/test/filename/Makefile @@ -0,0 +1,12 @@ +all : + $(MAKE) depend "CFLAGS=$(CFLAGS)" + $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)" + +depend : + rm -f Makefile.dep + ../bin/echoobjs.sh > Makefile.dep + gcc -MM $(CFLAGS) *.c >> Makefile.dep + +clean : + rm -f Makefile.dep *.o + diff --git a/allParam/test/int/Makefile b/allParam/test/int/Makefile new file mode 100644 index 0000000..b5f1af9 --- /dev/null +++ b/allParam/test/int/Makefile @@ -0,0 +1,12 @@ +all : + $(MAKE) depend "CFLAGS=$(CFLAGS)" + $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)" + +depend : + rm -f Makefile.dep + ../bin/echoobjs.sh > Makefile.dep + gcc -MM $(CFLAGS) *.c >> Makefile.dep + +clean : + rm -f Makefile.dep *.o + diff --git a/allParam/test/int/i_lowercase.c b/allParam/test/int/i_lowercase.c new file mode 100644 index 0000000..ab2454c --- /dev/null +++ b/allParam/test/int/i_lowercase.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "i_lowercase.h" + +int i_lowercase(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tint"; + unsigned long int result; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getInt: Lowercase input on correct statements.\n", testid); +#endif + + retVal = Param_getInt(param, name, idx, &rows, &result); + if ((rows == 1) && (result == 100) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + 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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/i_lowercase.h b/allParam/test/int/i_lowercase.h new file mode 100644 index 0000000..219e478 --- /dev/null +++ b/allParam/test/int/i_lowercase.h @@ -0,0 +1,8 @@ +#ifndef I_LOWERCASE_H +#define I_LOWERCASE_H + +#include + +int i_lowercase(const char *, const Param *); + +#endif diff --git a/allParam/test/int/i_no_index.c b/allParam/test/int/i_no_index.c new file mode 100644 index 0000000..48fadac --- /dev/null +++ b/allParam/test/int/i_no_index.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "i_no_index.h" + +int i_no_index(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "bla"; + unsigned long int result; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getInt: Non-existing idx.\n", testid); +#endif + + retVal = Param_getInt(param, name, idx, &rows, &result); + if ((rows == 0) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#if VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/i_no_index.h b/allParam/test/int/i_no_index.h new file mode 100644 index 0000000..8fda975 --- /dev/null +++ b/allParam/test/int/i_no_index.h @@ -0,0 +1,8 @@ +#ifndef I_NO_INDEX_H +#define I_NO_INDEX_H + +#include + +int i_no_index(const char *, const Param *); + +#endif diff --git a/allParam/test/int/i_string_available.c b/allParam/test/int/i_string_available.c new file mode 100644 index 0000000..58db765 --- /dev/null +++ b/allParam/test/int/i_string_available.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "i_string_available.h" + +int i_string_available(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tstring"; + unsigned long int result; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getInt: Integer is wanted but string-like value found.\n", testid); +#endif + + retVal = Param_getInt(param, name, idx, &rows, &result); + if ((rows == 0) && (retVal == -1)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#if VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/i_string_available.h b/allParam/test/int/i_string_available.h new file mode 100644 index 0000000..4efb656 --- /dev/null +++ b/allParam/test/int/i_string_available.h @@ -0,0 +1,8 @@ +#ifndef I_STRING_AVAILABLE_H +#define I_STRING_AVAILABLE_H + +#include + +int i_string_available(const char *, const Param *); + +#endif diff --git a/allParam/test/int/i_uppercase.c b/allParam/test/int/i_uppercase.c new file mode 100644 index 0000000..8504c31 --- /dev/null +++ b/allParam/test/int/i_uppercase.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "i_uppercase.h" + +int i_uppercase(const char *testid, const Param *param) { + char *name = "TNAME"; + char *idx = "TINT"; + unsigned long int result; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getInt: Uppercase input on correct statements.\n", testid); +#endif + + retVal = Param_getInt(param, name, idx, &rows, &result); + if ((rows == 1) && (result == 100) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + 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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/i_uppercase.h b/allParam/test/int/i_uppercase.h new file mode 100644 index 0000000..3b9c93a --- /dev/null +++ b/allParam/test/int/i_uppercase.h @@ -0,0 +1,8 @@ +#ifndef I_UPPERCASE_H +#define I_UPPERCASE_H + +#include + +int i_uppercase(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_long_array.c b/allParam/test/int/ia_long_array.c new file mode 100644 index 0000000..dcb787c --- /dev/null +++ b/allParam/test/int/ia_long_array.c @@ -0,0 +1,40 @@ +#include +#include + +#include + +#include "ia_long_array.h" + +int ia_long_array(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; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: To many array members available.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_long_array.h b/allParam/test/int/ia_long_array.h new file mode 100644 index 0000000..7de5ded --- /dev/null +++ b/allParam/test/int/ia_long_array.h @@ -0,0 +1,11 @@ +#ifndef IA_LONG_ARRAY_H +#define IA_LONG_ARRAY_H + +#include + +#define NUM2 32 +#define NUM6 16 + +int ia_long_array(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_lowercase.c b/allParam/test/int/ia_lowercase.c new file mode 100644 index 0000000..52b86ae --- /dev/null +++ b/allParam/test/int/ia_lowercase.c @@ -0,0 +1,44 @@ +#include +#include + +#include + +#include "ia_lowercase.h" + +int ia_lowercase(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; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: Lowercase input on correct statements.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + 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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_lowercase.h b/allParam/test/int/ia_lowercase.h new file mode 100644 index 0000000..8aef49a --- /dev/null +++ b/allParam/test/int/ia_lowercase.h @@ -0,0 +1,10 @@ +#ifndef IA_LOWERCASE_H +#define IA_LOWERCASE_H + +#include + +#define NUM2 32 + +int ia_lowercase(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_no_index.c b/allParam/test/int/ia_no_index.c new file mode 100644 index 0000000..5dcaf94 --- /dev/null +++ b/allParam/test/int/ia_no_index.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "ia_no_index.h" + +int ia_no_index(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "bla"; + unsigned long int result[NUM2]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: Non-existing idx.\n", testid); +#endif + + retVal = Param_getIntArray(param, name, idx, NUM2, &rows, result); + if ((rows == 0) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_no_index.h b/allParam/test/int/ia_no_index.h new file mode 100644 index 0000000..ef4a1e7 --- /dev/null +++ b/allParam/test/int/ia_no_index.h @@ -0,0 +1,10 @@ +#ifndef IA_NO_INDEX_H +#define IA_NO_INDEX_H + +#include + +#define NUM2 32 + +int ia_no_index(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_short_array.c b/allParam/test/int/ia_short_array.c new file mode 100644 index 0000000..a6f98df --- /dev/null +++ b/allParam/test/int/ia_short_array.c @@ -0,0 +1,40 @@ +#include +#include + +#include + +#include "ia_short_array.h" + +int ia_short_array(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; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: To few array members available.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_short_array.h b/allParam/test/int/ia_short_array.h new file mode 100644 index 0000000..d3032af --- /dev/null +++ b/allParam/test/int/ia_short_array.h @@ -0,0 +1,11 @@ +#ifndef IA_SHORT_ARRAY_H +#define IA_SHORT_ARRAY_H + +#include + +#define NUM2 32 +#define NUM4 64 + +int ia_short_array(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_string_available.c b/allParam/test/int/ia_string_available.c new file mode 100644 index 0000000..ad9d01e --- /dev/null +++ b/allParam/test/int/ia_string_available.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "ia_string_available.h" + +int ia_string_available(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tstringa"; + unsigned long int result[NUM1]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: Int is wanted but String-like values found.\n", testid); +#endif + + retVal = Param_getIntArray(param, name, idx, NUM1, &rows, result); + if ((rows == 0) && (retVal == -1)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_string_available.h b/allParam/test/int/ia_string_available.h new file mode 100644 index 0000000..d42ffad --- /dev/null +++ b/allParam/test/int/ia_string_available.h @@ -0,0 +1,10 @@ +#ifndef IA_STRING_AVAILABLE_H +#define IA_STRING_AVAILABLE_H + +#include + +#define NUM1 8 + +int ia_string_available(const char *, const Param *); + +#endif diff --git a/allParam/test/int/ia_uppercase.c b/allParam/test/int/ia_uppercase.c new file mode 100644 index 0000000..aceda75 --- /dev/null +++ b/allParam/test/int/ia_uppercase.c @@ -0,0 +1,44 @@ +#include +#include + +#include + +#include "ia_uppercase.h" + +int ia_uppercase(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; + +#ifdef VERBOSE + printf("%s : Param_getIntArray: Uppercase input on correct statements.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + 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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/int/ia_uppercase.h b/allParam/test/int/ia_uppercase.h new file mode 100644 index 0000000..7c1e980 --- /dev/null +++ b/allParam/test/int/ia_uppercase.h @@ -0,0 +1,10 @@ +#ifndef IA_UPPERCASE_H +#define IA_UPPERCASE_H + +#include + +#define NUM2 32 + +int ia_uppercase(const char *, const Param *); + +#endif diff --git a/allParam/test/string/Makefile b/allParam/test/string/Makefile new file mode 100644 index 0000000..b5f1af9 --- /dev/null +++ b/allParam/test/string/Makefile @@ -0,0 +1,12 @@ +all : + $(MAKE) depend "CFLAGS=$(CFLAGS)" + $(MAKE) -f Makefile.dep "CFLAGS=$(CFLAGS)" + +depend : + rm -f Makefile.dep + ../bin/echoobjs.sh > Makefile.dep + gcc -MM $(CFLAGS) *.c >> Makefile.dep + +clean : + rm -f Makefile.dep *.o + diff --git a/allParam/test/string/s_array.c b/allParam/test/string/s_array.c new file mode 100644 index 0000000..e0b97b6 --- /dev/null +++ b/allParam/test/string/s_array.c @@ -0,0 +1,37 @@ +#include +#include + +#include + +#include "s_array.h" + +int s_array(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tstringa"; + char result[PARAM_MAX_VALUE_LEN]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getString: Request for Array value.\n", testid); +#endif + + 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 { +#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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/string/s_array.h b/allParam/test/string/s_array.h new file mode 100644 index 0000000..107f344 --- /dev/null +++ b/allParam/test/string/s_array.h @@ -0,0 +1,8 @@ +#ifndef S_ARRAY_H +#define S_ARRAY_H + +#include + +int s_array(const char *, const Param *); + +#endif diff --git a/allParam/test/string/s_int_available.c b/allParam/test/string/s_int_available.c new file mode 100644 index 0000000..adde0a9 --- /dev/null +++ b/allParam/test/string/s_int_available.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "s_int_available.h" + +int s_int_available(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tint"; + char result[PARAM_MAX_VALUE_LEN]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getString: String is wanted but int-like value found.\n", testid); +#endif + + 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 { +#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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/string/s_int_available.h b/allParam/test/string/s_int_available.h new file mode 100644 index 0000000..90e8436 --- /dev/null +++ b/allParam/test/string/s_int_available.h @@ -0,0 +1,8 @@ +#ifndef S_INT_AVAILABLE_H +#define S_INT_AVAILABLE_H + +#include + +int s_int_available(const char *, const Param *); + +#endif diff --git a/allParam/test/string/s_lowercase.c b/allParam/test/string/s_lowercase.c new file mode 100644 index 0000000..452ccd0 --- /dev/null +++ b/allParam/test/string/s_lowercase.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "s_lowercase.h" + +int s_lowercase(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "tstring"; + 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 + + 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 { +#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 + } + return myRetVal; +} + diff --git a/allParam/test/string/s_lowercase.h b/allParam/test/string/s_lowercase.h new file mode 100644 index 0000000..37a1d34 --- /dev/null +++ b/allParam/test/string/s_lowercase.h @@ -0,0 +1,8 @@ +#ifndef S_LOWERCASE_H +#define S_LOWERCASE_H + +#include + +int s_lowercase(const char *, const Param *); + +#endif diff --git a/allParam/test/string/s_no_index.c b/allParam/test/string/s_no_index.c new file mode 100644 index 0000000..6e8d5a3 --- /dev/null +++ b/allParam/test/string/s_no_index.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "s_no_index.h" + +int s_no_index(const char *testid, const Param *param) { + char *name = "tname"; + char *idx = "bla"; + char result[PARAM_MAX_VALUE_LEN]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getString: Non-existing idx.\n", testid); +#endif + + retVal = Param_getString(param, name, idx, &rows, result); + if ((rows == 0) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/string/s_no_index.h b/allParam/test/string/s_no_index.h new file mode 100644 index 0000000..3f61605 --- /dev/null +++ b/allParam/test/string/s_no_index.h @@ -0,0 +1,8 @@ +#ifndef S_NO_INDEX_H +#define S_NO_INDEX_H + +#include + +int s_no_index(const char *, const Param *); + +#endif diff --git a/allParam/test/string/s_uppercase.c b/allParam/test/string/s_uppercase.c new file mode 100644 index 0000000..c87a4ed --- /dev/null +++ b/allParam/test/string/s_uppercase.c @@ -0,0 +1,35 @@ +#include +#include + +#include + +#include "s_uppercase.h" + +int s_uppercase(const char *testid, const Param *param) { + char *name = "TNAME"; + char *idx = "TSTRING"; + char result[PARAM_MAX_VALUE_LEN]; + int rows; + int retVal; + int myRetVal; + +#ifdef VERBOSE + printf("%s : Param_getString: Uppercase input on correct statements.\n", testid); +#endif + + 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 { +#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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + return myRetVal; +} + diff --git a/allParam/test/string/s_uppercase.h b/allParam/test/string/s_uppercase.h new file mode 100644 index 0000000..442510a --- /dev/null +++ b/allParam/test/string/s_uppercase.h @@ -0,0 +1,8 @@ +#ifndef S_UPPERCASE_H +#define S_UPPERCASE_H + +#include + +int s_uppercase(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_int_available.c b/allParam/test/string/sa_int_available.c new file mode 100644 index 0000000..73fb1a3 --- /dev/null +++ b/allParam/test/string/sa_int_available.c @@ -0,0 +1,76 @@ +#include +#include +#include + +#include + +#include "sa_int_available.h" + +int sa_int_available(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: String is wanted but Int-like values found.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + for (i = 0 ; i < NUM2 ; i++) { + free(result[i]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_int_available.h b/allParam/test/string/sa_int_available.h new file mode 100644 index 0000000..d73f9c4 --- /dev/null +++ b/allParam/test/string/sa_int_available.h @@ -0,0 +1,10 @@ +#ifndef SA_INT_AVAILABLE_H +#define SA_INT_AVAILABLE_H + +#include + +#define NUM2 32 + +int sa_int_available(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_long_array.c b/allParam/test/string/sa_long_array.c new file mode 100644 index 0000000..7e459e9 --- /dev/null +++ b/allParam/test/string/sa_long_array.c @@ -0,0 +1,48 @@ +#include +#include +#include + +#include + +#include "sa_long_array.h" + +int sa_long_array(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: To many array members available.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + for (i = 0 ; i < NUM5 ; i++) { + free(result[i]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_long_array.h b/allParam/test/string/sa_long_array.h new file mode 100644 index 0000000..d87e4e5 --- /dev/null +++ b/allParam/test/string/sa_long_array.h @@ -0,0 +1,11 @@ +#ifndef SA_LONG_ARRAY_H +#define SA_LONG_ARRAY_H + +#include + +#define NUM1 8 +#define NUM5 4 + +int sa_long_array(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_lowercase.c b/allParam/test/string/sa_lowercase.c new file mode 100644 index 0000000..6c38c2d --- /dev/null +++ b/allParam/test/string/sa_lowercase.c @@ -0,0 +1,61 @@ +#include +#include +#include + +#include + +#include "sa_lowercase.h" + +int sa_lowercase(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: Lowercase input on correct statements.\n", testid); +#endif + + 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 { +#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]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_lowercase.h b/allParam/test/string/sa_lowercase.h new file mode 100644 index 0000000..07ec0c5 --- /dev/null +++ b/allParam/test/string/sa_lowercase.h @@ -0,0 +1,10 @@ +#ifndef SA_LOWERCASE_H +#define SA_LOWERCASE_H + +#include + +#define NUM1 8 + +int sa_lowercase(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_no_index.c b/allParam/test/string/sa_no_index.c new file mode 100644 index 0000000..dac8f49 --- /dev/null +++ b/allParam/test/string/sa_no_index.c @@ -0,0 +1,43 @@ +#include +#include +#include + +#include + +#include "sa_no_index.h" + +int sa_no_index(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: Non-existing idx.\n", testid); +#endif + + retVal = Param_getStringArray(param, name, idx, NUM1, &rows, result); + if ((rows == 0) && (retVal == 0)) { + myRetVal = 0; + printf("%s : Passed.\n", testid); + } else { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, 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]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_no_index.h b/allParam/test/string/sa_no_index.h new file mode 100644 index 0000000..fda7240 --- /dev/null +++ b/allParam/test/string/sa_no_index.h @@ -0,0 +1,10 @@ +#ifndef SA_NO_INDEX_H +#define SA_NO_INDEX_H + +#include + +#define NUM1 8 + +int sa_no_index(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_scalar.c b/allParam/test/string/sa_scalar.c new file mode 100644 index 0000000..4699bf8 --- /dev/null +++ b/allParam/test/string/sa_scalar.c @@ -0,0 +1,43 @@ +#include +#include +#include + +#include + +#include "sa_scalar.h" + +int sa_scalar(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: Request for a scalar value.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + 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)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + for (i = 0 ; i < NUM1 ; i++) { + free(result[i]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_scalar.h b/allParam/test/string/sa_scalar.h new file mode 100644 index 0000000..1eff646 --- /dev/null +++ b/allParam/test/string/sa_scalar.h @@ -0,0 +1,10 @@ +#ifndef SA_SCALAR_H +#define SA_SCALAR_H + +#include + +#define NUM1 8 + +int sa_scalar(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_short_array.c b/allParam/test/string/sa_short_array.c new file mode 100644 index 0000000..f46e62c --- /dev/null +++ b/allParam/test/string/sa_short_array.c @@ -0,0 +1,52 @@ +#include +#include +#include + +#include + +#include "sa_short_array.h" + +int sa_short_array(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: To few array members available.\n", testid); +#endif + + 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 { +#ifdef VERBOSE + printf("%s : Failed. Rows: %d, return Value: %d.\n", testid, rows, retVal); + printf("%s : Error string: %s\n", testid, Param_getErrStr(param)); +#else + printf("%s : Failed.\n", testid); +#endif + myRetVal = -1; + } + for (i = 0 ; i < NUM3 ; i++) { + free(result[i]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_short_array.h b/allParam/test/string/sa_short_array.h new file mode 100644 index 0000000..95fd0d6 --- /dev/null +++ b/allParam/test/string/sa_short_array.h @@ -0,0 +1,11 @@ +#ifndef SA_SHORT_ARRAY_H +#define SA_SHORT_ARRAY_H + +#include + +#define NUM1 8 +#define NUM3 16 + +int sa_short_array(const char *, const Param *); + +#endif diff --git a/allParam/test/string/sa_uppercase.c b/allParam/test/string/sa_uppercase.c new file mode 100644 index 0000000..33c3dad --- /dev/null +++ b/allParam/test/string/sa_uppercase.c @@ -0,0 +1,61 @@ +#include +#include +#include + +#include + +#include "sa_uppercase.h" + +int sa_uppercase(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)); + } +#ifdef VERBOSE + printf("%s : Param_getStringArray: Uppercase input on correct statements.\n", testid); +#endif + + 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 { +#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]); + } + return myRetVal; +} + diff --git a/allParam/test/string/sa_uppercase.h b/allParam/test/string/sa_uppercase.h new file mode 100644 index 0000000..2ab07e6 --- /dev/null +++ b/allParam/test/string/sa_uppercase.h @@ -0,0 +1,10 @@ +#ifndef SA_UPPERCASE_H +#define SA_UPPERCASE_H + +#include + +#define NUM1 8 + +int sa_uppercase(const char *, const Param *); + +#endif diff --git a/allParam/test/suite.c b/allParam/test/suite.c index cd20d96..c67a6aa 100644 --- a/allParam/test/suite.c +++ b/allParam/test/suite.c @@ -3,28 +3,28 @@ #include -#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" -#include "test21.h" -#include "test22.h" +#include "int/i_lowercase.h" +#include "int/i_no_index.h" +#include "int/i_string_available.h" +#include "int/i_uppercase.h" +#include "int/ia_long_array.h" +#include "int/ia_lowercase.h" +#include "int/ia_no_index.h" +#include "int/ia_short_array.h" +#include "int/ia_string_available.h" +#include "int/ia_uppercase.h" +#include "string/s_array.h" +#include "string/s_int_available.h" +#include "string/s_lowercase.h" +#include "string/s_no_index.h" +#include "string/s_uppercase.h" +#include "string/sa_int_available.h" +#include "string/sa_long_array.h" +#include "string/sa_lowercase.h" +#include "string/sa_no_index.h" +#include "string/sa_scalar.h" +#include "string/sa_short_array.h" +#include "string/sa_uppercase.h" int main(int argc, char *argv[]) { Param *param; @@ -36,28 +36,29 @@ int main(int argc, char *argv[]) { printf("================================================================================\n"); printf("%s : Starting test ...\n", argv[0]); 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); - errors -= test21("Test 21", param); - errors -= test22("Test 22", param); + + errors -= i_lowercase("int/i_lowercase", param); + errors -= i_no_index("int/i_no_index", param); + errors -= i_string_available("int/i_string_available", param); + errors -= i_uppercase("int/i_uppercase", param); + errors -= ia_long_array("int/ia_long_array", param); + errors -= ia_lowercase("int/ia_lowercase", param); + errors -= ia_no_index("int/ia_no_index", param); + errors -= ia_short_array("int/ia_short_array", param); + errors -= ia_string_available("int/ia_string_available", param); + errors -= ia_uppercase("int/ia_uppercase", param); + errors -= s_array("string/s_array", param); + errors -= s_int_available("string/s_int_available", param); + errors -= s_lowercase("string/s_lowercase", param); + errors -= s_no_index("string/s_no_index", param); + errors -= s_uppercase("string/s_uppercase", param); + errors -= sa_int_available("string/sa_int_available", param); + errors -= sa_long_array("string/sa_long_array", param); + errors -= sa_lowercase("string/sa_lowercase", param); + errors -= sa_no_index("string/sa_no_index", param); + errors -= sa_scalar("string/sa_scalar", param); + errors -= sa_short_array("string/sa_short_array", param); + errors -= sa_uppercase("string/sa_uppercase", param); desParam(param); free(param); -- 2.43.0