
Last chance! 50% off unlimited learning
Sale ends in
check_code
: specifies the code that checks on the (typically,
final results of the) student's code. These tests are executed silently,
without the reporter generating information for these.
diagnose_code
: Set of tests that gets executed if the tests in
check_code
fail. These tests contain more detailed tests, to pinpoint
the problem. test_correct(check_code, diagnose_code)
check_correct(check_code, diagnose_code)
check_code
fail.test_correct
increases the flexibility for the student: if the tests
in check_code
pass, the results of the tests in diagnose_code
are not considered. If you test for the end result in check_code
, and
only do more rigorous testing in diagnose_code
, you can allow for
multiple solutions to a challenge.
## Not run:
# # Example solution code:
# # x <- mean(1:3)
#
# # Example SCT
# test_correct({
# test_object("x")
# }, {
# test_function("mean", "x")
# })
#
# # Following submissions will all be accepted:
# x <- mean(1:3)
# x <- 2
# x <- mean(-1:5)
# ## End(Not run)
Run the code above in your browser using DataLab