P {realtest} | R Documentation |
Manually Create a Test Descriptor Prototype
Description
Allows for formulating expectations like 'the desired outcome is
c(1, 2, 3)
, with a warning' or 'an error should occur'.
Usage
P(
value = NULL,
error = NULL,
warning = NULL,
message = NULL,
stdout = NULL,
stderr = NULL,
value_comparer = NULL,
sides_comparer = NULL
)
Arguments
value |
object (may of course be equipped with attributes) |
error , warning , message |
conditions expected to occur,
see |
stdout , stderr |
|
value_comparer , sides_comparer |
optional two-argument functions
which may be used to override the default comparers
used by |
Details
If error
, warning
, message
, stdout
, or
stderr
are NULL
, then no side effects of particular
kinds are included in the output.
The semantics is solely defined by the sides_comparer
.
E
by default uses sides_similar
(see its description therein), although you are free to override
it manually or via a global option.
Value
A list of class realtest_descriptor
with named components:
-
value
, -
sides
(optional) – a list with named elementserror
,warnings
,messages
,stdout
, andstderr
; those which are missing are assumed to be equal toNULL
, -
value_comparer
(optional) – a function object, -
sides_comparer
(optional) – a function object.
Other functions are free to add more named components, and do with them whatever they please.
Author(s)
See Also
The official online manual of realtest at https://realtest.gagolewski.com/
Examples
# the desired outcome is c(1L, 2L, 3L):
P(1:3)
# expecting c(1L, 2L, 3L), with a warning:
P(1:3, warning=TRUE)
# note, however, that it is the sides_comparer that defines the semantics