3 if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
8 # to prevent loops limit to 16 minutes
12 set max_rel_tol_diff 0
14 if { [info exists imagedir] == 0 } {
17 if { [info exists test_image] == 0 } {
21 # Procedure to check equality of two reals with tolerance (relative and absolute)
22 help checkarea {shape area_expected tol_abs tol_rel}
23 proc checkarea {shape area_expected tol_abs tol_rel} {
24 # compute area with half of the relative tolerance
25 # to be used in comparison; 0.001 is added to avoid zero value
26 set prop [uplevel sprops $shape [expr 0.5 * abs($tol_rel) + 0.001]]
29 if { ! [regexp {Mass\s*:\s*([0-9.e+-]+)} $prop res area] } {
30 puts "Error: cannot get area of the shape $shape"
34 # compare with expected value
35 checkreal "area of $shape" $area $area_expected $tol_abs $tol_rel
38 # Check if area of triangles is valid
39 proc CheckTriArea {shape {eps 0}} {
40 upvar #0 $shape result
41 set area [triarea result $eps]
42 set t_area [lindex $area 0]
43 set g_area [expr abs([lindex $area 1])]
44 puts "area by triangles: $t_area"
45 puts "area by geometry: $g_area"
46 expr ($t_area - $g_area) / $g_area * 100
50 proc checktime {value expected tol_rel message} {
51 set t1 [expr ${value} - ${expected}]
52 set t2 [expr ${expected} * abs (${tol_rel})]
54 if { abs (${t1}) <= ${t2} } {
55 puts "OK. ${message}, ${value} seconds, is equal to expected time - ${expected} seconds"
56 } elseif {${t1} > ${t2}} {
57 puts "Error. ${message}, ${value} seconds, is more than expected time - ${expected} seconds"
59 puts "Improvement. ${message}, ${value} seconds, is less than expected time - ${expected} seconds"