Description Usage Arguments See Also Examples
Omnitest can test for a correct expression, a correct value, or both. In the case of values it is limited to testing for character or numeric vectors of length 1.
1 2 3 4 5 6 |
correctExpr |
the correct or expected expression as a string |
correctVal |
the correct value (numeric or character) |
strict |
a logical value indicating that the expression should be as expected even if the value is correct. If |
eval_for_class |
a logical value. If TRUE, evaluate the first argument of an S3 method to determine its class. Default=TRUE. Global value may also be set as customTests$EVAL_FOR_CLASS. |
Other AnswerTests:
AnswerTests
,
any_of_exprs()
,
calculates_same_value()
,
expr_creates_var()
,
expr_identical_to()
,
expr_is_a()
,
expr_uses_func()
,
func_of_newvar_equals()
,
val_has_length()
,
val_matches()
,
var_is_a()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Not run:
# Test that a user has chosen a correct menu item
#
omnitest(correctVal='Men in a college dorm.')
# Test that a user has entered a correct number at the
# command line
#
omnitest(correctVal=19)
# Test that a user has entered a particular command
#
omnitest('myVar <- c(3, 5, 7)')
# Test that a user has entered a command which computes
# a specific value but perhaps in a different manner
# than anticipated
#
omnitest('sd(x)^2', 5.95)
#
# If the user enters sd(x)*sd(x), rather than sd(x)^2, a notification
# will be issued, but the test will not fail.
# Test that a user has entered a command which computes
# a specific value in a particular way
#
omnitest('sd(x)^2', 5.95, strict=TRUE)
#
# In this case, if the user enters sd(x)*sd(x) the test will fail.
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.