mllg / checkmate

Fast and versatile argument checks
https://mllg.github.io/checkmate/
Other
263 stars 30 forks source link

sorted option not enforced when sort violations bridge NA #258

Closed bifouba closed 3 months ago

bifouba commented 7 months ago

This fails as expected: checkmate::check_integerish(c(2, 1), sorted = TRUE)

The mere presence of NAs is not an issue, as these continue to fail as expected: checkmate::check_integerish(c(2, 1, NA), sorted = TRUE) checkmate::check_integerish(c(NA, 2, 1), sorted = TRUE)

BUT if the sort order violation is interrupted by NA, it remains unnoticed. The following incorrectly returns TRUE: checkmate::check_integerish(c(2, NA, 1), sorted = TRUE)

tdeenes commented 7 months ago

@mllg This is a bug in is_sorted_double. I will prepare a PR in a minute.

tdeenes commented 7 months ago

fixed in PR