comparison run/mini/structs3.d @ 1628:c6ef09dfba4d

add mini test set from ldc project
author Moritz Warning <moritzwarning@web.de>
date Mon, 10 Jan 2011 19:47:18 +0100
parents
children
comparison
equal deleted inserted replaced
1627:e1b954780837 1628:c6ef09dfba4d
1 module structs3;
2
3 struct S
4 {
5 char c;
6 float f;
7 }
8
9 struct T
10 {
11 S s;
12 long l;
13 }
14
15 void main()
16 {
17 T t;
18 float f = void;
19 float* fp = void;
20 {f = t.s.f;}
21 {t.s.f = 0.0;}
22 {fp = &t.s.f;}
23 {*fp = 1.0;}
24 {assert(t.s.f == 1.0);}
25 {assert(*(&t.s.f) == 1.0);}
26 {t.s.c = 'a';}
27 {assert(t.s.c == 'a');}
28 {t.l = 64;}
29 {assert(t.l == 64);}
30 }