tests/testthat/test-rescale_subjective_urbanization_en.R

library (surveyreader)
library(testthat)
context("Wrapper for Eurobarometer social class self-placement in English")

test_that("correct conversion takes place", {
  expect_equal(rescale_subjective_urbanization (c("Rural area or village",
                                                  "Large town/city",
                                                  "Small or medium-sized town",
                                                  "DK"),
                                                return_class = "character"),
  c("rural","city","town",NA)
  )
  expect_equal(rescale_subjective_urbanization (c("Rural area or village",
                                                  "Large town/city",
                                                  "Small or medium-sized town",
                                                  "DK"),
                                                return_class = "numeric"),
  c(0,2,1,NA)
  )
})
antaldaniel/surveyreader documentation built on May 16, 2019, 2:29 a.m.