Commit c56ab477 authored by Bart's avatar Bart
Browse files

format tests

parent 8b716e85
Loading
Loading
Loading
Loading
Loading
+37 −10
Changes for tests/testthat/test-assertions.R: 37 added lines, 10 removed lines.
Original line number Diff line number Diff line
m <- mt_sim_brownian_motion(t = 1L:2L, tracks = 2L)
ml <- mt_sim_brownian_motion(t = 1L:2L, tracks = letters)
test_that("mt_is_move2", {
  expect_error(assert_that(mt_is_move2(1L)), "The input does not inherit the <move2> class")
  expect_error(assert_that(mt_is_move2(data.frame(a = 4L))), "The input does not inherit the <move2> class")
  expect_error(
    assert_that(mt_is_move2(1L)),
    "The input does not inherit the <move2> class"
  )
  expect_error(
    assert_that(mt_is_move2(data.frame(a = 4L))),
    "The input does not inherit the <move2> class"
  )
  expect_true(assert_that(mt_is_move2(m)))
})
test_that("Proper failure message ordered assertions", {
@@ -32,7 +38,9 @@ test_that("Proper failure message ordered assertions", {
    "In total there are 2 duplicate timestamps."
  )
  sf::st_geometry(m)[2L] <- sf::st_point()
  expect_true(assert_that(mt_has_unique_location_time_records(m[c(1L, 2L, 2L), ])))
  expect_true(assert_that(mt_has_unique_location_time_records(m[
    c(1L, 2L, 2L),
  ])))
  expect_error(
    assert_that(mt_has_no_empty_points(m)),
    "Not all locations are non empty points."
@@ -46,19 +54,38 @@ test_that("Proper failure message ordered assertions", {
    "At least the following records are not non-empty points: "
  )
  expect_true(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered())
  expect_true(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered(non_zero = FALSE))
  expect_false(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered(non_zero = TRUE))
  expect_true(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered_non_empty_points())
  expect_true(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered_non_empty_points(non_zero = FALSE))
  expect_false(mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered_non_empty_points(non_zero = TRUE))
  expect_true(
    mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered(non_zero = FALSE)
  )
  expect_false(
    mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered(non_zero = TRUE)
  )
  expect_true(
    mt_sim_brownian_motion(c(1.0, 1.0)) |> mt_is_time_ordered_non_empty_points()
  )
  expect_true(
    mt_sim_brownian_motion(c(1.0, 1.0)) |>
      mt_is_time_ordered_non_empty_points(non_zero = FALSE)
  )
  expect_false(
    mt_sim_brownian_motion(c(1.0, 1.0)) |>
      mt_is_time_ordered_non_empty_points(non_zero = TRUE)
  )
})
test_that("column incompatablity", {
  m <- mt_read(mt_example())
  expect_true(mt_has_unique_location_time_records(m))
  expect_false(mt_has_unique_location_time_records(m[c(1L, 5L, 5L, 6L, 6L), ]))
  expect_error(assert_that(mt_has_unique_location_time_records(m[c(1L, 5L, 5L, 6L, 6L), ])), "In total there are 2 duplicate timestamps")
  expect_error(
    assert_that(mt_has_unique_location_time_records(m[c(1L, 5L, 5L, 6L, 6L), ])),
    assert_that(mt_has_unique_location_time_records(m[
      c(1L, 5L, 5L, 6L, 6L),
    ])),
    "In total there are 2 duplicate timestamps"
  )
  expect_error(
    assert_that(mt_has_unique_location_time_records(m[
      c(1L, 5L, 5L, 6L, 6L),
    ])),
    "is from track F1 at time 2011-02-11 18:06:13.999 .record: 3"
  )
  mm <- m |>
+192 −51
Changes for tests/testthat/test-calculate_properties.R: 192 added lines, 51 removed lines.
Original line number Diff line number Diff line
@@ -9,14 +9,19 @@ test_that("all have units", {
  expect_type(mt_speed(x), "double")
  expect_identical(
    mt_sim_brownian_motion() |>
      mutate(time = as.POSIXct(time, origin = "1970-1-1")) |> mt_speed() |> units()
      |> as.character(),
      mutate(time = as.POSIXct(time, origin = "1970-1-1")) |>
      mt_speed() |>
      units() |>
      as.character(),
    "1/s"
  )
  expect_identical(
    mt_sim_brownian_motion() |> sf::st_set_crs(3857L) |>
      mutate(time = set_units(time, "h")) |> mt_speed() |> units()
      |> as.character(),
    mt_sim_brownian_motion() |>
      sf::st_set_crs(3857L) |>
      mutate(time = set_units(time, "h")) |>
      mt_speed() |>
      units() |>
      as.character(),
    "m/h"
  )
})
@@ -28,10 +33,14 @@ test_that("all movebank downloaded data has units", {
  withr::with_envvar(
    list("movebank:move2_user" = Sys.getenv("MBPWD")),
    withr::with_options(list(keyring_backend = "env"), {
      expect_s3_class(x <- movebank_download_study(2911040L,
      expect_s3_class(
        x <- movebank_download_study(
          2911040L,
          attributes = NULL,
          timestamp_end = as.POSIXct("2008-06-6 06:00:00")
      ), "move2")
        ),
        "move2"
      )
      expect_s3_class(x <- filter(x, !st_is_empty(x)), "move2")
      expect_s3_class(mt_distance(x), "units")
      # prevent message on loading s2
@@ -43,7 +52,13 @@ test_that("all movebank downloaded data has units", {
  )
})
test_that("all have correct length", {
  expect_s3_class(x <- mt_sim_brownian_motion(t = list(1L, 1L:2L, 1L:3L, 1L:4L, 1L:10L), tracks = 5L), "move2")
  expect_s3_class(
    x <- mt_sim_brownian_motion(
      t = list(1L, 1L:2L, 1L:3L, 1L:4L, 1L:10L),
      tracks = 5L
    ),
    "move2"
  )
  expect_length(mt_distance(x), 20L)
  expect_length(mt_time_lags(x), 20L)
  expect_length(mt_time(x), 20L)
@@ -52,19 +67,30 @@ test_that("all have correct length", {
  expect_length(x |> sf::st_set_crs(4326) |> mt_turnangle(), 20L)
})
test_that("all have na in correct locations", {
  expect_s3_class(x <- mt_sim_brownian_motion(t = list(1, 1:2, 1:3, 1:4, 1:10), tracks = 5L), "move2")
  expect_equal(which(is.na(mt_distance(x))), c(1L, 3L, 6L, 10L, 20L), ignore_attr = TRUE)
  expect_s3_class(
    x <- mt_sim_brownian_motion(t = list(1, 1:2, 1:3, 1:4, 1:10), tracks = 5L),
    "move2"
  )
  expect_equal(
    which(is.na(mt_distance(x))),
    c(1L, 3L, 6L, 10L, 20L),
    ignore_attr = TRUE
  )
  expect_identical(which(is.na(mt_time_lags(x))), c(1L, 3L, 6L, 10L, 20L))
  expect_false(anyNA(mt_time(x)))
  expect_equal(which(is.na(mt_speed(x))),
  expect_equal(
    which(is.na(mt_speed(x))),
    c(1L, 3L, 6L, 10L, 20L),
    ignore_attr = TRUE
  )
  expect_identical(x |>
  expect_identical(
    x |>
      sf::st_set_crs(4326L) |>
      mt_azimuth() |>
      is.na() |>
    which(), c(1L, 3L, 6L, 10L, 20L))
      which(),
    c(1L, 3L, 6L, 10L, 20L)
  )
  expect_identical(
    x |>
      sf::st_set_crs(4326L) |>
@@ -77,11 +103,15 @@ test_that("all have na in correct locations", {
test_that("has correct value", {
  n <- 10
  d <- data.frame(
    x = c(0, 0, 1, 0, 1, 0, -1, -2, -3, -3), y = c(1:4, 4, 5, 6, 6, 5, 4),
    timestamp = 1:n, track = gl(1, n)
    x = c(0, 0, 1, 0, 1, 0, -1, -2, -3, -3),
    y = c(1:4, 4, 5, 6, 6, 5, 4),
    timestamp = 1:n,
    track = gl(1, n)
  )
  m <- mt_as_move2(st_as_sf(d, coords = 1L:2L, crs = 3857L),
    track_id_column = "track", time_column = "timestamp"
  m <- mt_as_move2(
    st_as_sf(d, coords = 1L:2L, crs = 3857L),
    track_id_column = "track",
    time_column = "timestamp"
  ) |>
    st_transform(4326)
  expect_identical(
@@ -92,7 +122,11 @@ test_that("has correct value", {
    units::set_units(mt_turnangle(m), "degrees") |> round(),
    set_units(c(NA, 45, -90, 135, -135, 0, -45, -45, -45, NA), "degrees")
  )
  m <- mt_as_move2(st_as_sf(d, coords = 1:2), track_id_column = "track", time_column = "timestamp")
  m <- mt_as_move2(
    st_as_sf(d, coords = 1:2),
    track_id_column = "track",
    time_column = "timestamp"
  )
  expect_identical(
    units::set_units(mt_azimuth(m), "degrees"),
    set_units(c(0, 45, -45, 90, -45, -45, -90, -135, 180, NA), "degrees")
@@ -104,55 +138,156 @@ test_that("has correct value", {
  )
})
test_that("turn angles in -180 180 range", {
  d <- data.frame(x = c(0L, 0L, 1L, 0L, 1L), y = -c(1L:5L), timestamp = 1L:5L, track = gl(1L, 5L), timestamp2 = c(0, 1, 3, 6, 10))
  d <- data.frame(
    x = c(0L, 0L, 1L, 0L, 1L),
    y = -c(1L:5L),
    timestamp = 1L:5L,
    track = gl(1L, 5L),
    timestamp2 = c(0, 1, 3, 6, 10)
  )
  expect_identical(
    mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp") |>
      mt_azimuth() |> set_units("degrees"),
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_azimuth() |>
      set_units("degrees"),
    set_units(c(180L, 135L, -135L, 135L, NA), "degrees")
  )
  expect_identical(
    mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp") |>
      mt_turnangle() |> set_units("degrees"),
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_turnangle() |>
      set_units("degrees"),
    set_units(c(NA, -45L, 90L, -90L, NA), "degrees")
  )
  expect_identical(
    mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp") |>
      mt_turnangle() |> set_units("degrees"),
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_turnangle() |>
      set_units("degrees"),
    set_units(c(NA, 45L, -90L, 90L, NA), "degrees")
  )
  d[["y"]] <- -d[["y"]]
  expect_identical(
    mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp") |>
      mt_turnangle() |> set_units("degrees"),
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_turnangle() |>
      set_units("degrees"),
    set_units(c(NA, 45L, -90L, 90L, NA), "degrees")
  )
  expect_identical(
    mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp") |>
      mt_turnangle() |> set_units("degrees"),
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_turnangle() |>
      set_units("degrees"),
    set_units(c(NA, -45L, 90L, -90L, NA), "degrees")
  )
  expect_equal(mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp") |>
    mt_distance(), c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp") |>
    mt_speed(), c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp2") |>
    mt_speed(), c(1.0, sqrt(2.0) / 2.0, sqrt(2.0) / 3.0, sqrt(2.0) / 4.0, NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 2L:1L), track_id_column = "track", time_column = "timestamp2") |>
    mt_distance(), c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp") |>
    mt_distance(), c(1, sqrt(2), sqrt(2), sqrt(2), NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp") |>
    mt_speed(), c(1, sqrt(2), sqrt(2), sqrt(2), NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp2") |>
    mt_speed(), c(1, sqrt(2) / 2, sqrt(2) / 3, sqrt(2) / 4, NA), ignore_attr = TRUE)
  expect_equal(mt_as_move2(st_as_sf(d, coords = 1L:2L), track_id_column = "track", time_column = "timestamp2") |>
    mt_distance(), c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA), ignore_attr = TRUE)
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_distance(),
    c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_speed(),
    c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp2"
    ) |>
      mt_speed(),
    c(1.0, sqrt(2.0) / 2.0, sqrt(2.0) / 3.0, sqrt(2.0) / 4.0, NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 2L:1L),
      track_id_column = "track",
      time_column = "timestamp2"
    ) |>
      mt_distance(),
    c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_distance(),
    c(1, sqrt(2), sqrt(2), sqrt(2), NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp"
    ) |>
      mt_speed(),
    c(1, sqrt(2), sqrt(2), sqrt(2), NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp2"
    ) |>
      mt_speed(),
    c(1, sqrt(2) / 2, sqrt(2) / 3, sqrt(2) / 4, NA),
    ignore_attr = TRUE
  )
  expect_equal(
    mt_as_move2(
      st_as_sf(d, coords = 1L:2L),
      track_id_column = "track",
      time_column = "timestamp2"
    ) |>
      mt_distance(),
    c(1.0, sqrt(2.0), sqrt(2.0), sqrt(2.0), NA),
    ignore_attr = TRUE
  )
})

test_that("Failures correct", {
  expect_s3_class(m <- mt_sim_brownian_motion(tracks = 1L, t = 1L:3L), "move2")
  expect_error(m[c(1, 3, 2), ] |> mt_distance(), "Not all timestamps in `x` are ordered within track.")
  expect_error(m[c(1, 3, 2), ] |> mt_time_lags(), "Not all timestamps in `x` are ordered within track.")
  expect_error(
    m[c(1, 3, 2), ] |> mt_distance(),
    "Not all timestamps in `x` are ordered within track."
  )
  expect_error(
    m[c(1, 3, 2), ] |> mt_time_lags(),
    "Not all timestamps in `x` are ordered within track."
  )
  expect_error(
    m |> sf::st_set_crs(4326L) |> st_transform(3857L) |> mt_azimuth(),
    "Currently the calculation of azimuths is not implemented for this projectio"
@@ -166,19 +301,25 @@ test_that("Failures correct", {
    {
      m$geometry[2L] <- st_point()
      m
    } |> mt_distance(),
    } |>
      mt_distance(),
    "Not all locations are non empty points."
  )
})

test_that("mt_azimuth with different types of track ids", {
  a <- mt_sim_brownian_motion()
  expect_identical(mt_azimuth(a), mt_azimuth(mt_set_track_id(a, as.character(mt_track_id(a)))))
  expect_identical(mt_azimuth(a), mt_azimuth(mt_set_track_id(a, factor(mt_track_id(a)))))
  expect_identical(
    mt_azimuth(a),
    mt_azimuth(mt_set_track_id(a, as.character(mt_track_id(a))))
  )
  expect_identical(
    mt_azimuth(a),
    mt_azimuth(mt_set_track_id(a, factor(mt_track_id(a))))
  )
})



test_that("sim data no units", {
  a <- mt_sim_brownian_motion()
  expect_false(inherits(mt_speed(a), "units"))
+24 −7
Changes for tests/testthat/test-column_name.R: 24 added lines, 7 removed lines.
Original line number Diff line number Diff line
x <- mt_sim_brownian_motion() |> dplyr::mutate(
x <- mt_sim_brownian_motion() |>
  dplyr::mutate(
    date = as.Date("2020-1-1") + time * 3,
  tf = factor(time), new_id = gl(4, 5),
    tf = factor(time),
    new_id = gl(4, 5),
    new_id_2 = as.numeric(new_id) %/% 2
  )

test_that("setting time column works as expected", {
  expect_identical(x |> mt_time_column(), "time")
  expect_identical(x |> mt_set_time_column("date") |> mt_time_column(), "date")
  expect_error(x |> mt_set_time_column("asdf"), "The argument `value` needs to be the name of a column in `x`")
  expect_error(x |> mt_set_time_column("tf"), "The time column should be .*, a .* or a ")
  expect_error(
    x |> mt_set_time_column("asdf"),
    "The argument `value` needs to be the name of a column in `x`"
  )
  expect_error(
    x |> mt_set_time_column("tf"),
    "The time column should be .*, a .* or a "
  )
  expect_error(x |> mt_set_time_column(letters))
  expect_error(x |> mt_set_time_column(2))
})
test_that("setting track id works as expected", {
  expect_identical(x |> mt_set_track_id("new_id") |> mt_n_tracks(), 4L)
  expect_identical(x |> mt_set_track_id("new_id_2") |> mt_n_tracks(), 3L)
  expect_error(x |> mt_set_track_id_column("new_id_2"), "The `track_data` does not have a column with the name ")
  expect_error(
    x |> mt_set_track_id_column("new_id_2"),
    "The `track_data` does not have a column with the name "
  )

  expect_error(x |> mt_set_track_id_column("new"), "The argument `value` needs to be the name of a column in `x`")
  expect_error(
    x |> mt_set_track_id_column("new"),
    "The argument `value` needs to be the name of a column in `x`"
  )
  expect_error(
    x |> mt_set_track_id_column("date"),
    "Track id.s. should be of the type integer, integer64, character or factor."
@@ -26,7 +40,10 @@ test_that("setting track id works as expected", {
    mutate(rr = c(1, 1, 1, 1, 2, 2)) |>
    mt_set_track_data(data.frame(rr = c(1, 2, 2), track = 1:3))

  expect_error(mt_set_track_id_column(m, "rr"), "There are duplicated track identifiers in the new `track_id` column ..rr.. of the `track_data`")
  expect_error(
    mt_set_track_id_column(m, "rr"),
    "There are duplicated track identifiers in the new `track_id` column ..rr.. of the `track_data`"
  )
})
test_that("length required", {
  expect_silent(mt_set_time(x, seq_len(nrow(x))))
+20 −5
Changes for tests/testthat/test-import_telemetry.R: 20 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -3,9 +3,15 @@ test_that("import telemetry", {
  skip_if_not_installed("ctmm")
  data("pelican", package = "ctmm")
  expect_s3_class(mt_as_move2(pelican$gps), "move2")
  expect_identical(mt_as_move2(pelican$gps) |> mt_track_id() |> unique() |> as.character(), "BRPE_03_2017_Adam")
  expect_identical(
    mt_as_move2(pelican$gps) |> mt_track_id() |> unique() |> as.character(),
    "BRPE_03_2017_Adam"
  )
  expect_s3_class(mt_as_move2(pelican$argos), "move2")
  expect_identical(mt_as_move2(pelican$argos) |> mt_track_id() |> unique() |> as.character(), "BRPE_03_2017_Adam")
  expect_identical(
    mt_as_move2(pelican$argos) |> mt_track_id() |> unique() |> as.character(),
    "BRPE_03_2017_Adam"
  )
  expect_identical(mt_as_move2(pelican$argos) |> mt_track_id_column(), "track")
})
test_that("import telemetry list", {
@@ -13,7 +19,10 @@ test_that("import telemetry list", {
  data("pelican", package = "ctmm")
  suppressMessages(expect_s3_class(mt_as_move2(pelican), "move2"))
  expect_message(mt_as_move2(pelican), "New names:")
  suppressMessages(expect_identical(nrow(mt_as_move2(pelican)), sum(unlist(lapply(pelican, nrow)))))
  suppressMessages(expect_identical(
    nrow(mt_as_move2(pelican)),
    sum(unlist(lapply(pelican, nrow)))
  ))
  suppressMessages(expect_identical(mt_as_move2(pelican) |> mt_n_tracks(), 2L))
  expect_error(
    mt_as_move2(c(pelican, list(mt_sim_brownian_motion()))),
@@ -30,7 +39,10 @@ test_that("buffalo", {
  expect_silent(mt_as_move2(buffalo))
  expect_s3_class(mt_as_move2(buffalo), "move2")
  expect_identical(mt_n_tracks(mt_as_move2(buffalo)), length(buffalo))
  expect_identical(sf::st_crs(mt_as_move2(buffalo)), st_crs(buffalo[[4]]@info$projection))
  expect_identical(
    sf::st_crs(mt_as_move2(buffalo)),
    st_crs(buffalo[[4]]@info$projection)
  )
  expect_identical(mt_as_move2(buffalo) |> mt_track_id_column(), "track")
})

@@ -39,5 +51,8 @@ test_that("turtle", {
  data("turtle", package = "ctmm")
  expect_message(mt_as_move2(turtle), "New names")
  suppressMessages(expect_no_warning(mt_as_move2(turtle)))
  suppressMessages(expect_identical(mt_n_tracks(mt_as_move2(turtle)), length(turtle)))
  suppressMessages(expect_identical(
    mt_n_tracks(mt_as_move2(turtle)),
    length(turtle)
  ))
})
+4 −1
Changes for tests/testthat/test-import_track_xyt.R: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,5 +2,8 @@
test_that("import telemetry", {
  skip_if_not_installed("amt")
  data("amt_fisher", package = "amt")
  expect_identical(mt_as_move2(amt_fisher) |> mt_n_tracks(), length(unique(amt_fisher$id)))
  expect_identical(
    mt_as_move2(amt_fisher) |> mt_n_tracks(),
    length(unique(amt_fisher$id))
  )
})
Loading