tests/testthat/test-split_labels.R

test_that("Splitting data block labels", {
  label_lines <- c(
    'OD600_1:600,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
    '"GFP_1:485/20,530/25",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
    'VIO_1:575,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
    '"RFP_1:530/25,620/15",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
    'SPE_1:Spectrum,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'
  )

  answers <- list(
    c('od600_1', '600'),
    c('gfp_1', '485_530'),
    c('vio_1', '575'),
    c('rfp_1', '530_620'),
    c('spe_1', 'spectrum')
  )

  purrr::map2(label_lines, answers, \(x, y) expect_equal(.split_labels(x)[[1]], y))
})
rforbiochemists/wellr documentation built on March 28, 2024, 4:26 a.m.