datacamp / testwhat

Write Submission Correctness Tests for R exercises
https://datacamp.github.io/testwhat
GNU Affero General Public License v3.0
33 stars 25 forks source link

Allow has_equal_value-like behavior from pythonwhat #161

Open filipsch opened 6 years ago

filipsch commented 6 years ago

Currently, in if tests, for loops and function definitions, it is not possible to rerun the piece of code that is zoomed in on like it is possible in pythonwhat with has_equal_value(), has_equal_error() and has_equal_output(). It shouldn't be that hard to include this functionality as well. What it would look like:

# check if condition of an if-else evaluates correctly
ex() %>% check_if_else() %>% {
  check_cond(.) %>% check_expr() %>% check_result() %>% check_equal()
  check_if() %>% ...
  check_else() %>% ...
}

# check if value of a variable total is properly updated in the body (where to put "total"?)
ex() %>% check_for_loop() %>% {
  check_cond(.) %>% ...
  check_body(.) %>% check_expr() %>% check_result("total") %>% check_equal("total")
}

# todo add more ...

cc @sumedh10 if you have any ideas on what a good API would be, let me know.