0027970: Improvement of standard attributes usability - containers.
[occt.git] / tests / caf / basic / W4
1 #INTERFACE CAF
2 # Basic attributes
3 # Std documents
4 #
5 # Testing support of std format: reading standard attribute IntegerArray
6 #
7 # Testing command:   Open, GetIntArray
8 #
9
10 puts "caf001-W4"
11 set QA_DUP 0
12
13 # Add an attribute to a data framework
14 set aSetAttr1 {11 12 13 14 155}
15 set aLabel 0:1
16 set aFile [locate_data_file caf001_intAr.std]
17 #Open a document
18 Open ${aFile} D
19
20 # Get a value of the attribute
21 set IsGood 1
22 set aMessage1 "Add TDataStd_IntegerArray attribute: Error"
23 set aGetAttr1 [GetIntArray D ${aLabel}]
24 set aLenRead [llength ${aGetAttr1}]
25 set aLenSet [llength ${aSetAttr1}]
26
27 if { ${aLenRead} != ${aLenSet} } {
28    set IsGood 0
29    puts "aLenRead=${aLenRead}"
30    puts ${aMessage1}
31 }
32
33 if { ${IsGood} == 0}  return
34
35 for {set i 0} {$i < $aLenRead} {incr i} {
36   set aGetAttr11 [lindex ${aGetAttr1} $i]
37   set aGetAttr21 [lindex ${aSetAttr1} $i]
38   if { ${aGetAttr11} != ${aGetAttr21} } {
39      set IsGood 0;puts "i=${i}"
40      puts "aGetAttr11=${aGetAttr11}"
41      puts "aGetAttr21=${aGetAttr21}"
42      break
43      }
44 }
45
46 if { ${IsGood} == 0} {
47   puts ${aMessage1}
48 } else {
49   puts "Add TDataStd_IntegerArray attribute: OK"
50 }