comparers: Example Object and Side Effect Comparers¶
ignore_differences(x, y) sides_similar(x, y)
prototype or part thereof
object under scrutiny or part thereof
ignore_differences is a dummy comparer that always returns
TRUE. Hence, it does not discriminate between anything.
sides_similar is useful when comparing side effect lists. It defines the following semantics for the prototypical values:
FALSE– side effect must not occur,
NA– ignore whatsoever,
TRUE– side effect occurs, but the details are irrelevant (e.g., ‘some warning’ as opposed to
otherwise, a character vector with message(s) matched exactly.
You can define any comparers of your own liking: the possibilities are endless. For example:
a comparer for side effects based on regular expressions or wildcards (e.g.,
a comparer that tests whether all elements in a vector are equal to
a comparer that verifies whether each element in a vector falls into a specified interval,
a comparer that ignores all the object attributes (possibly in combination with other comparers),
and so forth.
Each comparer should yield
TRUE if the test condition is considered met or anything else otherwise. However, it is highly recommended that in the latter case, a single string with a short summary of the differences is returned, as in