testFunCall | R Documentation |
This function and its methods uses the inputs from an observed call to a function to compare the behaviour of a new version of that function to determine if it produces the same result. This uses the arguments and any global variables to recreate the call and compares the new result to the one obtained in the original call.
testFunCall(x, fun, compare = identical, ...)
x |
the |
fun |
the definition of the function with which to compare the
calls and results in |
compare |
a function used to compare the results from the original call to the result from each of these calls. |
... |
additional arguments passed to the |
Since this is a generic function, the resulting value will be
different according to the inputs.
For FunctionCallResults
, this returns a list of values.
For CallResultInfo
, this returns the value from the
compare
function.
Duncan Temple Lang
collectCallResults
global1 = 10
global2 = 3.1415
f3 = function(x, y)
x + y + global1 + global2
e3 = collectCallResults("f3")
f3(10, 11)
f3(999, 777)
k = e3()
testFunCall(k, f3)
rm(global1, global2)
testFunCall(k, f3)
testFunCall(k, function(x, y) x + y + global1 + global2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.