7c104885 |
1 | if { [isdraw result] } { |
2 | #check if result is valid |
3 | |
4 | puts "checkshape" |
5 | set ch [checkshape result] |
6 | puts $ch |
7 | |
8 | if { [info exists square] } { |
9 | set prop "square" |
10 | set mass $square |
11 | regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m |
12 | } |
13 | if { [info exists length] } { |
14 | set prop "length" |
15 | set mass $length |
16 | regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m |
17 | |
18 | puts "checksection" |
19 | puts [checksection result] |
20 | } |
21 | |
22 | #if mass (length or square) is empty in test case then result should be an empty shape. |
23 | if { [string compare "$mass" "empty"] != 0 } { |
24 | if { $m == 0 } { |
25 | puts "Error : The $command is not valid. The $prop is 0." |
26 | } |
27 | if { $mass > 0 } { |
28 | puts "The expected $prop is $mass" |
29 | } |
30 | #check of change of square is < 1% |
31 | if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } { |
32 | puts "Error : The $prop of result shape is $m" |
33 | } |
24def445 |
34 | |
35 | if { [info exists nb_v_good] } { |
36 | regexp {VERTEX +: +([-0-9.+eE]+)} $nb_info full nb_v |
37 | if { ${nb_v} != ${nb_v_good} } { |
38 | puts "Error : Result shape is WRONG because it must contains ${nb_v_good} vertexes instead of ${nb_v}" |
39 | } else { |
40 | puts "Result shape contains ${nb_v} vertexes" |
41 | } |
42 | } |
7c104885 |
43 | |
24def445 |
44 | if { [info exists nb_e_good] } { |
45 | regexp {EDGE +: +([-0-9.+eE]+)} $nb_info full nb_e |
46 | if { ${nb_e} != ${nb_e_good} } { |
47 | puts "Error : Result shape is WRONG because it must contains ${nb_e_good} edges instead of ${nb_e}" |
7c104885 |
48 | } else { |
24def445 |
49 | puts "Result shape contains ${nb_e} edges" |
50 | } |
51 | } |
52 | |
53 | if { [info exists nb_w_good] } { |
54 | regexp {WIRE +: +([-0-9.+eE]+)} $nb_info full nb_w |
55 | if { ${nb_w} != ${nb_w_good} } { |
56 | puts "Error : Result shape is WRONG because it must contains ${nb_w_good} wires instead of ${nb_w}" |
57 | } else { |
58 | puts "Result shape contains ${nb_w} wires" |
59 | } |
60 | } |
61 | |
62 | if { [info exists nb_f_good] } { |
63 | regexp {FACE +: +([-0-9.+eE]+)} $nb_info full nb_f |
64 | if { ${nb_f} != ${nb_f_good} } { |
65 | puts "Error : Result shape is WRONG because it must contains ${nb_f_good} faces instead of ${nb_f}" |
66 | } else { |
67 | puts "Result shape contains ${nb_f} faces" |
68 | } |
69 | } |
70 | |
71 | if { [info exists nb_sh_good] } { |
72 | regexp {SHELL +: +([-0-9.+eE]+)} $nb_info full nb_sh |
73 | if { ${nb_sh} != ${nb_sh_good} } { |
74 | puts "Error : Result shape is WRONG because it must contains ${nb_sh_good} shells instead of ${nb_sh}" |
75 | } else { |
76 | puts "Result shape contains ${nb_sh} shells" |
77 | } |
78 | } |
79 | |
80 | if { [info exists nb_sol_good] } { |
81 | regexp {SOLID +: +([-0-9.+eE]+)} $nb_info full nb_sol |
82 | if { ${nb_sol} != ${nb_sol_good} } { |
83 | puts "Error : Result shape is WRONG because it must contains ${nb_sol_good} solids instead of ${nb_sol}" |
84 | } else { |
85 | puts "Result shape contains ${nb_sol} solids" |
86 | } |
87 | } |
88 | |
89 | if { [info exists nb_compsol_good] } { |
90 | regexp {COMPSOLID +: +([-0-9.+eE]+)} $nb_info full nb_compsol |
91 | if { ${nb_compsol} != ${nb_compsol_good} } { |
92 | puts "Error : Result shape is WRONG because it must contains ${nb_compsol_good} compsolids instead of ${nb_compsol}" |
93 | } else { |
94 | puts "Result shape contains ${nb_compsol} compsolids" |
95 | } |
96 | } |
97 | |
98 | if { [info exists nb_compound_good] } { |
99 | regexp {COMPOUND +: +([-0-9.+eE]+)} $nb_info full nb_compound |
100 | if { ${nb_compound} != ${nb_compound_good} } { |
101 | puts "Error : Result shape is WRONG because it must contains ${nb_compound_good} compounds instead of ${nb_compound}" |
102 | } else { |
103 | puts "Result shape contains ${nb_compound} compounds" |
104 | } |
105 | } |
106 | |
107 | if { [info exists nb_shape_good] } { |
108 | regexp {SHAPE +: +([-0-9.+eE]+)} $nb_info full nb_shape |
109 | if { ${nb_shape} != ${nb_shape_good} } { |
110 | puts "Error : Result shape is WRONG because it must contains ${nb_shape_good} shapes instead of ${nb_shape}" |
111 | } else { |
112 | puts "Result shape contains ${nb_shape} shapes" |
113 | } |
114 | } |
115 | |
7c104885 |
116 | } else { |
117 | if { $m != 0 } { |
118 | puts "Error : The $command is not valid. The $prop is $m" |
119 | } |
120 | } |
121 | } else { |
122 | puts "Error : The $command can not be build." |
123 | } |