This PR adds two helper functions test_fn_req_args() and test_fn_num_out() to check that a function has the expected number of required arguments, and that a function returns numeric output of the same length as the input, respectively. Documentation and tests are included.
These function are borrowed from the implementation in {cfr}, but differ:
The dependency on {checkmate} is removed;
test_fn_num_out() errors when the input argument fn is not a function (the {cfr} implementation instead returns FALSE). This has to do with the convenience of storing the output of fn(<vector>) before testing other conditions on this output.
This PR adds two helper functions
test_fn_req_args()
andtest_fn_num_out()
to check that a function has the expected number of required arguments, and that a function returns numeric output of the same length as the input, respectively. Documentation and tests are included.These function are borrowed from the implementation in {cfr}, but differ:
test_fn_num_out()
errors when the input argumentfn
is not a function (the {cfr} implementation instead returnsFALSE
). This has to do with the convenience of storing the output offn(<vector>)
before testing other conditions on this output.