355c1551 |
1 | if { [info exists square] } { |
2 | set prop "square" |
3 | set mass $square |
4 | if { [info exists tol_square] } { |
b1c5c4e6 |
5 | # tol_square - The epsilon defines relative precision of computation |
302f96fb |
6 | regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m |
355c1551 |
7 | } else { |
302f96fb |
8 | regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m |
355c1551 |
9 | } |
10 | } |
11 | if { [info exists length] } { |
12 | set prop "length" |
13 | set mass $length |
14 | regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m |
15 | |
16 | puts "checksection" |
17 | puts [checksection result] |
18 | } |
19 | |
20 | #if mass (length or square) is empty in test case then result should be an empty shape. |
21 | if { [info exists mass] } { |
22 | if { [string compare $subgroup "moddata"] != 0 } { |
302f96fb |
23 | puts "checkshape" |
24 | checkshape result |
355c1551 |
25 | } |
26 | |
27 | if { [string compare "$mass" "empty"] != 0 } { |
302f96fb |
28 | if { $m == 0 } { |
29 | puts "Error : The command is not valid. The $prop is 0." |
30 | } |
31 | if { $mass > 0 } { |
32 | puts "The expected $prop is $mass" |
33 | } |
34 | #check of change of square is < 1% |
35 | if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } { |
36 | puts "Error : The $prop of result shape is $m" |
37 | } |
355c1551 |
38 | } else { |
302f96fb |
39 | if { $m != 0 } { |
40 | puts "Error : The command is not valid. The $prop is $m" |
41 | } |
355c1551 |
42 | } |
43 | } |
44 | |
45 | set glob_inf [info global nb_*_good] |
46 | if { [regexp "nb_.*_good" $glob_inf] == 1 } { |
08c28f5b |
47 | if { [info exists nbsh_t] } { |
302f96fb |
48 | set nb_info [nbshapes result -t] |
08c28f5b |
49 | } else { |
302f96fb |
50 | set nb_info [nbshapes result] |
08c28f5b |
51 | } |
355c1551 |
52 | } |
53 | |
54 | if { [info exists nb_v_good] } { |
55 | regexp {VERTEX +: +([-0-9.+eE]+)} $nb_info full nb_v |
56 | if { ${nb_v} != ${nb_v_good} } { |
f2cc4711 |
57 | puts "Error : Result shape is WRONG because it must contains ${nb_v_good} vertices instead of ${nb_v}" |
355c1551 |
58 | } else { |
f2cc4711 |
59 | puts "Result shape contains ${nb_v} vertices" |
355c1551 |
60 | } |
61 | } |
62 | |
63 | if { [info exists nb_e_good] } { |
64 | regexp {EDGE +: +([-0-9.+eE]+)} $nb_info full nb_e |
65 | if { ${nb_e} != ${nb_e_good} } { |
66 | puts "Error : Result shape is WRONG because it must contains ${nb_e_good} edges instead of ${nb_e}" |
67 | } else { |
68 | puts "Result shape contains ${nb_e} edges" |
69 | } |
70 | } |
71 | |
72 | if { [info exists nb_w_good] } { |
73 | regexp {WIRE +: +([-0-9.+eE]+)} $nb_info full nb_w |
74 | if { ${nb_w} != ${nb_w_good} } { |
75 | puts "Error : Result shape is WRONG because it must contains ${nb_w_good} wires instead of ${nb_w}" |
76 | } else { |
77 | puts "Result shape contains ${nb_w} wires" |
78 | } |
79 | } |
80 | |
81 | if { [info exists nb_f_good] } { |
82 | regexp {FACE +: +([-0-9.+eE]+)} $nb_info full nb_f |
83 | if { ${nb_f} != ${nb_f_good} } { |
84 | puts "Error : Result shape is WRONG because it must contains ${nb_f_good} faces instead of ${nb_f}" |
85 | } else { |
86 | puts "Result shape contains ${nb_f} faces" |
87 | } |
88 | } |
89 | |
90 | if { [info exists nb_sh_good] } { |
91 | regexp {SHELL +: +([-0-9.+eE]+)} $nb_info full nb_sh |
92 | if { ${nb_sh} != ${nb_sh_good} } { |
93 | puts "Error : Result shape is WRONG because it must contains ${nb_sh_good} shells instead of ${nb_sh}" |
94 | } else { |
95 | puts "Result shape contains ${nb_sh} shells" |
96 | } |
97 | } |
98 | |
99 | if { [info exists nb_sol_good] } { |
100 | regexp {SOLID +: +([-0-9.+eE]+)} $nb_info full nb_sol |
101 | if { ${nb_sol} != ${nb_sol_good} } { |
102 | puts "Error : Result shape is WRONG because it must contains ${nb_sol_good} solids instead of ${nb_sol}" |
103 | } else { |
104 | puts "Result shape contains ${nb_sol} solids" |
105 | } |
106 | } |
107 | |
108 | if { [info exists nb_compsol_good] } { |
109 | regexp {COMPSOLID +: +([-0-9.+eE]+)} $nb_info full nb_compsol |
110 | if { ${nb_compsol} != ${nb_compsol_good} } { |
111 | puts "Error : Result shape is WRONG because it must contains ${nb_compsol_good} compsolids instead of ${nb_compsol}" |
112 | } else { |
113 | puts "Result shape contains ${nb_compsol} compsolids" |
114 | } |
115 | } |
116 | |
117 | if { [info exists nb_compound_good] } { |
118 | regexp {COMPOUND +: +([-0-9.+eE]+)} $nb_info full nb_compound |
119 | if { ${nb_compound} != ${nb_compound_good} } { |
120 | puts "Error : Result shape is WRONG because it must contains ${nb_compound_good} compounds instead of ${nb_compound}" |
121 | } else { |
122 | puts "Result shape contains ${nb_compound} compounds" |
123 | } |
124 | } |
125 | |
126 | if { [info exists nb_shape_good] } { |
127 | regexp {SHAPE +: +([-0-9.+eE]+)} $nb_info full nb_shape |
128 | if { ${nb_shape} != ${nb_shape_good} } { |
129 | puts "Error : Result shape is WRONG because it must contains ${nb_shape_good} shapes instead of ${nb_shape}" |
130 | } else { |
131 | puts "Result shape contains ${nb_shape} shapes" |
132 | } |
133 | } |
134 | |
f2cc4711 |
135 | if { [info exists nb_fe_good] && [info exists nb_fe] } { |
136 | if { ${nb_fe} != ${nb_fe_good} } { |
137 | puts "Error : Result shape is WRONG because it must contains ${nb_shape_good} shapes instead of ${nb_shape}" |
138 | } else { |
139 | puts "Result shape contains ${nb_fe} free edges" |
140 | } |
141 | } |
142 | |
456b33eb |
143 | if { [info exists rel_tol] } { |
144 | puts "\nChecking triangulation area (triarea command)..." |
145 | set rel_err [expr abs([CheckTriArea result $area_eps])] |
146 | if { $rel_err > $rel_tol } { |
147 | puts "Error : area by triangles differs from the actual area by $rel_err %" |
148 | } else { |
149 | if { $rel_tol > 1 && $rel_tol < 100 } { |
302f96fb |
150 | puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol" |
456b33eb |
151 | } |
152 | } |
153 | } |
154 | |
fa920fb1 |
155 | if { [isdraw result] } { |
18d715bd |
156 | if { [info exists 2dviewer] } { |
302f96fb |
157 | clear |
158 | smallview |
159 | donly result |
160 | fit |
161 | xwd $imagedir/${test_image}.png |
18d715bd |
162 | } |
163 | if { [info exists 3dviewer] } { |
164 | #for multiview support: dump result from all opened views |
165 | set view_str [vviewlist long] |
5064550f |
166 | if { [llength ${view_str}] == 0 } { |
167 | vinit |
168 | set view_str [vviewlist long] |
169 | } |
18d715bd |
170 | set view_list [regexp -all -inline {\S+} $view_str] |
171 | foreach {view_name} $view_list { |
172 | vactivate $view_name |
173 | vclear |
174 | vdisplay result |
175 | vsetdispmode 1 |
176 | vfit |
177 | vzfit |
178 | vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png |
179 | } |
180 | } |
181 | } |
182 | |
183 | if { [info exists only_screen] } { |
184 | #for multiview support: dump result from all opened views |
185 | set view_str [vviewlist long] |
186 | set view_list [regexp -all -inline {\S+} $view_str] |
187 | foreach {view_name} $view_list { |
188 | vactivate $view_name |
189 | vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png |
190 | } |
191 | } |
192 | |
193 | if { [info exists only_screen_axo] } { |
f34eec8f |
194 | xwd $imagedir/${test_image}.png |
195 | } |
196 | |
fa920fb1 |
197 | # to end a test script |
198 | puts "TEST COMPLETED" |