annotate run/typeid_79.d @ 1586:a74f0139fc3d

Fix tests using typeof on types.
author Christian Kamm <kamm incasoftware de>
date Thu, 21 Aug 2008 15:42:21 +0200
parents ecb96b2bf5cb
children 1f76d5b2f458
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
630
ecb96b2bf5cb fixed module declaration
thomask
parents: 535
diff changeset
1 // $HeadURL$
ecb96b2bf5cb fixed module declaration
thomask
parents: 535
diff changeset
2 // $Date$
ecb96b2bf5cb fixed module declaration
thomask
parents: 535
diff changeset
3 // $Author$
136
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
4
630
ecb96b2bf5cb fixed module declaration
thomask
parents: 535
diff changeset
5 module dstress.run.typeid_79;
136
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
6
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
7 union MyUnion{
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
8 int i;
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
9 byte b;
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
10 }
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
11
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
12 int main(){
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
13 TypeInfo ti = typeid(MyUnion[]);
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
14 assert(!(ti is null));
535
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
15 assert(ti);
342
111c6744074d typeid(type).tsize == type.sizeof
thomask
parents: 334
diff changeset
16 assert(ti.tsize==(MyUnion[]).sizeof);
467
5d6bb14f6415 fixed assertion typo
thomask
parents: 435
diff changeset
17 assert(ti.toString()=="dstress.run.typeid_78.MyUnion[]");
535
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
18
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
19 TypeInfo_Array ta = cast(TypeInfo_Array) ti;
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
20 assert(!(ta is null));
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
21 assert(ta);
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
22 assert(ta.tsize==(MyUnion[]).sizeof);
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
23 assert(ta.toString()=="dstress.run.typeid_78.MyUnion[]");
0db095345640 TypeInfo_Array
thomask
parents: 467
diff changeset
24
136
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
25 return 0;
98c7b15cc09e extended typeid test
thomask
parents:
diff changeset
26 }