tests/testthat/test-ComputeUpperBoundGeneralMissing.R

test_that("gives the upper bound as given by
          enumerating algorithm: missing case I", {

            X <- c(1, 5, NA, 3, 2, 4, NA,6)
            Y <- c(2, 7, 6, 1, 3, 5, 4, 8)
            # enumerating
            Res <- ElaborateSpearmanFootrule(X,Y)
            enumerating_max = max(Res$AllPossibleSPearmanFootrule)
            expect_equal(ComputeUpperBoundGeneralMissing(X, Y), enumerating_max)
})


test_that("gives the upper bound as given by
          enumerating algorithm: missing case II", {

            X <- c(1, 5, NA, 3, 2, 4, NA, 6)
            Y <- c(2, NA, 6, 1, 3, 5, 4, NA)
            # enumerating
            Res <- ElaborateSpearmanFootrule(X,Y)
            enumerating_max = max(Res$AllPossibleSPearmanFootrule)
            expect_equal(ComputeUpperBoundGeneralMissing(X, Y), enumerating_max)
})


test_that("gives the upper bound as given by
          enumerating algorithm: missing case III", {
            
            X <- c(1, 5, NA, 3, 2, 4, NA, 6)
            Y <- c(2, 7, NA, 1, 3, 5, NA, 8)
            # enumerating
            Res <- ElaborateSpearmanFootrule(X,Y)
            enumerating_max = max(Res$AllPossibleSPearmanFootrule)
            expect_equal(ComputeUpperBoundGeneralMissing(X, Y), enumerating_max)
})


test_that("gives the upper bound as given by
          enumerating algorithm: general missing case", {
            X <- c(1, 5, NA, 3, 2, 4, NA, 6)
            Y <- c(2, NA, NA, 1, 3, 5, 4, 6)
            # enumerating
            Res <- ElaborateSpearmanFootrule(X,Y)
            enumerating_max = max(Res$AllPossibleSPearmanFootrule)
            expect_equal(ComputeUpperBoundGeneralMissing(X, Y), enumerating_max)
          })

Try the bosfr package in your browser

Any scripts or data that you put into this service are public.

bosfr documentation built on April 12, 2025, 9:15 a.m.