Error in `inDL(x, as.logical(local), as.logical(now), ...)`: unable to load shared object 'D:/RCompile/CRANpkg/lib/4.5/cppRouting/libs/x64/cppRouting.dll':
  LoadLibrary failure:  Die angegebene Prozedur wurde nicht gefunden.

context("basic tests for the neighbour matrices creation")
test_that("Testing on a simple scenario if the neighbouring functions are producing expected results", {
event <- st_as_sf(event, coords = c("x","y"))
obtainedmat <- spdep::nb2mat(listw$neighbours,style = "B")
tottest <- sum(abs(obtainedmat - expected)) == 0
test_that("Testing on a simple scenario if the neighbouring functions are producing expected results (with polygons)", {
eventbuff <- sf::st_buffer(event, dist = 1)
listw1 <- network_listw(origins = eventbuff,
obtainedmat1 <- spdep::nb2mat(listw1$neighbours,style = "B")
obtainedmat2 <- spdep::nb2mat(listw2$neighbours,style = "B")
tottest <- sum(abs(obtainedmat1 - expected1)) == 0 & sum(abs(obtainedmat2 - expected2))

"basic tests for the neighbour matrices creation"
"Testing on a simple scenario if the neighbouring functions are producing expected results"
"Testing on a simple scenario if the neighbouring functions are producing expected results (with polygons)"

Testing on a simple scenario if the neighbouring functions are producing expected results

Testing on a simple scenario if the neighbouring functions are producing expected results (with polygons)

context("testing functions for k and g function analysis")
#### TEST FOR THE SIMPLE K AND G FUNCTION ####
test_that("Testing the simple k function", {
all_lines <- st_as_sf(linesdf, wkt = "wkt")
# here we calculate the true value manually for the distance 3
dist_matrix <- as.matrix(dist(st_coordinates(event), method = 'manhattan', upper = T))
k <- mean((rowSums(dist_matrix <= 3) - 1)) * t1
g <- mean((rowSums( (dist_matrix <= 4) & (dist_matrix >= 2) ))) * t1
test <- round(observed$values[4,c("obs_k","obs_g")],3) == round(expected_vals,3)
test2 <- (any(!(round(observed$values$obs_k,3) == round(observed2$values$obs_k,3))) == FALSE)
#### TEST FOR THE SIMPLE K AND G FUNCTION (multicore) ####
test_that("Testing the simple k function (multicore)", {
#### TEST FOR THE cross K AND G FUNCTION ####
test_that("Testing the cross k function", {
k <- mean((rowSums(dist_matrix <= 3))) * t1
test2 <- (any(!(observed$values$obs_k == observed2$values$obs_k)) == FALSE)
#### TEST FOR THE cross K AND G FUNCTION (MULTICORE) ####
#### TEST FOR THE SIMPLE space-time K AND G FUNCTION ####
test_that("Testing the simple k function in space-time", {
all_lines <- sf::st_as_sf(linesdf, wkt = "wkt")
# after checking on a paper with a pen, the observed k and g values at  network
# distance 3 and time distance 1 must be :
test <- sum(round(obtained - expected_vals,5)) == 0
#### TEST FOR THE SIMPLE space-time K AND G FUNCTION (multicoce)  ####
test_that("Testing the simple k function in space-time multicore", {
observed <- k_nt_functions(lines = all_lines,
observed.mc <- k_nt_functions.mc(lines = all_lines,
t1 <- sum(round(observed$obs_g,3) - round(observed.mc$obs_g,3))
t2 <- sum(round(observed$obs_k,3) - round(observed.mc$obs_k,3))