testwhat
testwhat copied to clipboard
test_not()
Would be useful to have a test_not()
command in some cases.
e.g.
*** =solution
...
test$Age <- test$Age - 3
...
then in SCT
*** =sct
test_not(test_student_typed("test\\$age"), incorrect_msg = "Watch out, you're using `...$age`, while the correct column is `...$Age`. R is case sensitive!")
This is much harder than anticipated for exercises that use the solution code or solution environment, such as test_function()
and test_object()
.
Say for example that you want to check if a function has not been called, summary()
. The SCT would look something like:
test_not(test_function("summary"))
The first thing that test_function()
tries to do is checking if the solution code contains test_function
; it doesn't so it throws an error (like a real error, not a "SCT failed error") and you can't get to the point where actually the student code is checked.
We need some sort of 'denial state', just like the 'silent state' (that's used in test_or()
, test_correct()
and test_function_definition()
). Do this after the issue with test_code etc is fixed, maybe the structure is clearer then.