mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-12 11:06:26 +08:00
Method XmlObjMgt::GetReal() is improved to (a) recognize NAN and infinity written by old MSVC runtime (like 1.#QNAN and 1.#INF) and (b) detect situation when there are some trailing non-space symbols after the real value, returning False in such case. Reading of real-valued attributes (single real, array, list) from OCAF XML format is improved to create valid attribute even if parsing of (some) members fails; warning is generated instead of error in such case. Added test bugs caf bug29452
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
puts "=========="
|
|
puts "OCC29452"
|
|
puts "=========="
|
|
puts ""
|
|
###################################################
|
|
# XmlMDataStd_RealDriver: Failed to read an Ocaf XML document with 1.#QNAN value
|
|
###################################################
|
|
|
|
# Check for presence of warning message
|
|
puts "REQUIRED ALL: Cannot retrieve real member for RealArray attribute"
|
|
|
|
set BugNumber OCC29452
|
|
set file [locate_data_file bug29452.xml]
|
|
|
|
catch {Close D}
|
|
set res [Open $file D]
|
|
|
|
set real [GetReal D 0:1]
|
|
set rlst [GetRealList D 0:1]
|
|
set rarr [GetRealArray D 0:1]
|
|
|
|
# Check for read values
|
|
checkreal "Real value" [lindex $rlst 0] 1.1 0 1e-15
|
|
checkreal "Real value" [lindex $rlst 2] 3.3 0 1e-15
|
|
checkreal "Real value" [lindex $rarr 0] 0.111 0 1e-15
|
|
checkreal "Real value" [lindex $rarr 3] 123. 0 1e-15
|
|
checkreal "Real value" [lindex $rarr 4] 3.14e12 0 1e-15
|
|
foreach inf [list $real [lindex $rlst 3]] {
|
|
if { [string compare "$inf" "inf"] &&
|
|
[string compare "$inf" "infinity"] &&
|
|
[string compare "$inf" "1.#INF"] } {
|
|
puts "Error: Real value is read as \"$inf\", expected infinity"
|
|
}
|
|
}
|
|
foreach nan [list [lindex $rlst 1] [lindex $rarr 1] [lindex $rarr 2]] {
|
|
if { [string compare "$nan" "nan"] &&
|
|
[string compare "$nan" "1.#QNAN"] } {
|
|
puts "Error: Real value is read as \"$nan\", expected NAN"
|
|
}
|
|
}
|