2 # This is the union runtime testcase. It ensures that values within a
3 # union embedded within a struct can be set and read correctly.
5 if [ catch { load ./unions[info sharedlibextension] unions} err_msg ] {
6 puts stderr "Could not load shared object:\n$err_msg"
9 # Create new instances of SmallStruct and BigStruct for later use
11 small configure -jill 200
14 big configure -smallstruct [small cget -this]
15 big configure -jack 300
17 # Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
18 # Ensure values in EmbeddedUnionTest are set correctly for each.
21 # First check the SmallStruct in EmbeddedUnionTest
22 eut configure -number 1
24 #eut.uni.small = small
25 EmbeddedUnionTest_uni_small_set [EmbeddedUnionTest_uni_get [eut cget -this] ] [small cget -this]
27 #Jill1 = eut.uni.small.jill
28 set Jill1 [SmallStruct_jill_get [EmbeddedUnionTest_uni_small_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ]
30 puts stderr "Runtime test1 failed. eut.uni.small.jill=$Jill1"
34 set Num1 [eut cget -number]
36 puts stderr "Runtime test2 failed. eut.number=$Num1"
40 # Secondly check the BigStruct in EmbeddedUnionTest
41 eut configure -number 2
43 EmbeddedUnionTest_uni_big_set [EmbeddedUnionTest_uni_get [eut cget -this] ] [big cget -this]
44 #Jack1 = eut.uni.big.jack
45 set Jack1 [BigStruct_jack_get [EmbeddedUnionTest_uni_big_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ]
47 puts stderr "Runtime test3 failed. eut.uni.big.jack=$Jack1"
51 #Jill2 = eut.uni.big.smallstruct.jill
52 set Jill2 [SmallStruct_jill_get [BigStruct_smallstruct_get [EmbeddedUnionTest_uni_big_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ] ]
54 puts stderr "Runtime test4 failed. eut.uni.big.smallstruct.jill=$Jill2"
58 set Num2 [eut cget -number]
60 puts stderr "Runtime test5 failed. eut.number=$Num2"