fix bug in renameField; Add check for zero length fieldNames in Structure.

This commit is contained in:
Marty Kraimer
2012-06-22 14:04:05 -04:00
parent 3991a51fd6
commit 12d13bc2c0
4 changed files with 37 additions and 9 deletions

View File

@@ -89,12 +89,13 @@ static void testPVScalarWithProperties(
{
PVStructurePtr pvStructure;
bool hasValueAlarm = false;
bool hasBooleanAlarm = false;
bool hasDisplayControl = false;
switch(stype) {
case pvBoolean: {
pvStructure = standardPVField->scalar(
stype,alarmTimeStampValueAlarm);
hasValueAlarm = true;
hasBooleanAlarm = true;
PVBooleanPtr pvField = pvStructure->getBooleanField("value");
pvField->put(true);
break;
@@ -245,7 +246,13 @@ static void testPVScalarWithProperties(
String("control.limitHigh"));
assert(limit!=0);
limit->put(9.0);
}
if(hasValueAlarm) {
PVFieldPtr pvField = pvStructure->getSubField(
String("valueAlarm.active"));
PVBooleanPtr pvBoolean = static_pointer_cast<PVBoolean>(pvField);
pvBoolean->put(true);
pvField = pvStructure->getSubField(
String("valueAlarm.lowAlarmLimit"));
PVScalarPtr pvtemp = static_pointer_cast<PVScalar>(pvField);
assert(pvtemp.get()!=0);
@@ -268,6 +275,24 @@ static void testPVScalarWithProperties(
assert(active!=0);
active->put(true);
}
if(hasBooleanAlarm) {
PVFieldPtr pvField = pvStructure->getSubField(
String("valueAlarm.active"));
PVBooleanPtr pvBoolean = static_pointer_cast<PVBoolean>(pvField);
pvBoolean->put(true);
severity = pvStructure->getIntField(
String("valueAlarm.falseSeverity"));
assert(severity!=0);
severity->put(0);
severity = pvStructure->getIntField(
String("valueAlarm.trueSeverity"));
assert(severity!=0);
severity->put(2);
severity = pvStructure->getIntField(
String("valueAlarm.changeStateSeverity"));
assert(severity!=0);
severity->put(1);
}
builder.clear();
pvStructure->toString(&builder);
fprintf(fd,"%s\n",builder.c_str());