| # =================== OCAF ====================== | |
| # Standard attributes of List containers (xml format) | |
| # | |
| # Testing purpose: test of InsertBefore / InsertAfter / Remove | |
| # of TDataStd_BooleanList, TDataStd_IntegerList | |
| # TDataStd_RealList, TDataStd_ExtStringList, | |
| # TDataStd_ReferenceList attributes | |
| # | |
| # =============================================== | |
| # Test case: | |
| # 1. create BooleanList attribute with empty list | |
| # 2. create IntegerList attribute with empty list | |
| # 3. create RealList attribute with empty list | |
| # 4. create ExtStringList attribute with empty list | |
| # 5. create ReferenceList attribute with empty list | |
| # 6. insert before a value | |
| # 7. insert after a value | |
| # 8. remove a value | |
| # 9. check the values | |
| # =============================================== | |
| NewDocument D XmlOcaf | |
| # 1. create BooleanList attribute | |
| set Lab1 [Label D 0:1:1] | |
| SetBooleanList D $Lab1 0 0 1 0 | |
| set info1 [GetBooleanList D $Lab1] | |
| # output => "0 0 1 0" | |
| # 2. create IntegerList attribute | |
| set Lab2 [Label D 0:1:2] | |
| SetIntegerList D $Lab2 0 0 1 0 | |
| set info2 [GetIntegerList D $Lab2] | |
| # output => "0 0 1 0" | |
| # 3. create RealList attribute | |
| set Lab3 [Label D 0:1:3] | |
| SetRealList D $Lab3 0 0 1 0 | |
| set info3 [GetRealList D $Lab3] | |
| # output => "0 0 1 0" | |
| # 4. create ExtStringList attribute | |
| set Lab4 [Label D 0:1:4] | |
| SetExtStringList D $Lab4 0 0 1 0 | |
| set info4 [GetExtStringList D $Lab4] | |
| # output => "0 0 1 0" | |
| # 5. create ReferenceList attribute | |
| set Lab5 [Label D 0:1:5] | |
| SetReferenceList D $Lab5 $Lab1 $Lab2 $Lab4 | |
| set info5 [GetReferenceList D $Lab5] | |
| # output => "0:1:1 0:1:2 0:1:4" | |
| # 6. insert before a value | |
| InsertBeforeBooleanList D $Lab1 3 1 | |
| InsertBeforeIntegerList D $Lab2 3 1 | |
| InsertBeforeRealList D $Lab3 3 1 | |
| InsertBeforeExtStringList D $Lab4 3 1 | |
| InsertBeforeReferenceList D $Lab5 3 0:1:3 | |
| # output => "0 0 1 1 0" | |
| # output => "0:1:1 0:1:2 0:1:3 0:1:4" | |
| # 7. insert after a value | |
| InsertAfterBooleanList D $Lab1 4 1 | |
| InsertAfterIntegerList D $Lab2 4 1 | |
| InsertAfterRealList D $Lab3 4 1 | |
| InsertAfterExtStringList D $Lab4 4 1 | |
| InsertAfterReferenceList D $Lab5 4 0:1:5 | |
| # output => "0 0 1 1 1 0" | |
| # output => "0:1:1 0:1:2 0:1:3 0:1:4 0:1:5" | |
| # 8. remove a value | |
| RemoveBooleanList D $Lab1 6 | |
| RemoveIntegerList D $Lab2 6 | |
| RemoveRealList D $Lab3 6 | |
| RemoveExtStringList D $Lab4 6 | |
| RemoveReferenceList D $Lab5 1 | |
| # output => "0 0 1 1 1" | |
| # output => "0:1:2 0:1:3 0:1:4 0:1:5" | |
| # 8. Check the values | |
| set info6 [GetBooleanList D $Lab1] | |
| set info7 [GetIntegerList D $Lab2] | |
| set info8 [GetRealList D $Lab3] | |
| set info9 [GetExtStringList D $Lab4] | |
| set info10 [GetReferenceList D $Lab5] | |
| # output => "0 0 1 1 1" | |
| # output => "0:1:2 0:1:3 0:1:4 0:1:5" | |
| Close D | |
| if { [regexp {0 0 1 1 1} ${info6}] } { | |
| puts "OK: inserted and removed values for BooleanList attribute are good" | |
| } else { | |
| puts "Error: inserted and removed values for BooleanList attribute are bad" | |
| } | |
| if { [regexp {0 0 1 1 1} ${info7}] } { | |
| puts "OK: inserted and removed values for IntegerList attribute are good" | |
| } else { | |
| puts "Error: inserted and removed values for IntegerList attribute are bad" | |
| } | |
| if { [regexp {0 0 1 1 1} ${info8}] } { | |
| puts "OK: inserted and removed values for RealList attribute are good" | |
| } else { | |
| puts "Error: inserted and removed values for RealList attribute are bad" | |
| } | |
| if { [regexp {0 0 1 1 1} ${info9}] } { | |
| puts "OK: inserted and removed values for ExtStringList attribute are good" | |
| } else { | |
| puts "Error: inserted and removed values for ExtStringList attribute are bad" | |
| } | |
| if { [regexp {0:1:2 0:1:3 0:1:4 0:1:5} ${info10}] } { | |
| puts "OK: inserted and removed values for ReferenceList attribute are good" | |
| } else { | |
| puts "Error: inserted and removed values for ReferenceList attribute are bad" | |
| } |