Mercurial > projects > dstress
changeset 809:9e684d411b6c
Don Clugston <dac@nospam.com.au>
2006-01-25
news:dr7m29$1ehs$1@digitaldaemon.com
author | thomask |
---|---|
date | Sat, 04 Feb 2006 11:16:23 +0000 |
parents | 66e188c0c6c9 |
children | a14f009fc6bc |
files | run/c/cast_31_A.d run/c/cast_31_B.d |
diffstat | 2 files changed, 66 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/cast_31_A.d Sat Feb 04 11:16:23 2006 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <dac@nospam.com.au> +// @date@ 2006-01-25 +// @uri@ news:dr7m29$1ehs$1@digitaldaemon.com + +module dstress.run.c.cast_31_A; + +const char[] tapir = "sea"; + +const ubyte [] antelope = cast(ubyte []) tapir; + +int main() { + if(tapir.length != antelope.length){ + assert(0); + } + + if(tapir[0] != antelope[0]){ + assert(0); + } + + if(tapir[1] != antelope[1]){ + assert(0); + } + + if(tapir[2] != antelope[2]){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/cast_31_B.d Sat Feb 04 11:16:23 2006 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <dac@nospam.com.au> +// @date@ 2006-01-25 +// @uri@ news:dr7m29$1ehs$1@digitaldaemon.com + +module dstress.run.c.cast_31_B; + +const char[] tapir = "sea"; + +const byte [] antelope = cast(byte []) tapir; + +int main() { + if(tapir.length != antelope.length){ + assert(0); + } + + if(tapir[0] != antelope[0]){ + assert(0); + } + + if(tapir[1] != antelope[1]){ + assert(0); + } + + if(tapir[2] != antelope[2]){ + assert(0); + } + + return 0; +}