annotate tests/mini/s.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 tangotests/s.d@aeddd4d533b3
children d92acb81a583
rev   line source
lindquist@138 1 module s;
lindquist@138 2
lindquist@138 3 interface Inter
lindquist@138 4 {
lindquist@138 5 void inter();
lindquist@138 6 }
lindquist@138 7
lindquist@138 8 interface Inter2
lindquist@138 9 {
lindquist@138 10 void inter2();
lindquist@138 11 }
lindquist@138 12
lindquist@138 13 interface InterOne : Inter
lindquist@138 14 {
lindquist@138 15 void interOne();
lindquist@138 16 }
lindquist@138 17
lindquist@138 18 abstract class ClassAbstract : InterOne
lindquist@138 19 {
lindquist@138 20 abstract void inter();
lindquist@138 21 abstract void interOne();
lindquist@138 22 }
lindquist@138 23
lindquist@138 24 class TheClassOne : ClassAbstract
lindquist@138 25 {
lindquist@138 26 void inter()
lindquist@138 27 {
lindquist@138 28 }
lindquist@138 29 void interOne()
lindquist@138 30 {
lindquist@138 31 }
lindquist@138 32 }
lindquist@138 33
lindquist@138 34 class TheClassTwo : TheClassOne, Inter2
lindquist@138 35 {
lindquist@138 36 long l;
lindquist@138 37 double d;
lindquist@138 38
lindquist@138 39 void inter2()
lindquist@138 40 {
lindquist@138 41 }
lindquist@138 42 }
lindquist@138 43
lindquist@138 44 extern(C) int printf(char*, ...);
lindquist@138 45
lindquist@138 46 void main()
lindquist@138 47 {
lindquist@138 48 printf("classinfo test\n");
lindquist@138 49 {
lindquist@138 50 auto c = new TheClassOne;
lindquist@138 51 {
lindquist@138 52 auto ci = c.classinfo;
lindquist@138 53 printf("ci = %.*s\n", ci.name.length, ci.name.ptr);
lindquist@138 54 printf("ci.interfaces.length = %lu\n", ci.interfaces.length);
lindquist@138 55 printf("i[0] = %.*s\n", ci.interfaces[0].classinfo.name.length, ci.interfaces[0].classinfo.name.ptr);
lindquist@138 56 printf("i[1] = %.*s\n", ci.interfaces[1].classinfo.name.length, ci.interfaces[1].classinfo.name.ptr);
lindquist@138 57 }
lindquist@138 58 }
lindquist@138 59 {
lindquist@138 60 auto c = new TheClassTwo;
lindquist@138 61 {
lindquist@138 62 auto ci = c.classinfo;
lindquist@138 63 printf("ci = %.*s\n", ci.name.length, ci.name.ptr);
lindquist@138 64 printf("ci.interfaces.length = %lu\n", ci.interfaces.length);
lindquist@138 65 printf("i[0] = %.*s\n", ci.interfaces[0].classinfo.name.length, ci.interfaces[0].classinfo.name.ptr);
lindquist@138 66 printf("i[1] = %.*s\n", ci.interfaces[1].classinfo.name.length, ci.interfaces[1].classinfo.name.ptr);
lindquist@138 67 printf("i[2] = %.*s\n", ci.interfaces[2].classinfo.name.length, ci.interfaces[2].classinfo.name.ptr);
lindquist@138 68 }
lindquist@138 69 auto i = cast(InterOne)c;
lindquist@138 70 {
lindquist@138 71 auto ci = i.classinfo;
lindquist@138 72 printf("ci = %.*s\n", ci.name.length, ci.name.ptr);
lindquist@138 73 }
lindquist@138 74 auto i2 = cast(Inter2)i;
lindquist@138 75 {
lindquist@138 76 auto ci = i2.classinfo;
lindquist@138 77 printf("ci = %.*s\n", ci.name.length, ci.name.ptr);
lindquist@138 78 }
lindquist@138 79 auto o = cast(Object)i2;
lindquist@138 80 {
lindquist@138 81 auto ci = o.classinfo;
lindquist@138 82 printf("ci = %.*s\n", ci.name.length, ci.name.ptr);
lindquist@138 83 }
lindquist@138 84 }
lindquist@138 85 }