tests/testthat/test_n2w.R

context("n2w")

test_that("Exception is thrown", {
    nbStates <- 2
    par <- c(0.5, 1.5, 10, 100)
    bounds <- matrix(c(0, 1, 0, 1,
                       0, Inf, 0, Inf),
                     byrow = TRUE, ncol = 2)
    beta <- matrix(rnorm(6), ncol = 2, nrow = 3)
    delta <- c(0.6, 0.4)

    expect_error(n2w(par, bounds, beta, delta, nbStates, estAngleMean = FALSE),
                 "Check the parameters bounds.")
})

test_that("Lengths of input and output are the same", {
    nbStates <- 2
    par <- c(0.5, 0.2, 10, 100)
    bounds <- matrix(c(0, 1, 0, 1,
                       0, Inf, 0, Inf),
                     byrow = TRUE, ncol = 2)
    beta <- matrix(rnorm(6), ncol = 2, nrow = 3)
    delta <- c(0.6, 0.4)

    expect_equal(length(n2w(par, bounds, beta, delta, nbStates, estAngleMean = FALSE)),
                 length(par) + length(beta) + length(delta) - 1)
})

Try the moveHMM package in your browser

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

moveHMM documentation built on May 31, 2023, 6:13 p.m.