aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/unions.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unions.c')
-rw-r--r--tests/unions.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unions.c b/tests/unions.c
new file mode 100644
index 0000000..923a5b6
--- /dev/null
+++ b/tests/unions.c
@@ -0,0 +1,14 @@
+#include <helpers.h>
+
+union U {
+ int i;
+ long l;
+};
+
+int main() {
+ union U u;
+ ASSERT_EQ(8, sizeof(u));
+ u.l = 42;
+ ASSERT_EQ(42, u.i);
+ ASSERT_EQ(42, u.l);
+}