tests/testthat/test-dbl.R

test_that("Large exponents can parse", {
  res <- vroom(I("1e-63,1e-64\n"), delim = ",", col_types = "dd", col_names = FALSE)
  expect_equal(res[[1]], 1e-63)
  expect_equal(res[[2]], 1e-64)
})

test_that("Doubles parse correctly with comma as decimal separator", {
  res <- vroom(I("23,4\n"), delim='\t', altrep=FALSE,
               locale=locale(decimal_mark=','),
               col_types='d', col_names=FALSE)
  expect_equal(res[[1]], 23.4)
  res2 <- vroom(I("23,4\n"), delim='\t', altrep=TRUE,
               locale=locale(decimal_mark=','),
               col_types='d', col_names=FALSE)
  expect_equal(res2[[1]], 23.4)
})

Try the vroom package in your browser

Any scripts or data that you put into this service are public.

vroom documentation built on June 14, 2021, 5:09 p.m.