tests/testthat/test_check_flowline.R

library(fluvgeo)
context("check_flowline")

# Create testing data
## fields at the `create_flowline` stage
sin_fl_1 <- fluvgeo::sin_flowline_sf[, c("OBJECTID", "ReachName")]

## fields at the `profile_points` stage
sin_fl_2 <- fluvgeo::sin_flowline_sf[, c("OBJECTID", "ReachName",
                                     "from_measure", "to_measure")]


test_that("check step `create_flowline`", {
  expect_true(check_flowline(sin_fl_1, "create_flowline"))
})

test_that("check step `profile_points`", {
  expect_true(check_flowline(sin_fl_2, "profile_points"))
})

test_that("other data sturctures", {
  expect_error(check_flowline(fluvgeo::sin_features_sf, "profile_points"))
  expect_error(check_flowline(fluvgeo::sin_banklines_sf, "profile_points"))
  expect_error(check_flowline(fluvgeo::sin_loop_points_sf, "profile_points"))
})
FluvialGeomorph/fluvgeo documentation built on Feb. 19, 2025, 4:24 p.m.