tests/testthat/test_checks.R

context("Test 'type' checks")

test_that("Single alphanumeric strings are identified",{
  result <- rope:::is_alphanumeric_single("FOOB4ARBAZ")
  expect_that(result, equals(TRUE))
})

test_that("Multiple alphanumeric strings are identified",{
  result <- rope:::is_alphanumeric_vector(c("fooba4rbaz", "blarfjs9nfdjs"))
  expect_that(result, equals(c(TRUE, TRUE)))
})

test_that("Single non-alphanumeric strings are identified",{
  result <- rope:::is_alphanumeric_single("£84543mfdsj-")
  expect_that(result, equals(FALSE))
})

test_that("Multiple non-alphanumeric strings are identified",{
  result <- rope:::is_alphanumeric_vector(c("£84543mfdsj-","sds9Wq 2eqr3fw08t4';]["))
  expect_that(result, equals(c(FALSE, FALSE)))
})

test_that("Single alpha strings are identified",{
  result <- rope:::is_alpha_single("FOOBARBAZ")
  expect_that(result, equals(TRUE))
})

test_that("Multiple alpha strings are identified",{
  result <- rope:::is_alpha_vector(c("FOOBARBAZ", "blarfjsnfdjs"))
  expect_that(result, equals(c(TRUE, TRUE)))
})

test_that("Single non-alpha strings are identified",{
  result <- rope:::is_alpha_single("foobarbaz12")
  expect_that(result, equals(FALSE))
})

test_that("Multiple non-alpha strings are identified",{
  result <- rope:::is_alpha_vector(c("foobarbaz12","foob91egz"))
  expect_that(result, equals(c(FALSE, FALSE)))
})

test_that("Single numeric strings are identified",{
  result <- rope:::is_numeric_single("12")
  expect_that(result, equals(TRUE))
})

test_that("Multiple numeric strings are identified",{
  result <- rope:::is_numeric_vector(c("19","694"))
  expect_that(result, equals(c(TRUE, TRUE)))
})

test_that("Single non-alpha strings are identified",{
  result <- rope:::is_numeric_single("foobarbaz12")
  expect_that(result, equals(FALSE))
})

test_that("Multiple non-alpha strings are identified",{
  result <- rope:::is_numeric_vector(c("foobarbaz12","foob91egz"))
  expect_that(result, equals(c(FALSE, FALSE)))
})

test_that("Single hex strings are identified",{
  result <- rope:::is_hex_single("1fa07")
  expect_that(result, equals(TRUE))
})

test_that("Multiple hex strings are identified",{
  result <- rope:::is_hex_vector(c("21d9","1fa07"))
  expect_that(result, equals(c(TRUE, TRUE)))
})

test_that("Single non-hex strings are identified",{
  result <- rope:::is_hex_single("1fa07z")
  expect_that(result, equals(FALSE))
})

test_that("Multiple non-hex strings are identified",{
  result <- rope:::is_hex_vector(c("1fa07z","1fa028awq"))
  expect_that(result, equals(c(FALSE, FALSE)))
})
PeteHaitch/rope documentation built on May 8, 2019, 1:32 a.m.