tests/testthat/test_smallerfunctions.R

library(skynet)

context("Test support functions")


test_that("Find Airport", {
  expect_output(print(find_airport("ATL")[[2]]), "30397")
})

test_that("Find Carrier", {
  expect_output(print(find_carrier("United Air Lines")[[1]]), "UA")
})

test_that("From To function", {
  test <- make_net_dir(OD_Sample)
  expect_output(print(from_to_stats(test$gDir, "JFK", orig = "from")), "78")
})


test_that("boot_network", {
  test <- make_net_dir(OD_Sample)
  expect_length(boot_network(test$gDir, n = 10), 4)
  expect_gt(sum(boot_network(test$gDir, n = 10)), 0)
})

test_that("Create Nodes",{
  test <- createNodes(OD_Sample)
  expect_length(test, 6)
  expect_length(test$origin, 251)
})

test_that("Plot Map",{
  test <- net_map(make_net_dir(OD_Sample))
  expect_output(print(class(test)[1]), "gg")
})

Try the skynet package in your browser

Any scripts or data that you put into this service are public.

skynet documentation built on June 17, 2022, 5:05 p.m.