Further robustification of how missing x
is reported.
Marked is_data.frame/table
(snail.case) for future removal.
New functions *_is_data_frame_with_required_names
.
is_lt
/ is_lte
/ is_gt
/ is_gte
functions now ignore NA
values.
Formerly NA
values caused failures even in functions such as
dbc::assert_is_integer_gtzero_vector
which should allow them.
Fixed dbc::handle_args_inplace
handling of case where x_nm
was missing.
It raised an incomprehensible error, ironically when trying to emit
the error message concerning the missing x_nm
.
New functions dbc::*_is_subset_of_data_frame_*
and
dbc::*_is_subset_of_data_table_*
.
dbc::*_is_nonNA_*
funs now pass all objects that are not vectors (e.g.
lists, language objects). Only vectors are tested with is.na
.
dbc::report_is_one_of
gains arg arg_list
.
dbc::*_is_uniquely_named_*
funs now pass objects of length zero.
E.g. dbc::test_is_uniquely_named(list()) == TRUE
.
dbc::handle_arg_call
robustified in the same way as
dbc::handle_arg_x_nm
, and additionally it looks at each parent.frame(i)
for i = c(2L, 3L, 1L)
(yes, in that order).
dbc::handle_arg_call
returns the call from sys.calls()
that has the
corresponding environment in sys.frames()
as env
if call cannot be
otherwise determined. If even that fails, return
quote(could_not_determine_call)
.
dbc::handle_arg_x_nm
now more robust as it also looks at the
environments surrounding env
(the one preceding and one proceeding it
in the list of environments gotten by looping through parent.frame(i)
).
dbc::handle_args_inplace
gains optional arg
env
.
dbc::handle_args_inplace
now also handles y_nm
.
Improved some assertion error messages --- avoided term "mis-specified".
All generated assertion functions no longer create reports and pass those
to dbc::report_to_assertion
. Instead generated assertion functions use
stop
directly. This reduced wall clock time used in evaluation by ~90%.
New exported function dbc::assert
. Evaluate arbitrary assertion
expressions.
New function dbc::assertion_eval
. Assertion functions generated based on
expressions make use of this.
New function dbc::assertion_raise
. This is used every time dbc
raises an error over an assertion that did not pass.
New fun dbc::expression_eval
. Every assertion expression in dbc
is
evaluated by this function.
New exported function dbc::generate_function_from_expressions
. It is
used to produce all generated functions in dbc
that are based on
expressions.
New exported function dbc::generate_report_function_wrapper
.
This function is used to generate all report function wrappers in dbc
.
New exported function dbc::generate_report_function_wrapper_script
.
This function is used to produce all generated report wrapper functions
in dbc
.
New exported function dbc::generate_script_from_expressions
.
This function is used to produce all generated expression-based functions
in dbc
.
dbc::handle_arg_x_nm
now redacts x_nm
if it is longer than 50
characters.
New exported function dbc::handle_args_inplace
.
New exported fun dbc::interpolate
.
New exported function dbc::report
. Evaluate arbitrary report
expressions.
dbc::report_is
now only accepts objects of type call
and list
.
A list
is assumed to contain call
s.
New fun dbc::report_data_table_has_no_duplicates
and derivatives.
New exported function dbc::test
. Evaluate arbitrary test
expressions.
Made assertion fail messages a bit prettier by surrounding object names and expressions with [`] instead of ["].
All generated assertion, report and test functions now check whether
x
is missing and raise an informative error. There were edge cases
where x
was attempted to be evaluated only in a call to eval
which
resulted in cryptic error messages --- now those can no longer occur.
All generated assertion functions now pass call
to
dbc::report_to_assertion
arg raise_error_call
. Therefore, now an error
message begins with the call of the guilty function instead of the
assertion function.
dbc::report_is_one_of
now always returns a report data.frame
with only
one row. All is_one_of
assertion funs are now generated instead of being
manually generated. Their error messages have therefore changed.
New function [dbc::handle_arg_assertion_type]
. Currently returns
assertion_type
as-is, except assertion_type = NULL
is replaced with assertion_type <- dbc::assertion_type_default()
.
Raises an error if assertion_type
is not NULL
nor one of
dbc::assertion_types()
.
[dbc::report_to_assertion]
now accepts (and has as default)
assertion_type = NULL
. Arg assertion_type
is handled by
[dbc::handle_arg_assertion_type]
.
Every assertion function with assertion_type
argument now has as default
value NULL
.
Improved *_vector_elems_are_in_set
funs: assertion failure message
also shows first ten elems of set
.
New fun dbc::assertion_type_default
.
This returns the default value for the assertion_type
arg used by all
funs that have that arg.
New fun dbc::report_data_table_has_no_duplicates
and derivatives.
New fun dbc::report_is_all_equal
. Generated correspoding assertion
funs.
New fun dbc::report_is_identical
. Generated correspoding assertion
funs.
Added new assertion type "none"
. This was added for convenience:
using assertion_type = "none"
means that the assertion is not performed.
This can save computation time.
dbc::report_has_class
and dbc::report_inherits
error message improved for
when required_class
is improper.
dbc::report_has_class
and dbc::report_inherits
error message improved for
when required_class
is improper.
dbc::report_is
and all corresponding assertion functions now handle
string and expression inputs more robustly.
New fun dbc::report_is_like_template
. Generated correspoding assertion
funs. Compare an object's names, class, and length to a template. Recursive
for lists.
dbc::report_is
gains arg env
it is passed to
dbc::expressions_to_report
, so that's where x
will be evaluated.