1ff07227 |
1 | # =================== OCAF ====================== |
2 | # Standard attributes of List containers (xml format) |
3 | # |
4 | # Testing purpose: test of InsertBefore / InsertAfter / Remove |
5 | # of TDataStd_BooleanList, TDataStd_IntegerList |
6 | # TDataStd_RealList, TDataStd_ExtStringList, |
7 | # TDataStd_ReferenceList attributes |
8 | # |
9 | # =============================================== |
10 | # Test case: |
11 | # 1. create BooleanList attribute with empty list |
12 | # 2. create IntegerList attribute with empty list |
13 | # 3. create RealList attribute with empty list |
14 | # 4. create ExtStringList attribute with empty list |
15 | # 5. create ReferenceList attribute with empty list |
16 | # 6. insert before a value |
17 | # 7. insert after a value |
18 | # 8. remove a value |
19 | # 9. check the values |
20 | # =============================================== |
21 | |
22 | NewDocument D XmlOcaf |
23 | # 1. create BooleanList attribute |
24 | set Lab1 [Label D 0:1:1] |
25 | SetBooleanList D $Lab1 0 0 1 0 |
26 | set info1 [GetBooleanList D $Lab1] |
27 | # output => "0 0 1 0" |
28 | |
29 | # 2. create IntegerList attribute |
30 | set Lab2 [Label D 0:1:2] |
31 | SetIntegerList D $Lab2 0 0 1 0 |
32 | set info2 [GetIntegerList D $Lab2] |
33 | # output => "0 0 1 0" |
34 | |
35 | # 3. create RealList attribute |
36 | set Lab3 [Label D 0:1:3] |
37 | SetRealList D $Lab3 0 0 1 0 |
38 | set info3 [GetRealList D $Lab3] |
39 | # output => "0 0 1 0" |
40 | |
41 | # 4. create ExtStringList attribute |
42 | set Lab4 [Label D 0:1:4] |
43 | SetExtStringList D $Lab4 0 0 1 0 |
44 | set info4 [GetExtStringList D $Lab4] |
45 | # output => "0 0 1 0" |
46 | |
47 | # 5. create ReferenceList attribute |
48 | set Lab5 [Label D 0:1:5] |
49 | SetReferenceList D $Lab5 $Lab1 $Lab2 $Lab4 |
50 | set info5 [GetReferenceList D $Lab5] |
51 | # output => "0:1:1 0:1:2 0:1:4" |
52 | |
53 | # 6. insert before a value |
54 | InsertBeforeBooleanList D $Lab1 3 1 |
55 | InsertBeforeIntegerList D $Lab2 3 1 |
56 | InsertBeforeRealList D $Lab3 3 1 |
57 | InsertBeforeExtStringList D $Lab4 3 1 |
58 | InsertBeforeReferenceList D $Lab5 3 0:1:3 |
59 | # output => "0 0 1 1 0" |
60 | # output => "0:1:1 0:1:2 0:1:3 0:1:4" |
61 | |
62 | # 7. insert after a value |
63 | InsertAfterBooleanList D $Lab1 4 1 |
64 | InsertAfterIntegerList D $Lab2 4 1 |
65 | InsertAfterRealList D $Lab3 4 1 |
66 | InsertAfterExtStringList D $Lab4 4 1 |
67 | InsertAfterReferenceList D $Lab5 4 0:1:5 |
68 | # output => "0 0 1 1 1 0" |
69 | # output => "0:1:1 0:1:2 0:1:3 0:1:4 0:1:5" |
70 | |
71 | # 8. remove a value |
72 | RemoveBooleanList D $Lab1 6 |
73 | RemoveIntegerList D $Lab2 6 |
74 | RemoveRealList D $Lab3 6 |
75 | RemoveExtStringList D $Lab4 6 |
76 | RemoveReferenceList D $Lab5 1 |
77 | # output => "0 0 1 1 1" |
78 | # output => "0:1:2 0:1:3 0:1:4 0:1:5" |
79 | |
80 | # 8. Check the values |
81 | set info6 [GetBooleanList D $Lab1] |
82 | set info7 [GetIntegerList D $Lab2] |
83 | set info8 [GetRealList D $Lab3] |
84 | set info9 [GetExtStringList D $Lab4] |
85 | set info10 [GetReferenceList D $Lab5] |
86 | # output => "0 0 1 1 1" |
87 | # output => "0:1:2 0:1:3 0:1:4 0:1:5" |
88 | |
89 | Close D |
90 | |
91 | if { [regexp {0 0 1 1 1} ${info6}] } { |
92 | puts "OK: inserted and removed values for BooleanList attribute are good" |
93 | } else { |
94 | puts "Error: inserted and removed values for BooleanList attribute are bad" |
95 | } |
96 | |
97 | if { [regexp {0 0 1 1 1} ${info7}] } { |
98 | puts "OK: inserted and removed values for IntegerList attribute are good" |
99 | } else { |
100 | puts "Error: inserted and removed values for IntegerList attribute are bad" |
101 | } |
102 | |
103 | if { [regexp {0 0 1 1 1} ${info8}] } { |
104 | puts "OK: inserted and removed values for RealList attribute are good" |
105 | } else { |
106 | puts "Error: inserted and removed values for RealList attribute are bad" |
107 | } |
108 | |
109 | if { [regexp {0 0 1 1 1} ${info9}] } { |
110 | puts "OK: inserted and removed values for ExtStringList attribute are good" |
111 | } else { |
112 | puts "Error: inserted and removed values for ExtStringList attribute are bad" |
113 | } |
114 | |
115 | if { [regexp {0:1:2 0:1:3 0:1:4 0:1:5} ${info10}] } { |
116 | puts "OK: inserted and removed values for ReferenceList attribute are good" |
117 | } else { |
118 | puts "Error: inserted and removed values for ReferenceList attribute are bad" |
119 | } |