context("Test fixing apt/unit names")
rr <- "rr 4 box 1000"
onenum <- "main st pobox 106"
mall_unit_after_case <- "halifax shopping centre 7001 Mumford rd UNIT 196"
mall_unit_after <- "halifax shopping centre 7001 mumford rd unit 196"
mall_unit_before <- "halifax shopping centre unit 196 7001 mumford rd "
mall_nounit <- "halifax shopping centre 7001 mumford rd"
unit_after <- "7001 mumford rd unit 196"
unit_before <- "unit 196 7001 mumford rd"
test_that("Do not change rr/hwy addresses and addresses without two numbers", {
expect_equal(fix_unit_names(rr), rr)
expect_equal(fix_unit_names(onenum), onenum)
})
test_that("Rearrange units and prefixes", {
expect_equal(fix_unit_names(mall_unit_after_case, ignore.case = TRUE),
"196-7001 Mumford rd halifax shopping centre")
expect_equal(fix_unit_names(mall_unit_after),
"196-7001 mumford rd halifax shopping centre")
expect_equal(fix_unit_names(mall_unit_before),
"196-7001 mumford rd halifax shopping centre")
})
# test_that("Rearrange, but no unit", {
# expect_equal(fix_unit_names(mall_nounit), # not passing yet, bc only one number? hmm. still want to change this.
# "7001 mumford rd halifax shopping centre")
# })
test_that("Rearrange units, with no prefix", {
expect_equal(fix_unit_names(unit_after),
"196-7001 mumford rd")
expect_equal(fix_unit_names(unit_before),
"196-7001 mumford rd")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.