11with_parameters_test_that(" sortfin works" , method = 1 : 3 , {
22 x = as.integer64(1 : 10 )
3- r = sample(x ) # NB: default method assumes 'sorted' is, well, sorted, so this requires method!=1
3+ r = sample(x )
44 expect_identical(sortfin(integer64(), 1 : 10 , method = method ), rep(FALSE , 10L ))
55 expect_identical(sortfin(x , integer64(), method = method ), logical ())
66
@@ -40,9 +40,6 @@ with_parameters_test_that("orderfin and orderpos work", method=1:3, {
4040 expect_identical(orderfin(table , partial_order , x_search , method = method ), partial_fin )
4141 expect_identical(orderpos(table , partial_order , x_search , method = method ), partial_pos )
4242
43- # user's example, where `table[order]` is not sorted ascending.
44- # The C functions expect ascending order, so they will fail to find the values.
45- # The test confirms the functions no longer segfault and return a consistent result.
4643 expect_identical(orderfin(as.integer64(10 : 1 ), 1 : 3 , 8 : 11 , method = method ), rep(FALSE , 4L ))
4744 expect_identical(orderpos(as.integer64(10 : 1 ), 1 : 3 , 8 : 11 , method = method ), rep(NA_integer_ , 4L ))
4845})
@@ -55,4 +52,4 @@ test_that("ordertab and orderdup work", {
5552 expect_identical(ordertab(x , idx , 10L ), rep(3 : 1 , c(6L , 2L , 2L )))
5653 expect_identical(orderdup(x , idx ), rep(c(FALSE , TRUE ), c(10L , 14L )))
5754 expect_identical(orderdup(x , idx , method = 2L ), rep(c(FALSE , TRUE ), c(10L , 14L )))
58- })
55+ })
0 commit comments