tests/testthat/test_output.R

context("basic functions")

#making df
ids <- data.frame(stringsAsFactors = FALSE,
                  BCSI_ID = c("0009895550", "0015029713", "0014918378", "0011680571", "0000244439", "0000443800", "0014683780", "0014633035", "0014968385", "0014628773", "0008180304", "0005466750", "0002331547", "0015088570", "0001284195", "0000973162", "0014891515", "0015152971", "0006683337", "0008618771", "0000034200"),
                  N_PERS = c("0989555002", "1502971349", "1491837828", "1168057172", "0024443901", "0044380072", "1468378080", "1463303594", "1496838573", "1462877388", "0818030494", "0546675073", "0233154742", "1508857071", "0128419585", "0097316239", "1489151522", "1515297178", "0668333760", "0861877167", "0003420041"))

ids$N_PERS_num <- as.numeric(ids$N_PERS)
ids$BCSI_ID_num <- as.numeric(ids$BCSI_ID)





test_that("testing restore_npers", {
  check_restore_npers <- restore_npers(ids$N_PERS_num)
  expect_identical(check_restore_npers, ids$N_PERS)
})





test_that("testing npers_to_bcsi", {
  check_bcsi1 <- npers_to_bcsi(ids$N_PERS)
  check_bcsi2 <- npers_to_bcsi(ids$N_PERS_num)

  expect_identical(check_bcsi1, ids$BCSI_ID)
  expect_identical(check_bcsi2, ids$BCSI_ID)
})





test_that("testing bcsi_to_npers", {
  check_npers1 <- bcsi_to_npers(ids$BCSI_ID)
  check_npers2 <- bcsi_to_npers(ids$BCSI_ID_num)

  expect_identical(check_npers1, ids$N_PERS)
  expect_identical(check_npers2, ids$N_PERS)
})
suzanbaert/kycdata documentation built on May 23, 2019, 6:08 p.m.