1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00
ichesnok 1cb57cafb4 0033530: Data Exchange, Step Import - Implement GENERAL_PROPERTY support
The necessary classes for GeneralProperty support were added.
The ReadMetadata method was created for reading and saving attributes.
2025-03-03 12:11:30 +00:00

99 lines
2.8 KiB
Plaintext

# Set flag dump_file to 1 in order to regenerate script files with actual data
# used as reference. In this mode all tests intentionally report failure.
set dump_file 0
########################################################################
set mist 0;
set todo_msg ""
set todo_mask "puts \"TODO CR00000 ALL: "
set end_line "\" \n"
##################################################################
# Read original file
if { [string length $filename] > 1} {
set path_file [locate_data_file $filename]
if { [catch { ReadFile D $path_file -conf $conf} catch_result] } {
set err_msg "Error: 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 prop [ XGetProperties D ]
if { [llength $prop] < 0 } {
puts " Metadata was NOT provided"
}
}
if { $mist < 1} {
# Close the document
if { [catch { Close D } catch_result] } {
set err_msg "Error : cannot close a document D - exception"
puts $err_msg
append todo_msg $todo_mask $err_msg $end_line
}
}
if { $mist != 1 } {
puts ""
set result ""
append result [format $prop]
}
set ref_Compare 0
# 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]
fconfigure $fd_stream -encoding utf-8
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 "========================== Comparison with reference data ========"
# Comparison 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]
for { set i 0 } { $i < $nb_ref } { 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} {
incr ref_Compare
puts "Reference data - $refstr\n"
puts "Current data - $curstr\n"
puts "----------------------------------------------\n"
}
}
}
if { $dump_file != 0 } {
puts "Error : Running in regeneration mode, comparison 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 >= 1} {
puts "Error : differences with reference data found : $ref_Compare"
} else {
puts "Comparison of current result with reference data - OK\n"
}
}
puts "TEST COMPLETED"