tests/testthat/test-create_dataset.R

test_that("that a dataset is correctly cearted", {
  header_data <- list(
    block_type = 0,
    text_type = 104,
    channel_type = 0,
    additional_type = 64
  )

  ds <- create_dataset(header_data)

  expect_identical(ds$block_type_name, "history")

  expect_true(inherits(ds, "text"))

  header_data <- list(
    block_type = 100,
    text_type = 104,
    channel_type = 0,
    additional_type = 64
  )

  expect_warning(
    create_dataset(header_data),
    regexp = "Unknown header entry"
  )

  ds <- suppressWarnings(create_dataset(header_data))

  expect_identical(ds$block_type_name, "unknown")

  expect_true(inherits(ds, "list"))

  header_data <- list(
    block_type = 15,
    text_type = 0,
    channel_type = 48,
    additional_type = 64
  )

  ds <- create_dataset(header_data)

  expect_identical(ds$block_type_name, "refl_no_atm_comp")
})

Try the opusreader2 package in your browser

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

opusreader2 documentation built on Feb. 3, 2026, 5:07 p.m.