www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DStress / regression tests

reply "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
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
next sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"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
That'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
parent reply "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
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
parent "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
 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
prev sibling next sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"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
It 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
parent reply "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
Ben Hinkle schrieb:
 It would also be nice to say on the web page which platform the tests were
 run on.
Yup, done
 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.
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
next sibling parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
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
prev sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Thomas Kuehne" <eisvogel users.sourceforge.net> wrote in message
news:civjub$27rp$2 digitaldaemon.com...
 Ben Hinkle schrieb:
 It would also be nice to say on the web page which platform the tests
were
 run on.
Yup, done
 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.
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.
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/ -Ben
Sep 24 2004
parent reply "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
Ben Hinkle schrieb:
 --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.
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/
I 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; }
Sep 24 2004
parent Ben Hinkle <bhinkle4 juno.com> writes:
Thomas Kuehne wrote:

 Ben Hinkle schrieb:
 --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.
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/
I 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; }
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.
Sep 24 2004
prev sibling next sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
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
parent reply Sjoerd van Leent <svanleent wanadoo.nl> writes:
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...
 
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
Indeed, MyClass is not initialized, therefor it is correct behaviour to fail. Regards, Sjoerd
Sep 23 2004
parent "Thomas Kuehne" <eisvogel users.sourceforge.net> writes:
 Indeed, MyClass is not initialized, therefor it is correct behaviour to
 fail.
Ops, fixed Thomas
Sep 23 2004
prev sibling parent Helmut Leitner <leitner hls.via.at> writes:
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