11# CodeOcean R Quiz
22# Berry Boessenkool, berry-b@gmx.de, early 2020 + Oct 2020
33
4+
45# This script is run by `rt_score()` (in Rstudio) or by clicking "Score" (in CodeOcean).
56# Running this script may never fail on CodeOcean, hence keep it wrapped in `try()`.
67# The object 'task_id' must be defined here for the error messages through `rt_warn`.
@@ -14,7 +15,6 @@ library(codeoceanR) # for all functions prefixed with rt_
1415ntests <- 3 # number of tests
1516npassed <- 0 # number of passed tests
1617
17-
1818trytests <- try({
1919
2020task_id <- " _run"
@@ -77,12 +77,12 @@ rt_has_argument(sol, "row.names", FALSE)
7777
7878}, silent = TRUE )
7979task_id <- " _post"
80- if (inherits(trytests , " try-error" )) {
80+ if (inherits(trytests , " try-error" ))
8181 rt_warn(" The test script failed. Sorry for the 0 points right now. " ,
8282 " You'll have to revert the last thing(s) you did. " ,
83- if (interactive()) " Please click 'Request comments' and copypaste the logfile below.\n " , trytests )
84- }
83+ " Please send Berry the logfile below through email or 'Request comments' .\n " , trytests )
84+
8585# Final output -----------------------------------------------------------------
8686
87- # Keep the following at the end of the script, for CodeOcean scoring:
87+ if ( npassed > ntests ) npassed <- ntests # for Bonus points
8888cat(ntests , " examples," , npassed , " passed\n " )
0 commit comments