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