www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - unit testing

reply Ishan Thilina <ishanthilina gmail.com> writes:
I see that almost all of the phobos library files have "unittests". Were these
unit tests were created using some framework? If so, then what is it?

Thank you...!
Mar 28 2011
parent reply David Nadlinger <see klickverbot.at> writes:
On 3/28/11 4:23 PM, Ishan Thilina wrote:
 I see that almost all of the phobos library files have "unittests". Were these
 unit tests were created using some framework? If so, then what is it?

 Thank you...!
No, these unit test were just written by hand while writing the corresponding pieces of code, and extended after a bug was fixed which they previously missed. Or was your question related to actually running them? David
Mar 28 2011
parent reply Caligo <iteronvexor gmail.com> writes:
On Mon, Mar 28, 2011 at 9:34 AM, David Nadlinger <see klickverbot.at> wrote:
 On 3/28/11 4:23 PM, Ishan Thilina wrote:
 I see that almost all of the phobos library files have "unittests". Were
 these
 unit tests were created using some framework? If so, then what is it?

 Thank you...!
No, these unit test were just written by hand while writing the corresponding pieces of code, and extended after a bug was fixed which they previously missed. Or was your question related to actually running them? David
and how does one do unit testing with GDC? It works fine with DMD, but GDC doesn't do unit testing when -unittest is supplied.
Mar 28 2011
parent reply David Nadlinger <see klickverbot.at> writes:
On 3/28/11 5:55 PM, Caligo wrote:
 and how does one do unit testing with GDC?  It works fine with DMD,
 but GDC doesn't do unit testing when -unittest is supplied.
-funittest, IIRC. David
Mar 28 2011
parent reply Ishan Thilina <ishanthilina gmail.com> writes:
 David:

No, my question was not about running them,but on how that code was generated. I
thought they were auto generated using a unitest framework :). Your answer
clarifies everything. Thank you..! :-)
Mar 28 2011
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On 2011-03-28 11:29, Ishan Thilina wrote:
  David:
 
 No, my question was not about running them,but on how that code was
 generated. I thought they were auto generated using a unitest framework
 :). Your answer clarifies everything. Thank you..! :-)
LOL. Goodness no. They're done by hand. I'm currently reworking std.datetime's unit tests, and it's very time consuming (since it's a large module with lots of tests). I don't know how you'd get a framework to generate what I want anyway. The fact that D has unit testing built in like it does is fantastic, but it is fairly simplistic. - Jonathan M Davis
Mar 28 2011
parent Ishan Thilina <ishanthilina gmail.com> writes:
- Jonathan M Davis wrote:

LOL. Goodness no. They're done by hand. I'm currently reworking std.datetime's
unit tests, and it's very time consuming (since it's a large module with lots
of tests). I don't know how you'd get a framework to generate what I want
anyway. The fact that D has unit testing built in like it does is fantastic,
but it is fairly simplistic.
I'm new to this concept of uni testing. Thanks for the help :)
Mar 28 2011