1 /* Test assignment of one struct/union to another, including transitivity.
8 /* declare some structs and unions */
9 struct t
{ {type
} a
; };
10 struct s
{ {type
} a
; {type
} b
; };
15 struct s s1
= { 1, 2 };
16 struct s s2
= { 3, 4 };
17 #ifndef __SDCC_pdk14 // Lack of memory
18 struct s s3
= { 5, 6 };
20 union u
{ {type
} a
; float b
; char c
; };
25 /* struct: simple assignment */
27 testSimpleStructAssignment(void)
37 /* struct: transitive assignment */
39 testTransitiveStructAssignment(void)
41 #ifndef __SDCC_pdk14 // Lack of memory
50 /* union: simple assignment */
52 testSimpleUnionAssignment(void)
54 #ifndef __SDCC_pdk14 // Lack of memory
58 ASSERT(u1
.b
== -1.5f
);
62 /* union: transitive assignment */
64 testTransitiveUnionAssignment(void)
66 #ifndef __SDCC_pdk14 // Lack of memory
71 ASSERT(u1
.b
== -1.5f
);
72 ASSERT(u2
.b
== -1.5f
);
76 /* test for unintended double evaluation */
78 testUnintendedDoubleEval(void)
80 #ifndef __SDCC_pdk14 // Lack of memory
83 ss
[2] = ss
[--n
] = ss
[0];