File: end

package info (click to toggle)
opencascade 7.5.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 290,544 kB
  • sloc: cpp: 1,190,524; tcl: 15,703; cs: 5,173; java: 1,557; ansic: 1,174; sh: 901; xml: 699; perl: 54; makefile: 27
file content (124 lines) | stat: -rw-r--r-- 3,792 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Set flag dump_file to 1 in order to regenerate script files with actual data
# used as reference. In this mode all tests intentionaly report failure. 
set dump_file 0
########################################################################
set mist 0;
set nbTol 0;
set nbDim 0;
set nbDat 0;
set nbDatT 0;
set nbAttDat 0;
###################################################################
set ref_Compare 0
set todo_msg ""
set todo_mask "puts \"TODO CR23096 ALL: "
set Mandriva_todo_mask "puts \"TODO CR23096 ALL:"
set end_line "\" \n"
##################################################################

# Read original file
if { [string length $filename] > 1} {
    set path_file [locate_data_file $filename]
    if { [catch { ReadStep D_First $path_file } catch_result] } {
        set err_msg "Error: First - file was not read - exception "
	puts $err_msg
	append todo_msg $todo_mask $err_msg $end_line
        set mist 1
    }

} else {
  set mist 1
}

# Get information about translation
if { $mist < 1} {           
    puts ""
   
    set xst [ XDumpNbDGTs D_First ] 

    if { [llength $xst] > 0 } {
	regexp {NbOfDimensions +: +([-0-9.+eE]+)} $xst full nbDim
	regexp {NbOfTolerances +: +([-0-9.+eE]+)} $xst full nbTol
	regexp {NbOfDatumFeature +: +([-0-9.+eE]+)} $xst full nbDat
	regexp {NbOfAttachedDatum +: +([-0-9.+eE]+)} $xst full nbAttDat
	regexp {NbOfDatumTarget +: +([-0-9.+eE]+)} $xst full nbDatT
    } else {
	puts " GDT information was NOT provided"
    }
    set xstruct [ XDumpDGTs D_First all 1] 
}

if { $mist != 1 } {  
  puts "" 
  set result ""
  append result [format $xst]
  append result [format "\n"]
  append result [format $xstruct]
}

set err_compare_ref ""

if { [catch { Close D_First } catch_result] } {
    set err_msg "Error : cannot close a document D_First - exception"  
    puts $err_msg
}


# Put reference data to the test script file if option "dump" is set
if { $dump_file == 1 } { 
    set fd_stream  [open $dirname/$groupname/$gridname/$casename w] 
    puts $fd_stream "# !!!! This file is generated automatically, do not edit manually! See end script"
    puts $fd_stream "set filename $filename"
    if { $mist != 1 } {
        puts $fd_stream "" 
        puts $fd_stream "set ref_data \{"
        puts $fd_stream $result
        puts $fd_stream "\}"
    }
    close $fd_stream 
} elseif { $mist != 1 } {
    puts "========================== Comparision with reference data ========"
    puts ""
    # Comparision of reference data with obtained result
    set ref_list [split $ref_data \n]
    set cur_list [split $result \n]
    set nb_ref [llength $ref_list]
    set nb_cur [llength $cur_list]
    for { set i 0 } { $i < $nb_cur } { incr i } {
        set j [expr $i +1]
	set refstr [lindex $ref_list $j]
	set curstr [lindex $cur_list $i]
        set isOK 1; 

        if {[string equal $refstr $curstr] == 0} {
            set isOK 0 
        }

	if { $isOK == 0}  {
	    incr ref_Compare
	    append err_compare_ref " Reference data - $refstr\n"
	    append err_compare_ref " Current data   - $curstr\n"
	    append err_compare_ref "--------------------------------------------------------------------\n"
	}
    }
}
 
if { $dump_file != 0 } {
    puts "Error : Running in regeneration mode, comparision was not performed!"
    if { $mist != 1 } {
      	 puts "Generation of test file $groupname/$gridname/$casename successful"
    } else {
      	 puts "Generation of reference data failed"
    }
} else {
    if { $ref_Compare > 0} {
        puts "Error : $ref_Compare differences with reference data found :\n$err_compare_ref"
    } else {
        puts "Comparision of current result with reference data - OK\n"
    }    
}

puts "--------------------------------------------------------------------"
puts ""

puts "TEST COMPLETED"