tests/testthat/test-deterge-ascii.R

library(testthat)

# ---- deterge_to_ascii --------------------------------------------------------
test_that("SEM founders --vanilla", {
  x         <- c("Ekstrom", "Joreskog", "bisschen Zurcher")
  expected  <- c("Ekstrom", "Joreskog", "bisschen Zurcher")
  observed  <- deterge_to_ascii(x)

  expect_equal(observed, expected)
})

test_that("SEM founders --normal", {
  skip("I need to find a way that works consistently across different OSes.")

  x         <- c("Ekstr\xf8m", "J\xf6reskog", "bi\xdfchen Z\xfcrcher")
  expected  <- c("Ekstrom", "Joreskog", "bisschen Zurcher")
  observed  <- deterge_to_ascii(x)

  expect_equal(observed, expected)
})

test_that("Russian --normal", {
  skip("I need to find a way that works consistently across different OSes.")

  # x <- "от сотрудницы"
  x <- c(
    "от сотрудницы",
    "мама и сестра",
    "подруга по общежитию"
  )
  expected <- c(
    "D 3/4 N? N?D 3/4 N?N?N?D'D 1/2 D,N?N?",
    "D 1/4 D?D 1/4 D? D, N?DuN?N?N?D?",
    "D?D 3/4 D'N?N?D3D? D?D 3/4  D 3/4 D+-N?DuD?D,N?D,N?"
  )

  observed <- deterge_to_ascii(x) # refresh: dput(observed)

  expect_equal(observed, expected)
})
OuhscBbmc/OuhscMunge documentation built on March 2, 2024, 11:44 a.m.