library(startR)
library(unidecoder)
context("Testing shipname string normalizing")
test_that("normalize_shipname", {
expect_true(is.na(normalize_shipname(NA)))
expect_true(is.na(normalize_shipname("")))
expect_equal(normalize_shipname("MixEd"), "MIXED")
expect_equal(normalize_shipname("weird -+%()<>$;!&'`\\.#/"), "WEIRD")
expect_equal(normalize_shipname(" \tspaced \nname "), "SPACEDNAME")
expect_equal(normalize_shipname("f/b boat f/v othername"), "BOATOTHERNAME")
expect_equal(normalize_shipname("r/v boat othername"), "BOATOTHERNAME")
expect_equal(normalize_shipname("no. boat"), "BOAT")
expect_equal(normalize_shipname("no537 boat"), "BOAT537")
expect_equal(normalize_shipname("boat IX"), "BOAT9")
expect_equal(normalize_shipname("boat IX (something)"), "BOAT9")
expect_equal(normalize_shipname("a"), "A")
expect_equal(normalize_shipname("no"), "NO")
expect_equal(normalize_shipname("海达705"), "HAIDA705")
})
context("Testing callsign string normalizing")
test_that("normalize_callsign",{
expect_true(is.na(normalize_callsign(NA)))
expect_true(is.na(normalize_callsign("")))
expect_equal(normalize_callsign("MixEd"), "MIXED")
expect_equal(normalize_callsign("weird -+%()<>$;!&'`\\.#/"), "WEIRD")
expect_equal(normalize_callsign(" \tspaced \nname "), "SPACEDNAME")
expect_equal(normalize_callsign("a"), "A")
expect_equal(normalize_callsign("0020300a"), "20300A")
})
context("Testing economic unit string normalizing")
test_that("normalize_economic_unit",{
expect_true(is.na(normalize_economic_unit("")))
expect_equal(normalize_economic_unit("MixEd"), "MIXED")
expect_equal(normalize_economic_unit("weird -+%()<>$;!&'`\\.#/"), "WEIRD")
expect_equal(normalize_economic_unit(" spaced name "), "SPACED NAME")
expect_equal(normalize_economic_unit("RUISEÑOR"), "RUISENOR")
expect_equal(normalize_economic_unit("SCPP Progreso"), "PROGRESO")
expect_equal(normalize_economic_unit("SCPP Progreso SA DE CV"), "PROGRESO")
expect_equal(normalize_economic_unit("SCPP Progreso SA DE CV DE RL"), "PROGRESO")
expect_equal(normalize_economic_unit("S.C.P.P. Progreso"), "PROGRESO")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.