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