Mercurial > projects > dstress
changeset 171:e2ba37f5b797
added .offset deprication tests
author | thomask |
---|---|
date | Wed, 01 Dec 2004 12:41:29 +0000 |
parents | 7f00d03c4016 |
children | e5bbb877feb9 |
files | nocompile/offset_01.d nocompile/offset_02.d nocompile/offset_03.d |
diffstat | 3 files changed, 64 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/offset_01.d Wed Dec 01 12:41:29 2004 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// Author$ + +// .offset is depricated, use .offsetof + +module dstress.nocompile.offset_01; + +struct MyStruct{ + int a; + int b; +} + +int main(){ + MyStruct s; + + assert(s.a.offset >= 0); + assert(s.b.offset >= 0); + assert(s.a.offset != s.b.offset); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/offset_02.d Wed Dec 01 12:41:29 2004 +0000 @@ -0,0 +1,20 @@ +// $HeadURL$ +// $Date$ +// Author$ + +module dstress.nocompile.offset_02; + +class MyClass{ + int a; + int b; +} + +int main(){ + MyClass c; + + assert(c.a.offset >= 0); + assert(c.b.offset >= 0); + assert(c.a.offset != c.b.offset); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/offset_03.d Wed Dec 01 12:41:29 2004 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// Author$ + +// .offset isn't supported for unions + +module dstress.nocompile.offset_03; + +union MyUnion{ + int a; + int b; +} + +int main(){ + MyUnion u; + + assert(u.a.offset >= 0); + assert(u.b.offset >= 0); + assert(u.a.offset != u.b.offset); + + return 0; +}