scratch/scratch_test_iterating.R

for (nme in c("mean", "median", "max", "min")) {
  fun <- match.fun(nme)
  expect_false(is.numeric(fun(runif(10))), label = nme)
}


single_arg_functions <- c(
  "EQUALS",
  "DISJOINT",
  "INTERSECTS",
  "TOUCHES",
  "CROSSES",
  "WITHIN",
  "CONTAINS",
  "OVERLAPS"
)

for (nme in single_arg_functions[6]) {
  fun <- match.fun(nme)

  local <- bcdc_query_geodata(
    "regional-districts-legally-defined-administrative-areas-of-bc"
  ) %>%
    filter(ADMIN_AREA_NAME == "Cariboo Regional District") %>%
    collect()

  remote <- bcdc_query_geodata("bc-airports") %>%
    filter(fun(local)) %>%
    collect()

  expect_s3_class(remote, "sf")
  expect_equal(attr(remote, "sf_column"), "geometry")
}
bcgov/bcdc documentation built on April 13, 2025, 2:49 p.m.