Mercurial > projects > dstress
changeset 9:4d64fb56f885
added struct_initialization tests
author | thomask |
---|---|
date | Wed, 06 Oct 2004 09:37:33 +0000 |
parents | 9eec35fef572 |
children | 0c82f6ca8335 |
files | run/struct_initialization_01.d run/struct_initialization_02.d run/struct_initialization_03.d run/struct_initialization_04.d run/struct_initialization_05.d |
diffstat | 5 files changed, 63 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/struct_initialization_01.d Wed Oct 06 09:37:33 2004 +0000 @@ -0,0 +1,11 @@ +struct MyStruct{ + int a; + int b = 7; +} + +int main(){ + MyStruct s; + assert(s.a==int.init); + assert(s.b==7); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/struct_initialization_02.d Wed Oct 06 09:37:33 2004 +0000 @@ -0,0 +1,13 @@ +struct MyStruct{ + int a; + int b; + int c = 7; +} + +int main(){ + static MyStruct s={a:2}; + assert(s.a==2); + assert(s.b==int.init); + assert(s.c==7); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/struct_initialization_03.d Wed Oct 06 09:37:33 2004 +0000 @@ -0,0 +1,13 @@ +struct MyStruct{ + int a; + int b; + int c = 7; +} + +int main(){ + static MyStruct s={c:2}; + assert(s.a==int.init); + assert(s.b==int.init); + assert(s.c==2); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/struct_initialization_04.d Wed Oct 06 09:37:33 2004 +0000 @@ -0,0 +1,13 @@ +struct MyStruct{ + int a; + int b; + int c = 7; +} + +int main(){ + static MyStruct s={2,c:3}; + assert(s.a==2); + assert(s.b==int.init); + assert(s.c==3); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/struct_initialization_05.d Wed Oct 06 09:37:33 2004 +0000 @@ -0,0 +1,13 @@ +struct MyStruct{ + int a; + int b; + int c = 7; +} + +int main(){ + static MyStruct s={b:2,3}; + assert(s.a==int.init); + assert(s.b==2); + assert(s.c==3); + return 0; +}