annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
1 module arrays7;
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
2
175
c44e6a711885 [svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents: 86
diff changeset
3 extern(C) int printf(char*, ...);
c44e6a711885 [svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents: 86
diff changeset
4
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
5 pragma(LLVM_internal, "notypeinfo")
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
6 struct S
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
7 {
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
8 int i;
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
9 float f;
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
10 long l;
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
11
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
12 void print()
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
13 {
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
14 printf("%d %f %lx\n", i, f, l);
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
15 }
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
16 }
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
17
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
18 void main()
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
19 {
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
20 S[] arr;
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
21 S s;
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
22 assert(arr.length == 0);
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
23 arr ~= s;
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
24 assert(arr.length == 1);
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
25 arr ~= S(1,2.64,0xFFFF_FFFF_FFFF);
86
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
26 assert(arr.length == 2);
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
27 arr[0].print();
fd32135dca3e [svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents: 40
diff changeset
28 arr[1].print();
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
29 assert(arr[1].i == 1);
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
30 assert(arr[1].f > 2.63 && arr[1].f < 2.65);
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
31 assert(arr[1].l == 0xFFFF_FFFF_FFFF);
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents:
diff changeset
32 }