40093367 |
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 abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } { |
32 | puts "Error : The $prop of result shape is $m" |
33 | } |
34 | |
35 | if { [info exists nbsh_v ] } { |
36 | set arr_v [explode result v] |
37 | set nb_v [ llength $arr_v ] |
38 | if { $nb_v != $nbsh_v } { |
39 | puts "Error : Result shape is WRONG because it must contain $nbsh_v vertexes instead of $nb_v" |
40 | } else { |
41 | puts "Result shape contains $nb_v vertexes" |
42 | } |
43 | |
44 | } |
45 | |
46 | if { [info exists nbsh_e ] } { |
47 | set arr_e [explode result e] |
48 | set nb_e [ llength $arr_e ] |
49 | if { $nb_e != $nbsh_e } { |
50 | puts "Error : Result shape is WRONG because it must contain $nbsh_e edges instead of $nb_e" |
51 | } else { |
52 | puts "Result shape contains $nb_e edges" |
53 | } |
54 | } |
55 | } else { |
56 | if { $m != 0 } { |
57 | puts "Error : The $command is not valid. The $prop is $m" |
58 | } |
59 | } |
60 | |
61 | smallview |
62 | if { $m > 0 } { |
63 | donly result |
64 | if { [info exists nbsh_v ] } { |
65 | explode result v |
66 | } |
67 | } else { |
68 | donly a b |
69 | } |
70 | fit |
71 | xwd $imagedir/${test_image}.gif |
72 | } else { |
73 | puts "Error : The $command can not be build." |
74 | } |
75 | |
76 | # to end a test script |
77 | puts "TEST COMPLETED" |