Mercurial > projects > ldc
comparison tests/mini/arrays7.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/arrays7.d@c44e6a711885 |
children | 44f08170f4ef |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module arrays7; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 pragma(LLVM_internal, "notypeinfo") | |
6 struct S | |
7 { | |
8 int i; | |
9 float f; | |
10 long l; | |
11 | |
12 void print() | |
13 { | |
14 printf("%d %f %lx\n", i, f, l); | |
15 } | |
16 } | |
17 | |
18 void main() | |
19 { | |
20 S[] arr; | |
21 S s; | |
22 assert(arr.length == 0); | |
23 arr ~= s; | |
24 assert(arr.length == 1); | |
25 arr ~= S(1,2.64,0xFFFF_FFFF_FFFF); | |
26 assert(arr.length == 2); | |
27 arr[0].print(); | |
28 arr[1].print(); | |
29 assert(arr[1].i == 1); | |
30 assert(arr[1].f > 2.63 && arr[1].f < 2.65); | |
31 assert(arr[1].l == 0xFFFF_FFFF_FFFF); | |
32 } |