Adjusting testing cases for current state of OCCT
[occt.git] / tests / de / end
... / ...
CommitLineData
1# Main script in this test grid; does all the job.
2# Individual test scripts are used only to specify data file and reference
3# test data (expected values of test execution).
4# The procedure is:
5# - load specified data file
6# - check transfer status, shape, and attributes against expected values
7# - write data to
8
9# Set flag dump_file to 1 in order to regenerate script files with actual data
10# used as reference. In this mode all tests intentionaly report failure.
11set dump_file 0
12########################################################################
13set mist_Second 0; set mist_w 0; set mist 0; set isIGES 0;
14############################################ DATA c ################
15set dfal_First 0; set dwar_First 0; set dcomp_First 0
16set dfal_Second 0; set dwar_Second 0; set dcomp_Second 0
17############################################# TPSTAT c ##############
18set fal_First 0; set war_First 0; set comp_First 0
19set fal_Second 0; set war_Second 0; set comp_Second 0
20###################################### DECAF information ##########
21set nblev0_First 0; set nblev1_First 0; set nblev2_First 0; set nblev_total_First 0; set nbshname_First 0;
22set nbshcolor_First 0; set nbshlayer_First 0;
23set nbcentroid_First 0; set nbvolume_First 0; set nbarea_First 0;
24set nbcolor_First 0; set colors_First ""; set nblayer_First 0; set layers_First "";
25set nblev0_Second 0; set nblev1_Second 0; set nblev2_Second 0; set nblev_total_Second 0; set nbshname_Second 0;
26set nbshcolor_Second 0; set nbshlayer_Second 0;
27set nbcentroid_Second 0; set nbvolume_Second 0; set nbarea_Second 0;
28set nbcolor_Second 0; set colors_Second ""; set nblayer_Second 0; set layers_Second "";
29############################################# TOLERANCE ############
30set MaxTol_First 0; set AvgTol_First 0
31set MaxTol_Second 0; set AvgTol_Second 0
32############################################# STATSHAPE ############
33set sol_First 0; set she_First 0; set fac_First 0; set fwir_First 0; set fedg_First 0; set sedg_First 0
34set sol_Second 0; set she_Second 0; set fac_Second 0; set fwir_Second 0; set fedg_Second 0; set sedg_Second 0
35############################################# NBSHAPES #############
36set fa_First 0; set sh_First 0; set so_First 0; set co_First 0; set shpp_First 0
37set fa_Second 0; set sh_Second 0; set so_Second 0; set co_Second 0; set shpp_Second 0
38###################################### CHECKSHAPE ##################
39set chwi_First 0; set chfa_First 0; set chsh_First 0; set chso_First 0
40set chwi_Second 0; set chfa_Second 0; set chsh_Second 0; set chso_Second 0
41###################################################################
42set ref_Compare 0
43set todo_msg ""
44set todo_mask "puts \"TODO CR23096 ALL: "
45set Mandriva_todo_mask "puts \"TODO CR23096 Mandriva2010:"
46set end_line "\" \n"
47##################################################################
48
49# Read original file
50if { [string length $filename] > 1} {
51 set ext [file extension $filename]
52 set ReadCommand ReadStep
53 set WriteCommand WriteStep
54 set isIGES 0
55 if { $ext == ".igs" || $ext == ".iges" } {
56 set ReadCommand ReadIges
57 set WriteCommand WriteIges
58 set isIGES 1
59 }
60 if {[info exist ProductMode] && $ProductMode == "OFF"} {
61 set tmp [param read.step.product.mode OFF]
62 }
63 set path_file [locate_data_file $filename]
64 if { [catch { $ReadCommand D_First $path_file } catch_result] } {
65 set err_msg "Error: First - file was not read - exception "
66 puts $err_msg
67 append todo_msg $todo_mask $err_msg $end_line
68 set mist 1
69 }
70
71} else {
72 set mist 1
73}
74
75# Get information about translation
76if { $mist < 1} {
77 puts ""
78
79 set tps_2 [data c]
80 if { [llength $tps_2] > 0 } {
81 # Finding all strings with warnings
82 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+W:} $tps_2]
83 # Extracting counts of warnings
84 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
85 # Calculating total number of warnings
86 foreach i $b {set dwar_First [expr $dwar_First + $i]}
87 set dwar_First [expr $dwar_First/4]
88
89 # Finding all strings with faulties
90 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+F:} $tps_2]
91 # Extracting counts of faulties
92 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
93 # Calculating total number of faulties
94 foreach i $b {set dfal_First [expr $dfal_First + $i]}
95 set dfal_First [expr $dfal_First/4]
96 # Calculating total number of faulties and warnings
97 set dcomp_First [expr $dfal_First + $dwar_First]
98
99 } else {
100 puts " DATA c checking was NOT provided"
101 }
102
103 puts ""
104 set tps_1 [tpstat c]
105 set colvo [llength $tps_1]
106 if { ${colvo} > 0 } {
107 # Finding all strings with warnings
108 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+W:} $tps_1]
109 # Extracting counts of warnings
110 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
111 # Calculating total number of warnings
112 foreach i $b {set war_First [expr $war_First + $i]}
113 set war_First [expr $war_First/4]
114
115 # Finding all strings with faulties
116 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+F:} $tps_1]
117 # Extracting counts of faulties
118 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
119 # Calculating total number of faulties
120 foreach i $b {set fal_First [expr $fal_First + $i]}
121 set fal_First [expr $fal_First/4]
122 # Calculating total number of faulties and warnings
123 set comp_First [expr $fal_First + $war_First]
124
125
126 } else {
127 puts " TPSTAT c checking was NOT provided"
128 }
129
130 # Get DECAF information about (color, layers and properties)
131 puts ""
132
133 set xst [ XStat D_First ]
134
135 if { [llength $xst] > 0 } {
136 regexp {level +N +0 +: +([-0-9.+eE]+)} $xst full nblev0_First
137 regexp {level +N +1 +: +([-0-9.+eE]+)} $xst full nblev1_First
138 regexp {level +N +2 +: +([-0-9.+eE]+)} $xst full nblev2_First
139 regexp {Total +number +of +labels +for +shapes +in +the +document += +([-0-9.+eE]+)} $xst full nblev_total_First
140 regexp {Number +of +labels +with +name += +([-0-9.+eE]+)} $xst full nbshname_First
141 regexp {Number +of +labels +with +color +link += +([-0-9.+eE]+)} $xst full nbshcolor_First
142 regexp {Number +of +labels +with +layer +link += +([-0-9.+eE]+)} $xst full nbshlayer_First
143 regexp {Number +of +Centroid Props += +([-0-9.+eE]+)} $xst full nbcentroid_First
144 regexp {Number +of +Volume Props += +([-0-9.+eE]+)} $xst full nbvolume_First
145 regexp {Number +of +Area Props += +([-0-9.+eE]+)} $xst full nbarea_First
146 regexp {Number +of +colors += +([-0-9.+eE]+)} $xst full nbcolor_First
147 regexp {Number +of +colors += +[-0-9.+eE]+\n([^\n]*)} $xst full colors_First
148 regexp {Number +of +layers += +([-0-9.+eE]+)} $xst full nblayer_First
149 regexp {Number +of +layers += +[-0-9.+eE]+\n([^\n]*)} $xst full layers_First
150 } else {
151 puts " DECAF information was NOT provided"
152 }
153
154 # Get shape for standard analysis
155 puts ""
156 if { [catch { XGetOneShape res_1 D_First } catch_result] } {
157 set err_msg ""Error : First - cannot get shape from document - exception"
158 puts $err_msg
159 append todo_msg $todo_mask $err_msg $end_line
160 set mist 1
161 }
162 if { $mist < 1 && [info exists res_1] == 0 } {
163 set err_msg "Error : First - cannot read any relevant data from the file"
164 puts $err_msg
165 append todo_msg $todo_mask $err_msg $end_line
166 set mist 1
167 }
168
169
170 if { $mist < 1 } {
171 # Standard analysis
172 puts ""
173
174 set tol [tolerance res_1]
175
176 if { [llength $tol] > 0 } {
177 regexp {Tolerance +MAX=([-0-9.+eE]+) +AVG=([-0-9.+eE]+) +MIN=[-0-9.+eE]+} $tol full MaxTol_First AvgTol_First
178 } else {
179 puts " TOLERANCE checking was NOT provided"
180 }
181
182 puts ""
183
184 set tps_3 [ statshape res_1]
185 set col [llength $tps_3]
186 if { ${col} > 0 } {
187 regexp {([-0-9.+eE]+)\t+ +EDGE \(Free\)} $tps_3 full fedg_First
188 regexp {([-0-9.+eE]+)\t+ +EDGE \(Shared\)} $tps_3 full sedg_First
189 regexp {([-0-9.+eE]+)\t+ +WIRE \(Free\)} $tps_3 full fwir_First
190 regexp {([-0-9.+eE]+)\t+ +FACE} $tps_3 full fac_First
191 regexp {([-0-9.+eE]+)\t+ +SHELL} $tps_3 full she_First
192 regexp {([-0-9.+eE]+)\t+ +SOLID} $tps_3 full sol_First
193 } else {
194 puts " STATSHAPE checking was NOT provided"
195 }
196 puts ""
197
198
199 set nbs [ nbshapes res_1]
200 if { [llength ${nbs}] > 0 } {
201 regexp {FACE +: +([-0-9.+eE]+)} $nbs full fa_First
202 regexp {SHELL +: +([-0-9.+eE]+)} $nbs full sh_First
203 regexp {SOLID +: +([-0-9.+eE]+)} $nbs full so_First
204 regexp {COMPOUND +: +([-0-9.+eE]+)} $nbs full co_First
205 regexp {SHAPE +: +([-0-9.+eE]+)} $nbs full shpp_First
206 } else {
207 puts " NBSHAPES checking was NOT provided"
208 }
209
210
211 set chbr [checkshape res_1 ff]
212 if { [llength ${chbr}] > 0 } {
213 regexp {WIRE\t+: +([-0-9.+eE]+).+} $chbr full chwi_First
214 regexp {FACE\t+: +([-0-9.+eE]+).+} $chbr full chfa_First
215 regexp {SHELL\t+: +([-0-9.+eE]+).+} $chbr full chsh_First
216 regexp {SOLID\t+: +([-0-9.+eE]+).+} $chbr full chso_First
217 } else {
218 puts " CHECKSHAPE checking was NOT provided"
219 }
220 }
221}
222# Writing file
223if { $mist < 1} {
224 puts " "
225 puts "-----------------------------WRITING FILE ------------------------------"
226 file delete $imagedir/${casename}_D_First$ext
227 if { [catch { $WriteCommand D_First $imagedir/${casename}_D_First$ext } catch_result] } {
228 set err_msg "Error: First - file was not written - exception"
229 puts $err_msg
230 append todo_msg $todo_mask $err_msg $end_line
231 set mist_w 1
232 }
233 if { $mist_w < 1 } {
234
235 if { [catch { $ReadCommand D_Second $imagedir/${casename}_D_First$ext } catch_result] } {
236 set err_msg "Errorr: Second - file was not read - exception"
237 puts $err_msg
238 append todo_msg $todo_mask $err_msg $end_line
239 set mist_Second 1
240 }
241 }
242 catch {[file delete $imagedir/${casename}_D_First$ext]}
243 # Close the document
244
245 if { [catch { Close D_First } catch_result] } {
246 set err_msg "Error : cannot close a document D_First - exception"
247 puts $err_msg
248 append todo_msg $todo_mask $err_msg $end_line
249 #set mist 1
250 }
251}
252
253if { $mist_w > 0 || $mist_Second > 0 } {
254 set mist 2
255}
256
257# Get information about translation
258if { $mist < 1} {
259 puts ""
260
261 set tps_2 [data c]
262 if { [llength $tps_2] > 0 } {
263 # Finding all strings with warnings
264 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+W:} $tps_2]
265 # Extracting counts of warnings
266 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
267 # Calculating total number of warnings
268 foreach i $b {set dwar_Second [expr $dwar_Second + $i]}
269 set dwar_Second [expr $dwar_Second/4]
270
271 # Finding all strings with faulties
272 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+F:} $tps_2]
273 # Extracting counts of faulties
274 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
275 # Calculating total number of faulties
276 foreach i $b {set dfal_Second [expr $dfal_Second + $i]}
277 set dfal_Second [expr $dfal_Second/4]
278 # Calculating total number of faulties and warnings
279 set dcomp_Second [expr $dfal_Second + $dwar_Second]
280
281
282 } else {
283 puts " DATA c checking was NOT provided"
284 }
285
286 puts ""
287
288 set tps_1 [tpstat c]
289 set colvo [llength $tps_1]
290 if { ${colvo} > 0 } {
291 # Finding all strings with warnings
292 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+W:} $tps_1]
293 # Extracting counts of warnings
294 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
295 # Calculating total number of warnings
296 foreach i $b {set war_Second [expr $war_Second + $i]}
297 set war_Second [expr $war_Second/4]
298
299 # Finding all strings with faulties
300 set a [regexp -all -inline {[\t ]+([-0-9.+eE]+)[\t ]+F:} $tps_1]
301 # Extracting counts of faulties
302 set b [regexp -all -inline {([-0-9.+eE]+)} $a]
303 # Calculating total number of faulties
304 foreach i $b {set fal_Second [expr $fal_Second + $i]}
305 set fal_Second [expr $fal_Second/4]
306 # Calculating total number of faulties and warnings
307 set comp_Second [expr $fal_Second + $war_Second]
308
309
310 } else {
311 puts " TPSTAT c checking was NOT provided"
312 }
313
314 # Get DECAF information about (color, layers and properties)
315 puts ""
316
317 set xst [ XStat D_Second ]
318 if { [llength $xst] > 0 } {
319 regexp {level +N +0 +: +([-0-9.+eE]+)} $xst full nblev0_Second
320 regexp {level +N +1 +: +([-0-9.+eE]+)} $xst full nblev1_Second
321 regexp {level +N +2 +: +([-0-9.+eE]+)} $xst full nblev2_Second
322 regexp {Total +number +of +labels +for +shapes +in +the +document += +([-0-9.+eE]+)} $xst full nblev_total_Second
323 regexp {Number +of +labels +with +name += +([-0-9.+eE]+)} $xst full nbshname_Second
324 regexp {Number +of +labels +with +color +link += +([-0-9.+eE]+)} $xst full nbshcolor_Second
325 regexp {Number +of +labels +with +layer +link += +([-0-9.+eE]+)} $xst full nbshlayer_Second
326 regexp {Number +of +Centroid Props += +([-0-9.+eE]+)} $xst full nbcentroid_Second
327 regexp {Number +of +Volume Props += +([-0-9.+eE]+)} $xst full nbvolume_Second
328 regexp {Number +of +Area Props += +([-0-9.+eE]+)} $xst full nbarea_Second
329 regexp {Number +of +colors += +([-0-9.+eE]+)} $xst full nbcolor_Second
330 regexp {Number +of +colors += +[-0-9.+eE]+\n([^\n]*)} $xst full colors_Second
331 regexp {Number +of +layers += +([-0-9.+eE]+)} $xst full nblayer_Second
332 regexp {Number +of +layers += +[-0-9.+eE]+\n([^\n]*)} $xst full layers_Second
333 } else {
334 puts " DECAF information was NOT provided"
335 }
336 # Get shape for standard analysis
337 puts ""
338 if { [catch { XGetOneShape res_2 D_Second } catch_result] } {
339 set err_msg "Error : Second - cannot get shape from document - exception"
340 puts $err_msg
341 append todo_msg $todo_mask $err_msg $end_line
342 set mist 1
343 }
344 if { $mist < 1 && [info exists res_2] == 0 } {
345 set err_msg "Error : Second - cannot read any relevant data from the file"
346 puts $err_msg
347 append todo_msg $todo_mask $err_msg $end_line
348
349 set mist_Second 1
350 set mist 1
351 }
352
353 if { $mist < 1} {
354 # Standard analysis
355 puts ""
356
357 set tol [tolerance res_2]
358 if { [llength $tol] > 0 } {
359 regexp {Tolerance +MAX=([-0-9.+eE]+) +AVG=([-0-9.+eE]+) +MIN=[-0-9.+eE]+} $tol full MaxTol_Second AvgTol_Second
360 } else {
361 puts " TOLERANCE checking was NOT provided"
362 }
363
364 puts ""
365
366 set tps_3 [ statshape res_2]
367 set col [llength $tps_3]
368 if { ${col} > 0 } {
369 regexp {([-0-9.+eE]+)\t+ +EDGE \(Free\)} $tps_3 full fedg_Second
370 regexp {([-0-9.+eE]+)\t+ +EDGE \(Shared\)} $tps_3 full sedg_Second
371 regexp {([-0-9.+eE]+)\t+ +WIRE \(Free\)} $tps_3 full fwir_Second
372 regexp {([-0-9.+eE]+)\t+ +FACE} $tps_3 full fac_Second
373 regexp {([-0-9.+eE]+)\t+ +SHELL} $tps_3 full she_Second
374 regexp {([-0-9.+eE]+)\t+ +SOLID} $tps_3 full sol_Second
375 } else {
376 puts " STATSHAPE checking was NOT provided"
377 }
378 puts ""
379
380
381 set nbs [ nbshapes res_2]
382 if { [llength ${nbs}] > 0 } {
383 regexp {FACE +: +([-0-9.+eE]+)} $nbs full fa_Second
384 regexp {SHELL +: +([-0-9.+eE]+)} $nbs full sh_Second
385 regexp {SOLID +: +([-0-9.+eE]+)} $nbs full so_Second
386 regexp {COMPOUND +: +([-0-9.+eE]+)} $nbs full co_Second
387 regexp {SHAPE +: +([-0-9.+eE]+)} $nbs full shpp_Second
388 } else {
389 puts " NBSHAPES checking was NOT provided"
390 }
391
392
393 set chbr [checkshape res_2 ff]
394 if { [llength ${chbr}] > 0 } {
395 regexp {WIRE\t+: +([-0-9.+eE]+).+} $chbr full chwi_Second
396 regexp {FACE\t+: +([-0-9.+eE]+).+} $chbr full chfa_Second
397 regexp {SHELL\t+: +([-0-9.+eE]+).+} $chbr full chsh_Second
398 regexp {SOLID\t+: +([-0-9.+eE]+).+} $chbr full chso_Second
399 } else {
400 puts " CHECKSHAPE checking was NOT provided"
401 }
402 }
403}
404
405#Collect results of loop back test
406
407if { $mist < 1 } {
408 set dat_check "DATA : OK"
409 set tpst_check "TPSTAT : OK"
410 set check_check "CHECKSHAPE : OK"
411 set nbsh_check "NBSHAPES : OK"
412 set ststh_check "STATSHAPE : OK"
413 set toler_check "TOLERANCE : OK"
414 set lbls_check "LABELS : OK"
415 set prps_check "PROPS : OK"
416 set clrs_check "COLORS : OK"
417 set lrs_check "LAYERS : OK"
418
419 if { $dcomp_First < $dcomp_Second || $dfal_First < $dfal_Second } {
420 set dat_check "DATA : Faulty"
421 append todo_msg $todo_mask $dat_check $end_line
422 }
423 if { $fal_First < $fal_Second || $war_First < $war_Second } {
424
425 set tpst_check "TPSTAT : Faulty"
426 append todo_msg $todo_mask $tpst_check $end_line
427 }
428 if { $chwi_First < $chwi_Second || $chfa_First < $chfa_Second || $chsh_First < $chsh_Second || $chso_First < $chso_Second } {
429 set check_check "CHECKSHAPE : Faulty"
430 append todo_msg $todo_mask $check_check $end_line
431 }
432 if { ($isIGES == 0 && $shpp_First > $shpp_Second) ||
433 ($isIGES == 1 && ($shpp_First - $co_First) > ($shpp_Second - $co_Second))} {
434 set nbsh_check "NBSHAPES : Faulty"
435 append todo_msg $todo_mask $nbsh_check $end_line
436 }
437 if { $sol_First < $sol_Second || $she_First < $she_Second || $fac_First < $fac_Second || $fwir_First < $fwir_Second || $fedg_First < $fedg_Second} {
438 set ststh_check "STATSHAPE : Faulty"
439 append todo_msg $todo_mask $ststh_check $end_line
440 }
441
442 if { ([expr 1.*($MaxTol_Second - $MaxTol_First)] > [expr 0.0001 * $MaxTol_First] && [expr 1. * abs($MaxTol_First-$MaxTol_Second)] > 0.0000001) || ($MaxTol_Second == 0 && $MaxTol_First > 0)} {
443 set toler_check "TOLERANCE : Faulty"
444 append todo_msg $todo_mask $toler_check $end_line
445 }
446
447 if { $nblev0_First != $nblev0_Second || $nblev1_First != $nblev1_Second || $nblev2_First != $nblev2_Second || $nblev_total_First != $nblev_total_Second || $nbshname_First != $nbshname_Second || $nbshcolor_First != $nbshcolor_Second || $nbshlayer_First != $nbshlayer_Second } {
448 set lbls_check "LABELS : Faulty"
449 append todo_msg $todo_mask $lbls_check $end_line
450 }
451 if { $nbcentroid_First != $nbcentroid_Second || $nbvolume_First != $nbvolume_Second || $nbarea_First != $nbarea_Second } {
452 set prps_check "PROPS : Faulty"
453 append todo_msg $todo_mask $prps_check $end_line
454 }
455 if { $nbcolor_First != $nbcolor_Second } {
456 set clrs_check "COLORS : Faulty"
457 append todo_msg $todo_mask $clrs_check $end_line
458 }
459 if { $nblayer_First != $nblayer_Second } {
460 set lrs_check "LAYERS : Faulty"
461 append todo_msg $todo_mask $lrs_check $end_line
462 }
463}
464
465if { $mist != 1 } {
466 puts ""
467 set result ""
468 append result [format "DATA : Faulties = %s ( %s ) Warnings = %s ( %s ) Summary = %s ( %s )\n" \
469 $dfal_Second $dfal_First $dwar_Second $dwar_First $dcomp_Second $dcomp_First ]
470 append result [format "TPSTAT : Faulties = %s ( %s ) Warnings = %s ( %s ) Summary = %s ( %s )\n" \
471 $fal_Second $fal_First $war_Second $war_First $comp_Second $comp_First ]
472 append result [format "CHECKSHAPE : Wires = %s ( %s ) Faces = %s ( %s ) Shells = %s ( %s ) Solids = %s ( %s )\n" \
473 $chwi_Second $chwi_First $chfa_Second $chfa_First $chsh_Second $chsh_First $chso_Second $chso_First ]
474 append result [format "NBSHAPES : Solid = %s ( %s ) Shell = %s ( %s ) Face = %s ( %s ) Summary = %s ( %s )\n" \
475 $so_Second $so_First $sh_Second $sh_First $fa_Second $fa_First $shpp_Second $shpp_First ]
476 append result [format "STATSHAPE : Solid = %s ( %s ) Shell = %s ( %s ) Face = %s ( %s ) FreeWire = %s ( %s ) FreeEdge = %s ( %s ) SharedEdge = %s ( %s )\n" \
477 $sol_Second $sol_First $she_Second $she_First $fac_Second $fac_First $fwir_Second $fwir_First $fedg_Second $fedg_First $sedg_Second $sedg_First ]
478 append result [format "TOLERANCE : MaxTol = %14.10g ( %14.10g ) AvgTol = %14.10g ( %14.10g )\n" \
479 $MaxTol_Second $MaxTol_First $AvgTol_Second $AvgTol_First ]
480 append result [format "LABELS : N0Labels = %s ( %s ) N1Labels = %s ( %s ) N2Labels = %s ( %s ) TotalLabels = %s ( %s ) NameLabels = %s ( %s ) ColorLabels = %s ( %s ) LayerLabels = %s ( %s )\n" \
481 $nblev0_Second $nblev0_First $nblev1_Second $nblev1_First $nblev2_Second $nblev2_First $nblev_total_Second $nblev_total_First $nbshname_Second $nbshname_First $nbshcolor_Second $nbshcolor_First $nbshlayer_Second $nbshlayer_First ]
482 append result [format "PROPS : Centroid = %s ( %s ) Volume = %s ( %s ) Area = %s ( %s )\n" \
483 $nbcentroid_Second $nbcentroid_First $nbvolume_Second $nbvolume_First $nbarea_Second $nbarea_First ]
484 append result [format "NCOLORS : NColors = %s ( %s )\n" \
485 $nbcolor_Second $nbcolor_First ]
486 append result [format "COLORS : Colors = %s ( %s )\n" \
487 [lsort $colors_Second] [lsort $colors_First] ]
488 append result [format "NLAYERS : NLayers = %s ( %s )\n" \
489 $nblayer_Second $nblayer_First ]
490 append result [format "LAYERS : Layers = %s ( %s )\n" \
491 [lsort $layers_Second] [lsort $layers_First] ]
492}
493
494puts ""
495puts ""
496puts "########################### RESULTS ###############################"
497puts ""
498puts "========================== Loop Back test ========================="
499puts ""
500if {$mist == 1 } {
501 set err_msg "Error : Here is reading problem"
502 puts $err_msg
503 append todo_msg $todo_mask $err_msg $end_line
504} else {
505 puts "File was read PROPERLY - OK"
506 puts ""
507 if {$mist_w > 0 } {
508 set err_msg "Error : Here is writing problem"
509 puts $err_msg
510 append todo_msg $todo_mask $err_msg $end_line
511 } else {
512 puts "File was write PROPERLY - OK"
513 puts ""
514 if {$mist_Second > 0 } {
515 set err_msg "Error : Here is reading problem for writing file"
516 puts $err_msg
517 append todo_msg $todo_mask $err_msg $end_line
518 } else {
519 puts "Writing file was read PROPERLY - OK"
520 puts ""
521 puts $dat_check
522 puts $tpst_check
523 puts $check_check
524 puts $nbsh_check
525 puts $ststh_check
526 puts $toler_check
527 puts $lbls_check
528 puts $prps_check
529 puts $clrs_check
530 puts $lrs_check
531 puts ""
532 if { $todo_msg != "" } {
533 puts $result
534 puts ""
535 }
536 }
537 }
538}
539
540
541set err_compare_ref ""
542
543# Put reference data to the test script file if option "dump" is set
544if { $dump_file == 1 } {
545 set fd_stream [open $dirname/$groupname/$gridname/$casename w]
546 puts $fd_stream "# !!!! This file is generated automatically, do not edit manually! See end script"
547 if { $todo_msg != "" } {
548 puts $fd_stream $todo_msg
549 puts $fd_stream ""
550 }
551 if {[info exist LinuxFaulties] && [llength $LinuxFaulties] != 0} {
552 for {set i 0} { $i < [llength $LinuxFaulties] } { incr i } {
553 puts $fd_stream "$Mandriva_todo_mask [lindex $LinuxFaulties $i] : Faulty $end_line"
554 }
555 }
556 if {[info exist LinuxDiff] && $LinuxDiff != 0} {
557 puts $fd_stream "$Mandriva_todo_mask Error : $LinuxDiff differences with reference data found :$end_line"
558 }
559
560 if {[info exist LinuxDiff] && $LinuxDiff != 0} {
561 puts $fd_stream "set LinuxDiff $LinuxDiff"
562 set LinuxDiff 0
563 }
564 if {[info exist LinuxFaulties] && [llength $LinuxFaulties] != 0} {
565 puts $fd_stream "set LinuxFaulties \{$LinuxFaulties\}"
566 set LinuxFaulties {}
567 }
568 if {[info exist ProductMode] && $ProductMode == "OFF"} {
569 puts $fd_stream "set ProductMode OFF"
570 }
571 puts $fd_stream "set filename $filename"
572 if { $mist != 1 } {
573 puts $fd_stream ""
574 puts $fd_stream "set ref_data \{"
575 puts $fd_stream $result
576 puts $fd_stream "\}"
577 }
578 close $fd_stream
579} elseif { $mist != 1 } {
580 puts "========================== Comparision with reference data ========"
581 puts ""
582 # Comparision of reference data with obtained result
583 set ref_list [split $ref_data \n]
584 set cur_list [split $result \n]
585 set nb_ref [llength $ref_list]
586 set nb_cur [llength $cur_list]
587 for { set i 0 } { $i < $nb_cur } { incr i } {
588 set j [expr $i +1]
589 set refstr [lindex $ref_list $j]
590 set curstr [lindex $cur_list $i]
591 set isSplit 0;
592 set isOK 1;
593
594 if {[regexp "DATA :" $refstr]} {
595 set isSplit 1;
596 set data_ref [split $refstr " "]
597 set data_cur [split $curstr " "]
598 set k_ref 1; set k_cur 1
599 for { set k 1 } { $k <= 2 } { incr k } {
600 while {[string is integer -strict [lindex $data_ref $k_ref]] == 0} {incr k_ref}
601 while {[string is integer -strict [lindex $data_cur $k_cur]] == 0} {incr k_cur}
602 set ref_number [lindex $data_ref $k_ref]
603 set cur_number [lindex $data_cur $k_cur]
604 incr k_ref
605 incr k_cur
606 if { $cur_number > $ref_number} {
607 set isOK 0
608 }
609 }
610 }
611 if {[regexp "TPSTAT :" $refstr]} {
612 set isSplit 1;
613 set data_ref [split $refstr " "]
614 set data_cur [split $curstr " "]
615 set k_ref 1; set k_cur 1
616 for { set k 1 } { $k <= 2 } { incr k } {
617 while {[string is integer -strict [lindex $data_ref $k_ref]] == 0} {incr k_ref}
618 while {[string is integer -strict [lindex $data_cur $k_cur]] == 0} {incr k_cur}
619 set ref_number [lindex $data_ref $k_ref]
620 set cur_number [lindex $data_cur $k_cur]
621 incr k_ref
622 incr k_cur
623 if { $cur_number > $ref_number} {
624 set isOK 0
625 }
626 }
627 }
628 if {[regexp "CHECKSHAPE :" $refstr]} {
629 set isSplit 1;
630 set data_ref [split $refstr " "]
631 set data_cur [split $curstr " "]
632 set k_ref 1; set k_cur 1
633 for { set k 1 } { $k <= 8 } { incr k } {
634 while {[string is integer -strict [lindex $data_ref $k_ref]] == 0} {incr k_ref}
635 while {[string is integer -strict [lindex $data_cur $k_cur]] == 0} {incr k_cur}
636 set ref_number [lindex $data_ref $k_ref]
637 set cur_number [lindex $data_cur $k_cur]
638 incr k_ref
639 incr k_cur
640 if { $cur_number > $ref_number} {
641 set isOK 0
642 }
643 }
644 }
645
646 if {[regexp "TOLERANCE :" $refstr]} {
647 set isSplit 1;
648 set data_ref [split $refstr " "]
649 set data_cur [split $curstr " "]
650 set k_ref 1; set k_cur 1
651 for { set k 1 } { $k <= 4 } { incr k } {
652 while {[string is double -strict [lindex $data_ref $k_ref]] == 0} {incr k_ref}
653 while {[string is double -strict [lindex $data_cur $k_cur]] == 0} {incr k_cur}
654 set ref_number [lindex $data_ref $k_ref]
655 set cur_number [lindex $data_cur $k_cur]
656 incr k_ref
657 incr k_cur
658 if { [expr 1. * ($cur_number-$ref_number)] > 0.0001 &&
659 [expr 1. * ($cur_number-$ref_number)] > [expr 0.01 * $ref_number]} {
660 set isOK 0
661 }
662 }
663 }
664
665
666 if {$isSplit == 0} {
667 if {$refstr != $curstr} {set isOK 0}
668 }
669
670 if { $isOK == 0} {
671 incr ref_Compare
672 append err_compare_ref " Reference data - $refstr\n"
673 append err_compare_ref " Current data - $curstr\n"
674 append err_compare_ref "----------------------------------------------\n"
675 }
676 }
677}
678
679if { $dump_file != 0 } {
680 puts "Error : Running in regeneration mode, comparision was not performed!"
681 if { $mist != 1 } {
682 puts "Generation of test file $groupname/$gridname/$casename successful"
683 } else {
684 puts "Generation of reference data failed"
685 }
686} else {
687 if { $ref_Compare > 0} {
688 puts "Error : $ref_Compare differences with reference data found :\n$err_compare_ref"
689 } else {
690 puts "Comparision of current result with reference data - OK\n"
691 }
692}
693
694puts "--------------------------------------------------------------------"
695puts ""
696
697clear
698smallview
699if { $mist < 1 } {
700 if { [info exists res_2] && [isdraw res_2] } {
701 donly res_2
702 }
703}
704fit
705xwd $imagedir/${test_image}.gif
706if { $mist < 1 } {
707 if { [catch { Close D_Second } catch_result] } {
708 puts "Error : cannot close a document D_Second"
709 }
710}
711set ProductMode ON
712
713puts "TEST COMPLETED"