Running ‘testthat.R’ [3s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(o2geosocial)
  Registered S3 methods overwritten by 'o2geosocial':
    method                    from       
    plot.outbreaker_chains    outbreaker2
    print.custom_likelihoods  outbreaker2
    print.custom_priors       outbreaker2
    print.outbreaker_chains   outbreaker2
    summary.outbreaker_chains outbreaker2
  > 
  > test_check("o2geosocial")
  
  
   ///// outbreaker custom likelihoods ///
  
  class: custom_likelihoods list
  number of items: 5 
  
  /// custom likelihoods set to NULL (default used) //
  $reporting
  NULL
  
  $timing_infections
  NULL
  
  $timing_sampling
  NULL
  
  $space
  NULL
  
  $age
  NULL
  
  
  
   ///// outbreaker custom likelihoods ///
  
  class: custom_likelihoods list
  number of items: 5 
  
  /// custom likelihoods //
  $reporting
  function(data, param, i) cpp_ll_reporting(data, param, i)
  <environment: 0x564a9a717f68>
  
  $timing_infections
  function(data, param, i) cpp_ll_timing_infections(data, param, i)
  <environment: 0x564a9a717f68>
  
  $timing_sampling
  function(data, param, i) cpp_ll_timing_sampling(data, param, i)
  <environment: 0x564a9a717f68>
  
  $space
  function(data, config, param, i) cpp_ll_space(data, config, param, i)
  <environment: 0x564a9a717f68>
  
  $age
  function(data, param, i) cpp_ll_age(data, param, i)
  <environment: 0x564a9a717f68>
  
  
   *** caught segfault ***
  address 0x1, cause 'memory not mapped'
  
  Traceback:
   1: .Call(`_o2geosocial_cpp_move_swap_cases`, param, data, config,     list_custom_ll)
   2: moves[[i]](param = param)
   3: eval(code, test_env)
   4: eval(code, test_env)
   5: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
   6: doTryCatch(return(expr), name, parentenv, handler)
   7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
   8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
   9: doTryCatch(return(expr), name, parentenv, handler)
  10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  11: tryCatchList(expr, classes, parentenv, handlers)
  12: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  13: test_code(desc, code, env = parent.frame(), default_reporter = local_interactive_reporter())
  14: test_that("test: try different default movements", {    data(toy_outbreak_short)    x <- toy_outbreak_short    dt_cases <- x$cases    dt_cases <- dt_cases[order(dt_cases$Date), ]    dt_regions <- x$dt_regions    all_dist <- geosphere::distGeo(matrix(c(rep(dt_regions$long,         nrow(dt_regions)), rep(dt_regions$lat, nrow(dt_regions))),         ncol = 2), matrix(c(rep(dt_regions$long, each = nrow(dt_regions)),         rep(dt_regions$lat, each = nrow(dt_regions))), ncol = 2))    dist_mat <- matrix(all_dist/1000, nrow = nrow(dt_regions))    pop_vect <- dt_regions$population    names(pop_vect) <- rownames(dist_mat) <- colnames(dist_mat) <- dt_regions$region    w <- dnorm(x = 1:100, mean = 11.7, sd = 2)    data <- outbreaker_data(dates = dt_cases$Date, age_group = dt_cases$age_group,         region = dt_cases$Cens_tract, population = pop_vect,         distance = dist_mat, a_dens = x$age_contact, f_dens = dgamma(x = 1:100,             scale = 0.43, shape = 27), w_dens = w)    config <- create_config(data = data)    config_no_move <- create_config(data = data, move_alpha = FALSE,         move_a = FALSE, move_b = FALSE, move_t_inf = FALSE, move_pi = FALSE,         move_kappa = FALSE, move_swap_cases = FALSE)    pre_clust <- pre_clustering(data = data, config = config)    data <- outbreaker_data(data = pre_clust[["data"]])    config <- create_config(config = pre_clust[["config"]], data = data)    data <- add_convolutions(data = data, config = config)    if (!is.null(data$log_w_dens[config$max_kappa, ])) {        config$delta <- max(which(data$log_w_dens[config$max_kappa,             ] > -20))    }    param <- create_param(data = data, config = config)$current    likeli <- custom_likelihoods()    priors <- custom_priors()    moves <- bind_moves(config = config, data = data, likelihoods = likeli,         priors = priors)    moves_no <- bind_moves(config = config_no_move, data = data,         likelihoods = likeli, priors = priors)    expect_true(all(vapply(moves, is.function, logical(1))))    expect_equal(length(moves), 8)    expect_equal(length(moves_no), 0)    for (i in seq_along(moves)) {        set.seed(1)        res <- moves[[i]](param = param)        expect_equal(length(param), length(res))        expect_equal(length(unlist(param)), length(unlist(res)))        expect_equal(names(param), names(res))    }})
  15: eval(code, test_env)
  16: eval(code, test_env)
  17: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  18: doTryCatch(return(expr), name, parentenv, handler)
  19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  21: doTryCatch(return(expr), name, parentenv, handler)
  22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  23: tryCatchList(expr, classes, parentenv, handlers)
  24: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  25: test_code(test = NULL, code = exprs, env = env, default_reporter = StopReporter$new())
  26: source_file(path, env = env(env), desc = desc, error_call = error_call)
  27: FUN(X[[i]], ...)
  28: lapply(test_paths, test_one_file, env = env, desc = desc, error_call = error_call)
  29: doTryCatch(return(expr), name, parentenv, handler)
  30: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  31: tryCatchList(expr, classes, parentenv, handlers)
  32: tryCatch(code, testthat_abort_reporter = function(cnd) {    cat(conditionMessage(cnd), "\n")    NULL})
  33: with_reporter(reporters$multi, lapply(test_paths, test_one_file,     env = env, desc = desc, error_call = error_call))
  34: test_files_serial(test_dir = test_dir, test_package = test_package,     test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,     env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     desc = desc, load_package = load_package, error_call = error_call)
  35: test_files(test_dir = path, test_paths = test_paths, test_package = package,     reporter = reporter, load_helpers = load_helpers, env = env,     stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     load_package = load_package, parallel = parallel)
  36: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  37: test_check("o2geosocial")
  An irrecoverable exception occurred. R is aborting now ...
  Segmentation fault