tests/testthat/test_moveHMM.R

context("moveHMM")

test_that("Exceptions are thrown", {
    data <- data.frame(1, 2, 3)
    states <- rep(1, 10)
    mle <- list(1, 2, 3)
    stepDist <- "gamma"
    angleDist <- "vm"
    mod <- list(1, 2, 3)
    conditions <- list(zeroInflation = FALSE, estAngleMean = TRUE, stationary = FALSE, formula = ~c1)
    rawCovs <- data.frame(c1 = rnorm(10))

    m <- list(data = data, states = states, mle = mle, stepDist = stepDist, angleDist = angleDist, mod = mod,
              conditions = conditions, rawCovs = rawCovs)
    expect_error(moveHMM(m),  NA)

    m <- list(data = data, states = states, mle = mle, stepDist = stepDist)
    expect_error(moveHMM(m))
})

test_that("The output has the right class attribute", {
    data <- data.frame(1, 2, 3)
    states <- rep(1, 10)
    mle <- list(1, 2, 3)
    stepDist <- "gamma"
    angleDist <- "vm"
    mod <- list(1, 2, 3)
    conditions <- list(zeroInflation = FALSE, estAngleMean = TRUE, stationary = FALSE, formula = ~c1)
    rawCovs <- data.frame(c1 = rnorm(10))

    m <- list(data = data, states = states, mle = mle, stepDist = stepDist, angleDist = angleDist, mod = mod,
              conditions = conditions, rawCovs = rawCovs)
    m <- moveHMM(m)

    expect_equal(length(which(class(m) == "moveHMM")), 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.