Mercurial > projects > dstress
changeset 836:be9add84456d
multiple inheritance of functions
author | thomask |
---|---|
date | Thu, 16 Feb 2006 11:46:13 +0000 |
parents | 45d6f72f4d18 |
children | ee2cab7be595 |
files | run/c/class_20_A.d run/c/class_20_B.d run/c/class_20_C.d run/c/class_20_D.d run/c/class_20_E.d run/c/class_20_F.d run/c/class_20_G.d run/c/class_20_H.d run/c/class_20_I.d run/c/class_20_J.d |
diffstat | 10 files changed, 700 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_A.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,67 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_A; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int bar(); + int dummy(); +} + +class C : A, B{ + int foo(){ + return 0; + } + + int bar(){ + return 1; + } + + int dummy(){ + return 2; + } +} + +int main(){ + C c = new C(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_B.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,67 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_B; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int dummy(); + int bar(); +} + +class C : A, B{ + int foo(){ + return 0; + } + + int bar(){ + return 1; + } + + int dummy(){ + return 2; + } +} + +int main(){ + C c = new C(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_C.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,67 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_C; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int dummy(); + int bar(); +} + +class C : A, B{ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + C c = new C(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_D.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,73 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_D; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int dummy(); + int bar(); +} + +class Parent{ + int bar(){ + return 4; + } +} + +class C : Parent, A, B{ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + C c = new C(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_E.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,71 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_E; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int dummy(); + int bar(); +} + + +class Parent : A, B{ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +class C(T) : T{ +} + +int main(){ + auto c = new C!(Parent)(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_F.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,68 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_F; + +interface A{ + int foo(); + int bar(); +} + +interface B(T) : T{ + int dummy(); + int bar(); +} + + +class C : B!(A){ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + auto c = new C(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B!(A) b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_G.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,68 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_G; + +interface A{ + int foo(); + int bar(); +} + +interface B(T) : T{ + int dummy(); + int bar(); +} + + +class C(T) : B!(T){ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + auto c = new C!(A)(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B!(A) b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_H.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,68 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_H; + +interface A{ + int foo(); + int bar(); +} + +interface B{ + int dummy(); + int bar(); +} + + +class C(T) : T, B{ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + auto c = new C!(A)(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_I.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,68 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_I; + +interface A{ + int foo(); + int bar(); +} + +interface B(T) : T{ + int dummy(); + int bar(); +} + + +class C(T) : T, B!(A){ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + auto c = new C!(A)(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A a = c; + + if(a.foo() != 0){ + assert(0); + } + + if(a.bar() != 1){ + assert(0); + } + + B!(A) b = c; + + if(b.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/class_20_J.d Thu Feb 16 11:46:13 2006 +0000 @@ -0,0 +1,83 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.c.class_20_J; + +interface A1{ + int foo(); +} + +interface A2{ + int bar(); +} + +interface B(T) : T{ + int dummy(); + int bar(); +} + + +class C(T1, T2) : B!(T1), B!(T2){ + int foo(){ + return 0; + } + + int dummy(){ + return 2; + } + + int bar(){ + return 1; + } +} + +int main(){ + auto c = new C!(A1, A2)(); + + if(c.foo() != 0){ + assert(0); + } + + if(c.bar() != 1){ + assert(0); + } + + if(c.dummy() != 2){ + assert(0); + } + + A1 a1 = c; + + if(a1.foo() != 0){ + assert(0); + } + + A2 a2 = c; + + if(a2.bar() != 1){ + assert(0); + } + + B!(A1) b1 = c; + + if(b1.bar() != 1){ + assert(0); + } + + if(b1.dummy() != 2){ + assert(0); + } + + B!(A2) b2 = c; + + if(b2.bar() != 1){ + assert(0); + } + + if(b2.dummy() != 2){ + assert(0); + } + + return 0; +}