Mercurial > projects > dstress
changeset 141:80cc53b2b7d9
1) extended double case switch tests
2) added wchar[] / float switch tests
author | thomask |
---|---|
date | Wed, 17 Nov 2004 09:08:38 +0000 |
parents | a33ad7189d21 |
children | 25e3f5d59df4 |
files | nocompile/switch_09.d nocompile/switch_10.d nocompile/switch_11.d nocompile/switch_12.d nocompile/switch_13.d nocompile/switch_14.d nocompile/switch_15.d |
diffstat | 7 files changed, 155 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_09.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,25 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// duplicate case "123" in switch statement + +module dstress.nocompile.switch_09; + +const char[] c = "123"; + +int main(){ + char[] array = "123"; + switch(array){ + case "123":{ + assert(0); + break; + }case c:{ + assert(1); + break; + }default:{ + return -1; // dummy + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_10.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// duplicate case "123" in switch statement + +module dstress.nocompile.switch_10; + +int main(){ + char[] array = "123"; + switch(array){ + case "123":{ + assert(0); + break; + }case "123":{ + assert(1); + break; + }default:{ + return -1; // dummy + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_11.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,21 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// multiple equal keys in a switch-case + +module dstress.nocompile.switch_11; + +int main(){ + int i; + switch(i){ + case 0:{ + assert(0); + }case 0:{ + assert(1); + }default:{ + return -1; // dummy + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_12.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// duplicate case "123" in switch statement + +module dstress.nocompile.switch_12; + +int main(){ + wchar[] array = "123"; + switch(array){ + case "123":{ + assert(0); + break; + }case "123":{ + assert(1); + break; + }default:{ + return -1; // dummy + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_13.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// duplicate case "123" in switch statement + +module dstress.nocompile.switch_13; + +int main(){ + dchar[] array = "123"; + switch(array){ + case "123":{ + assert(0); + break; + }case "123":{ + assert(1); + break; + }default:{ + return -1; // dummy + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_14.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,20 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// according to dmd-0.106's statement.html#switch +// only integers, char[] and wchar[] are allowed + +module dstress.nocompile.switch_14; + +int main(){ + dchar[] array = "123"; + switch(array){ + case "123":{ + return 0; + }default:{ + assert(0); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/switch_15.d Wed Nov 17 09:08:38 2004 +0000 @@ -0,0 +1,20 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// according to dmd-0.106's statement.html#switch +// only integers, char[] and wchar[] are allowed + +module dstress.nocompile.switch_15; + +int main(){ + float f=0; + switch(f){ + case 0.0:{ + return 0; + }default:{ + assert(0); + } + } + +}