tbrown122387 / gradeR

helps grade R script assignment submissions!
Other
4 stars 4 forks source link

Switching Order of Assertions Changes Result #6

Closed alphonse closed 4 years ago

alphonse commented 4 years ago

Switching the order of the assertions within each test_that() call changes how the question is evaluated. The second assertion seems to have no effect on the output.

For instance, the example code:

test_that("third", {

  expect_equal(nrow(myDataFrame), 2)
  expect_equal(myDataFrame[1,1], 700.01, tolerance=1e-3)

})

evaluates to "correct" for both example submissions.

Switching the order triggers an "incorrect" result for both students:

test_that("third", {

  expect_equal(myDataFrame[1,1], 700.01, tolerance=1e-3)
  expect_equal(nrow(myDataFrame), 2)

})
tbrown122387 commented 4 years ago

Nice find @alphonse Just fixed this in 0285667b0664d2b19c7ac6a7a574bc7dcc8dda48 The problem was it just wasn't looping over all the assertions (calls to some expect_* function) in a given test. The fix was something similar to what you proposed. It was also a problem in the other grading function, too: calcGradesForGradescope

The changes have been pushed to CRAN, too, so if you re-install.packages("gradeR"), everything should be set.