pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] time module unit test cases


From: gerel
Subject: Re: [pdf-devel] time module unit test cases
Date: Thu, 17 Apr 2008 23:04:49 -0300

 > Date: Thu, 17 Apr 2008 20:52:32 +0200
 > From: address@hidden
 > 
 > 
 >    I wanted to confirm one more thing, suppose i have created one object 
 > using
 >    *pdf_time_dup**.
 > 
 >    *So the contains of new object is similar to previous object. This test 
 > case
 >    is not unit test case right as this is functional test case.
 > 
 >    Say passing invalid object and see what is the behavior this can be unit
 >    test case right?*
 >    *
 > 
 > I dont fully understand you. In order to define unit test cases for
 > the `pdf_time_dup' function you should indeed use it. The fact that it
 > creates a new variable containing the same values as the parameters
 > do not invalidate it as a unit test case.

Anish I think we're not doing any specific type of tests, if that's your
doubt. BUT, you at least need to do "black-box" testing. If you want to do
"white-box" testing it's much better (I guess that's what you meant with
"functional test" since functional tests involves all the modules of
the library not only one).

 > 
 > Passing an invalid object to the function (an invalid pointer) will
 > surely cause the application to crash. It is generally not possible in
 > C to determine if a pointer is a "valid" one (if it points to
 > appropiately allocated _and_ appropriately initialized memory). Even
 > if you expect a crash (and test for the presence of a crash in the
 > process) you may be dissapointed: the application may survive if the
 > garbage contained in the pointer points to a valid memory
 > address. So it is not useful to define negative unit tests with
 > invalid pointers.
 > 
 > I hope that helps.
 > 

NULL pointers indeed are invalid and should always be checked on.  I don't know
if that's a "negative unit test" but they're useful if we want rock-solid
software.

Just my 2 cents.

-gerel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]