40093367 |
1 | if { [isdraw result] } { |
2 | #check if result is valid |
3 | |
4 | puts "checkshape" |
5 | set ch [checkshape result] |
6 | puts $ch |
7 | |
cd37e048 |
8 | if {[info exists command] && ${command} == "mkvolume"} { |
9 | set bcheck [bopcheck result] |
10 | puts $bcheck |
11 | if {![regexp {This shape seems to be OK.} $bcheck]} { |
12 | puts "Error: bopcheck failed" |
13 | } |
14 | } |
40093367 |
15 | if { [info exists square] } { |
6aac585a |
16 | set prop "area" |
40093367 |
17 | set mass $square |
18 | regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m |
19 | } |
20 | if { [info exists length] } { |
21 | set prop "length" |
22 | set mass $length |
23 | regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m |
24 | |
25 | puts "checksection" |
26 | puts [checksection result] |
27 | } |
28 | |
29 | #if mass (length or square) is empty in test case then result should be an empty shape. |
cd37e048 |
30 | if { [info exists mass] && [string compare "$mass" "empty"] != 0 } { |
40093367 |
31 | if { $m == 0 } { |
32 | puts "Error : The $command is not valid. The $prop is 0." |
33 | } |
34 | if { $mass > 0 } { |
35 | puts "The expected $prop is $mass" |
36 | } |
37 | #check of change of square is < 1% |
49c093ae |
38 | if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } { |
94a57f1f |
39 | puts "Error : The $prop of the resulting shape is $m" |
40093367 |
40 | } |
41 | |
42 | if { [info exists nbsh_v ] } { |
43 | set arr_v [explode result v] |
44 | set nb_v [ llength $arr_v ] |
45 | if { $nb_v != $nbsh_v } { |
94a57f1f |
46 | puts "Error : The resulting shape is WRONG because it must contain $nbsh_v vertexes instead of $nb_v" |
40093367 |
47 | } else { |
94a57f1f |
48 | puts "The resulting shape contains $nb_v vertexes" |
40093367 |
49 | } |
50 | |
51 | } |
52 | |
53 | if { [info exists nbsh_e ] } { |
54 | set arr_e [explode result e] |
55 | set nb_e [ llength $arr_e ] |
56 | if { $nb_e != $nbsh_e } { |
94a57f1f |
57 | puts "Error : The resulting shape is WRONG because it must contain $nbsh_e edges instead of $nb_e" |
40093367 |
58 | } else { |
94a57f1f |
59 | puts "The resulting shape contains $nb_e edges" |
40093367 |
60 | } |
61 | } |
62 | } else { |
cd37e048 |
63 | if { [info exists mass] && $m != 0 } { |
40093367 |
64 | puts "Error : The $command is not valid. The $prop is $m" |
65 | } |
66 | } |
67 | |
68 | smallview |
cd37e048 |
69 | if { [info exists m ] } { |
70 | if { $m > 0 } { |
71 | donly result |
72 | if { [info exists nbsh_v ] } { |
40093367 |
73 | explode result v |
cd37e048 |
74 | } |
75 | } else { |
76 | donly a b |
77 | } |
40093367 |
78 | } else { |
cd37e048 |
79 | donly result |
40093367 |
80 | } |
81 | fit |
88f8fc81 |
82 | xwd $imagedir/${test_image}.png |
40093367 |
83 | } else { |
94a57f1f |
84 | puts "Error : The $command cannot be built." |
40093367 |
85 | } |
86 | |
87 | # to end a test script |
88 | puts "TEST COMPLETED" |