digitalmars.D - DStress / regression tests
- Thomas Kuehne (5/5) Sep 23 2004 I've put my regression tests and the results online.
- Ben Hinkle (12/17) Sep 23 2004 That's a good idea to keep a testsuite so we can track issues (though Wa...
- Thomas Kuehne (6/11) Sep 23 2004 Thanks, I fixed in_03.
- Thomas Kuehne (5/8) Sep 25 2004 Well ... a bit later and a subversion server instead of a cvs server .. ...
- Ben Hinkle (7/12) Sep 23 2004 It would also be nice to say on the web page which platform the tests we...
- Thomas Kuehne (14/20) Sep 23 2004 I don't see any constant there.
- Russ Lewis (39/53) Sep 24 2004 You'll be really excited when you understand the difference :)
- Ben Hinkle (12/31) Sep 24 2004 were
- Thomas Kuehne (20/40) Sep 24 2004 I didn't use a pointer but an array:
- Ben Hinkle (9/55) Sep 24 2004 Apparently (and I think this is ok) the D code
- Ben Hinkle (6/11) Sep 23 2004 in bit_05.d the line
- Sjoerd van Leent (5/26) Sep 23 2004 Indeed, MyClass is not initialized, therefor it is correct behaviour to
- Thomas Kuehne (2/4) Sep 23 2004 Ops, fixed
- Helmut Leitner (5/12) Sep 24 2004 Thank you for creating that page.
I've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests. Thomas
Sep 23 2004
"Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message news:ciutra$1m5e$1 digitaldaemon.com...I've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests. ThomasThat's a good idea to keep a testsuite so we can track issues (though Walter is doing the same thing I'm sure...) How do we correct (or remove) tests? In particular I think test in_03.d should be removed. The "in" parameter is the object reference and doesn't apply to the member fields of the object. Either that or the test should be changed so that the final assert should make sure the field has the new value and not the old one. It would be nice to review any that are failing and see if they are in fact bugs. -Ben
Sep 23 2004
Ben Hinkle schrieb:In particular I think test in_03.d should be removed. The "in" parameter is the object reference and doesn't apply to the member fields of the object. Either that or the test should be changed so that the final assert should make sure the field has the new value and not the old one.Thanks, I fixed in_03. Concerning adding & fixing: Tomorrow I am going to bring the cvs server online. Anonymous read access for everyone and write access on request. Thomas
Sep 23 2004
Concerning adding & fixing: Tomorrow I am going to bring the cvs server online. Anonymous read access for everyone and write access on request.Well ... a bit later and a subversion server instead of a cvs server .. but yeah it's finally online ;) svn checkout svn://svn.kuehne.cn/dstress For those not knowing what subversion is: http://subversion.tigris.org/ Thomas
Sep 25 2004
"Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message news:ciutra$1m5e$1 digitaldaemon.com...I've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests. ThomasIt would also be nice to say on the web page which platform the tests were run on. When I run foreach_13.d on win32 it passes just fine. Plus I'm not sure one can change the values in string constants (ala C string constants). Try "dup"ing the string before changing it. -Ben
Sep 23 2004
Ben Hinkle schrieb:It would also be nice to say on the web page which platform the tests were run on.Yup, doneWhen I run foreach_13.d on win32 it passes just fine. Plus I'm not sure one can change the values in string constants (ala C string constants). Try "dup"ing the string before changing it.I don't see any constant there. I thought the following snipplets had the same effect ... --A-- char[2] array; array[0]='a'; array[1]='b'; --B-- char[] array="ab"; apparently they behave differently - at least on linux ;) Rewritten in plain c and compiled with gcc-3.4 those two snipplets behaved alike. Thomas
Sep 23 2004
Thomas Kuehne wrote:I thought the following snipplets had the same effect ... --A-- char[2] array; array[0]='a'; array[1]='b'; --B-- char[] array="ab"; apparently they behave differently - at least on linux ;) Rewritten in plain c and compiled with gcc-3.4 those two snipplets behaved alike.You'll be really excited when you understand the difference :) 'A' above declares a static array of length 2. Its length cannot ever be changed, and you can think of it more or less like the C array. Although the fact that you can't change the length (which means less flexibility), this means that the compiler can know the length of the array at all times, and that might mean it's more efficient. 'B' declares a dynamic array. A dynamic array can be thought of as a struct like this: struct Array { char *ptr; int length; } array; When you set a dynamic array, you are setting its pointer an length variables. Dynamic arrays are thus fundamentally different than C arrays. You can resize them, you can concatenate them together, etc. I would highly recommend that you use dynamic arrays at all times. Never use static arrays unless you really know that you need them. Get used to the flexibility and power of dynamic arrays, and you'll never want to go back! One more caveat to remember: since D arrays know their own length, D strings are typically NOT null terminated. Thus, the length of the array in 'B' above is 2. However, this means that you can't cut down the length of a static array by adding a null. For instance, see the code below: char[4] static_arr; static_arr[0] = 'a'; static_arr[1] = 'b'; static_arr[2] = '\0'; The length of static_arr is still 4! This can be a problem if you tried to concatenate strings. What happens if you do this? char[] concat_arr = static_arr ~ "cd"; I'm pretty sure (95%) that you end up with an array of length 6, with a null character (and an undefined character) in the middle. In the above example, what would have worked better would have been: char[] dyn_arr; dyn_arr = "ab"; char[] concat_arr2 = dyn_arr ~ "cd"; This code does what you want.
Sep 24 2004
"Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message news:civjub$27rp$2 digitaldaemon.com...Ben Hinkle schrieb:wereIt would also be nice to say on the web page which platform the testsWhat was your C code? When I write the C program: int main() { char*str = "ab"; str[1] = 't'; return 0; } I get a seg-v. The reason is that the constant string "ab" is read-only. See for example item 1.32 of http://www.faqs.org/faqs/C-faq/faq/ -Benrun on.Yup, doneWhen I run foreach_13.d on win32 it passes just fine. Plus I'm not sure one can change the values in string constants (ala C string constants). Try "dup"ing the string before changing it.I don't see any constant there. I thought the following snipplets had the same effect ... --A-- char[2] array; array[0]='a'; array[1]='b'; --B-- char[] array="ab"; apparently they behave differently - at least on linux ;) Rewritten in plain c and compiled with gcc-3.4 those two snipplets behaved alike.
Sep 24 2004
Ben Hinkle schrieb:behaved--A-- char[2] array; array[0]='a'; array[1]='b'; --B-- char[] array="ab"; apparently they behave differently - at least on linux ;) Rewritten in plain c and compiled with gcc-3.4 those two snippletsI didn't use a pointer but an array: --A.c-- #include <assert.h> int main(){ char str[1]; str[0]='C'; str[0]+=1; assert(str[0]=='D'); return 0; } --B.c-- #include <assert.h> int main(){ char str[]="C"; str[0]+=1; assert(str[0]=='D'); return 0; }alike.What was your C code? When I write the C program: int main() { char*str = "ab"; str[1] = 't'; return 0; } I get a seg-v. The reason is that the constant string "ab" is read-only. See for example item 1.32 of http://www.faqs.org/faqs/C-faq/faq/
Sep 24 2004
Thomas Kuehne wrote:Ben Hinkle schrieb:Apparently (and I think this is ok) the D code char[] str = "C"; isn't like the C code char str[] = "C"; It is more like char* str = "C"; int len = 1; The FAQ I referenced has more info about the difference.behaved--A-- char[2] array; array[0]='a'; array[1]='b'; --B-- char[] array="ab"; apparently they behave differently - at least on linux ;) Rewritten in plain c and compiled with gcc-3.4 those two snippletsI didn't use a pointer but an array: --A.c-- #include <assert.h> int main(){ char str[1]; str[0]='C'; str[0]+=1; assert(str[0]=='D'); return 0; } --B.c-- #include <assert.h> int main(){ char str[]="C"; str[0]+=1; assert(str[0]=='D'); return 0; }alike.What was your C code? When I write the C program: int main() { char*str = "ab"; str[1] = 't'; return 0; } I get a seg-v. The reason is that the constant string "ab" is read-only. See for example item 1.32 of http://www.faqs.org/faqs/C-faq/faq/
Sep 24 2004
in bit_05.d the line MyClass c; should be MyClass c = new MyClass; "Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message news:ciutra$1m5e$1 digitaldaemon.com...I've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests. Thomas
Sep 23 2004
Ben Hinkle wrote:in bit_05.d the line MyClass c; should be MyClass c = new MyClass; "Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message news:ciutra$1m5e$1 digitaldaemon.com...Indeed, MyClass is not initialized, therefor it is correct behaviour to fail. Regards, SjoerdI've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests. Thomas
Sep 23 2004
Indeed, MyClass is not initialized, therefor it is correct behaviour to fail.Ops, fixed Thomas
Sep 23 2004
Thomas Kuehne wrote:I've put my regression tests and the results online. These tests have been performed on a Linux box. http://dmd.kuehne.cn/dstress.html Everybody is invited to add or correct tests.Thank you for creating that page. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Sep 24 2004