File: bug22809_2

package info (click to toggle)
oce 0.17.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 297,992 kB
  • ctags: 203,291
  • sloc: cpp: 1,176,369; ansic: 67,206; sh: 11,647; tcl: 6,890; cs: 5,221; python: 2,867; java: 1,522; makefile: 338; xml: 292; perl: 37
file content (164 lines) | stat: -rw-r--r-- 4,569 bytes parent folder | download | duplicates (6)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
puts "============"
puts "OCC22809"
puts "============"
puts ""
############################################################################################################
# BRepIntCS does not find intersections of an ellipsoid and a line passing through it's apex
###########################################################################################################
# 
# Test was corrected. See:
# 
# http://tracker.dev.opencascade.org/view.php?id=23248
# pkv (developer)
# 2012-07-12 09:33
# The checking can not provide stable result because there is no guarantee that coordinates
# for brics_1 will always be {x1, y1, z1} but not {x2, y2, z2} and
# for brics_42 will always be {x2, y2, z2} but not {x1, y1, z1}.
# The coordinates of brics_1 can be both {x1, y1, z1} and {x2, y2, z2}
# The coordinates of brics_42 can be both {x1, y1, z1} and {x2, y2, z2} 
# 
###########################################################################################################

set BugNumber OCC22809

#
proc GetPercent {Value GoodValue} {
    set Percent 0.
    if {${GoodValue} != 0.} {
	set Percent [expr abs(${Value} - ${GoodValue}) / abs(double(${GoodValue})) * 100.]
    } elseif {${Value} != 0.} {
	set Percent [expr abs(${GoodValue} - ${Value}) / abs(double(${Value})) * 100.]
    } else {
	set Percent 0.
    }
    return ${Percent}
}
set percent_max 0.1
#

psphere a 100
scalexyz r2 a 2 1 1
line l 0 0 -100 0 0 1
BRepIntCS l r2

regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_1 ] full info1

# N.B. multiple result points are to be processed by other algorithms
# Now there are 130 result points
regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_23 ] full info2

set word1 [string compare $info1 "point"]
set word2 [string compare $info2 "point"]

set status_point 0
if { ${word1} == 0 && ${word2} == 0 } {
    set status_point 0
} else {
    set status_point 1
}

regexp {.* is a ([A-Za-z0-9]*)} [ whatis brics_3 ] full info3
set word3 [string compare $info3 "a"]

set status_nb 0
if { ${word3} == 0 } {
    set status_nb 0
} else {
    set status_nb 1
    # N.B. multiple result points are to be processed by other algorithms
    set status_nb 0
}

set good_x1 0.000000000000000e+00
set good_y1 0.000000000000000e+00
set good_z1 -1.000000000000000e+02

set good_x2 0.000000000000000e+00
set good_y2 0.000000000000000e+00
set good_z2 1.000000000000000e+02

set dump1 [ dump brics_1 ]

regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump1 full x1 y1 z1

set status_xyz1 0
set x1_percent [GetPercent ${x1} ${good_x1}]
puts "x1_percent = ${x1_percent}"
if { ${x1_percent} > ${percent_max} } {
   puts "x1: Faulty ${BugNumber}"
   set status_xyz1 1
} else {
   puts "x1: OK ${BugNumber}"
}

set y1_percent [GetPercent ${y1} ${good_y1}]
puts "y1_percent = ${y1_percent}"
if { ${y1_percent} > ${percent_max} } {
   puts "y1: Faulty ${BugNumber}"
   set status_xyz1 1
} else {
   puts "y1: OK ${BugNumber}"
}

set z1_percent [GetPercent ${z1} ${good_z1}]
puts "z1_percent = ${z1_percent}"
if { ${z1_percent} > ${percent_max} } {
   set z1_percent [GetPercent ${z1} ${good_z2}]
   puts "z1_percent = ${z1_percent}"
   if { ${z1_percent} > ${percent_max} } {
      puts "z1: Faulty ${BugNumber}"
      set status_xyz1 1
   } else {
      puts "z1: OK ${BugNumber}"
   }
} else {
   puts "z1: OK ${BugNumber}"
}

set dump2 [ dump brics_2 ]
# N.B. multiple result points are to be processed by other algorithms
set dump2 [ dump brics_23 ]
regexp {Point : ([-0-9.+eE]+), ([-0-9.+eE]+), ([-0-9.+eE]+)} $dump2 full x2 y2 z2

set status_xyz2 0
set x2_percent [GetPercent ${x2} ${good_x2}]
puts "x2_percent = ${x2_percent}"
if { ${x2_percent} > ${percent_max} } {
   puts "x2: Faulty ${BugNumber}"
   set status_xyz2 1
} else {
   puts "x2: OK ${BugNumber}"
}

set y2_percent [GetPercent ${y2} ${good_y2}]
puts "y2_percent = ${y2_percent}"
if { ${y2_percent} > ${percent_max} } {
   puts "y2: Faulty ${BugNumber}"
   set status_xyz2 1
} else {
   puts "y2: OK ${BugNumber}"
}

set z2_percent [GetPercent ${z2} ${good_z2}]
puts "z2_percent = ${z2_percent}"
if { ${z2_percent} > ${percent_max} } {
   set z2_percent [GetPercent ${z2} ${good_z1}]
   puts "z2_percent = ${z2_percent}"
   if { ${z2_percent} > ${percent_max} } {
      puts "z2: Faulty ${BugNumber}"
      set status_xyz2 1
   } else {
      puts "z2: OK ${BugNumber}"
   }
} else {
   puts "z2: OK ${BugNumber}"
}

# Resume
puts ""
if { ${status_point} == 0 && ${status_nb} == 0 && ${status_xyz1} == 0 && ${status_xyz2} == 0 } {
    puts "OK ${BugNumber}"
} else {
    puts "Faulty ${BugNumber}"
}