1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-10 11:34:06 +03:00
abv e8862cf41a 0024870: Provide OCCT RTTI test cases
Test commands for checking performance and functionality of OCCT handles and RTTI added.
New test case added for that: test perf fclasses handle.

Implementation of opencascade::handle improved to enable compile-time error if two handles of incompatible types are compared.
Comparison of handle to NULL is not possible any more; method IsNull() should be used instead.

Method LDOM_MemManager::Doc() is removed to avoid cyclic dependency of headers; constructor of LDOM_Document(LDOM_MemManager&) is used directly instead.

Inclusion of headers corrected for compilation after previous patch.
2015-07-12 12:30:27 +03:00

53 lines
1.7 KiB
Plaintext

puts "========"
puts "CR24023, check operability and performance of OCCT RTTI and handles"
puts "========"
puts ""
pload QAcommands
# check RTTI
QAHandleBool
QAHandleKind
QAHandleOps
# check performance of creation and destruction handles, vs. C++ shared_ptr
set res [QAHandleInc]
set res_lines [split $res \n]
set time_occt [lindex [split [lindex $res_lines 1] :] end]
set time_std [lindex [split [lindex $res_lines 2] :] end]
set ratio [expr $time_occt / $time_std]
# allow 5% deviation
if { $ratio > 1.05 } {
puts "Error: OCCT handle is too slow: $time_occt vs. $time_std of shared_ptr"
}
# Check performance of down casting at different nesting depths.
# OCCT is expected to be at least twice faster on deep nesting on x64,
# however can be slower on 32-bit
set depths {3 5 10 50}
if { [regexp x86 [dversion]] } {
set thresholds {2. 1.5 1. 1.2}
} else {
set thresholds {1.6 1.1 0.7 0.5}
}
for {set i 0} {$i < [llength $depths]} {incr i} {
set depth [lindex $depths $i]
set threshold [lindex $thresholds $i]
puts "\nTesting DownCast at nesting depth $depth"
set res [QAHandleCast $depth 0 100000]
set res_lines [split $res \n]
set time_occt [lindex [lindex [split [lindex $res_lines end-2] :] end] $depth]
set time_std [lindex [lindex [split [lindex $res_lines end-1] :] end] $depth]
set time_ptr [lindex [lindex [split [lindex $res_lines end ] :] end] $depth]
set ratio_std [expr $time_occt / $time_std]
set ratio_ptr [expr $time_occt / $time_ptr]
puts "Ratio of time of OCCT DownCast() to dynamic_cast<>: $ratio_std"
puts "Ratio of time of OCCT DownCast() to dynamic_pointer_cast<>: $ratio_ptr"
if { $ratio_std > $threshold || $ratio_ptr > $threshold } {
puts "Error: OCCT DownCast() is expected to be faster!"
}
}