FLtest                package:FLCore                R Documentation

_F_L_t_e_s_t _f_u_n_c_t_i_o_n_s _f_o_r _r_u_n_n_i_n_g _s_i_m_p_l_e _u_n_i_t_s _t_e_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     A set of functions is provided to create and run simple unit
     tests. The basic functions provided allow checking whether two
     objects are identical ('checkIdentical'), equal ('checkEqual'), if
     a expression is 'TRUE' ('checkTrue')  or 'FALSE' ('checkFalse'),
     and if a piece of code fails ('checkFail') or runs ('checkRun').

     Output of all tests is directed to a file or connection, specified
     by a call to  'setCon()' to set the connection, and then to
     'startTest' to specify the file to output to. At the end of the
     test the connection needs to be closed by using 'finishTest'.

     Tests can be labelled with a text message for easier reading by
     using 'tagTest'.

     Be warned that when any of these checks fails, failure is reported
     accordingly, but the test run will not be stopped. i.e. 'R CMD
     check' will successfully finish. Test reports should be inspected
     after running them to ensure problems are detected and corrected.

_U_s_a_g_e:

     setCon(con='zz')
     startTest(file="testReport.txt")
     finishTest(con=getOption("con"))
     tagTest(tag="My tag is better than yours !", con=getOption("con"))
     checkIdentical(x, y, con=getOption("con"))
     checkEqual(x, y, con=getOption("con"), tolerance =.Machine$double.eps^0.5, ...)
     checkTrue(x, con=getOption("con"))
     checkFalse(x, con=getOption("con"))
     checkFail(x, con=getOption("con"))
     checkRun(x, con=getOption("con"))

_A_r_g_u_m_e_n_t_s:

    x, y: Objects to compare or expression to run

    file: File to direct output report to

     con: Option for connection

     tag: Text to label the test output file

tolerance: Allowed difference between two values in a comparison

     ...: Extra arguments to be passed on to all.equal

_V_a_l_u_e:

     Output is directed to the file specified, so no objects are
     created in the workspace by the check functions. A 'connection' is
     created by 'startTest' but is subsequently closed by 'finishTest'.

_A_u_t_h_o_r(_s):

     Ernesto Jardim, IPIMAR. FLR Team

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://en.wikipedia.org/wiki/Unit_testing>

_S_e_e _A_l_s_o:

     'all.equal', 'identical', 'connection'

_E_x_a_m_p_l_e_s:

             setCon()
             tmpfile <- tempfile()
             zz <- startTest(file=tmpfile)
             tagTest("Testing FLlst testing ...")

             checkTrue(is(FLQuant(), 'FLQuant'))

             finishTest()

             ## Not run: 
             # You can now inspect the output by opening tmpfile in your editor
             edit(file=tmpfile)
             
     ## End(Not run)

