round(process_eamd(input_file)$adh, 4) (`actual`) not equal to data.frame(...) (`expected`).

actual vs expected
                daysadh daysdose perdoses  n
- actual[1, ]    0.5652   0.6957   0.8261 23
+ expected[1, ]  0.5833   0.7083   0.8333 24

  `actual$daysadh`: 0.565
`expected$daysadh`: 0.583

  `actual$daysdose`: 0.696
`expected$daysdose`: 0.708

  `actual$perdoses`: 0.8261
`expected$perdoses`: 0.8333

  `actual$n`: 23.0
`expected$n`: 24.0

input_file <- system.file('extdata', 'sample-data-ecap2.csv', package = 'oncmap')

round(...) (`actual`) not equal to data.frame(...) (`expected`).

actual vs expected
                daysadh daysdose perdoses  n
- actual[1, ]    0.2174   0.7391   1.3571 23
+ expected[1, ]  0.2083   0.7083   1.2500 24

  `actual$daysadh`: 0.2174
`expected$daysadh`: 0.2083

  `actual$daysdose`: 0.739
`expected$daysdose`: 0.708

  `actual$perdoses`: 1.36
`expected$perdoses`: 1.25

  `actual$n`: 23.0
`expected$n`: 24.0

round(report$adh, 4) (`actual`) not equal to data.frame(daysadh = 0.6, daysdose = 0.7, perdoses = 0.8, n = 20) (`expected`).

actual vs expected
                daysadh daysdose perdoses  n
- actual[1, ]    0.5789   0.6842   0.7895 19
+ expected[1, ]  0.6000   0.7000   0.8000 20

  `actual$daysadh`: 0.579
`expected$daysadh`: 0.600

  `actual$daysdose`: 0.684
`expected$daysdose`: 0.700

  `actual$perdoses`: 0.789
`expected$perdoses`: 0.800

  `actual$n`: 19.0
`expected$n`: 20.0

round(process_eamd("test_ecap2.xls")$adh, 4) (`actual`) not equal to data.frame(...) (`expected`).

actual vs expected
                daysadh daysdose perdoses   n
- actual[1, ]    0.0482   0.0799   0.1116 726
+ expected[1, ]  0.0495   0.0812   0.1128 727

  `actual$daysadh`: 0.0482
`expected$daysadh`: 0.0495

  `actual$daysdose`: 0.0799
`expected$daysdose`: 0.0812

  `actual$perdoses`: 0.1116
`expected$perdoses`: 0.1128

  `actual$n`: 726.0
`expected$n`: 727.0

test_that("process_eamd processing", {
expect_equal(process_eamd("empty.csv")$log[1,]$message, "No data.")
expect_equal(process_eamd("noformat.badext")$log[1,]$message, "Unknown extension of file noformat.badext")
expect_equal(process_eamd("noformat.csv")$data, NULL)
expect_equal(round(process_eamd("test_ecap2.xls")$adh,4), data.frame(daysadh=0.0495, daysdose=0.0812, perdoses=0.1128, n=727))
expect_equal(round(process_eamd("test_ecap2.xls",formats_def = input_formats[4,])$adh,4), data.frame(daysadh=0.0495, daysdose=0.0812, perdoses=0.1128, n=727))
expect_equal(round(process_eamd("test_ecap2.xls",include_formats = c("ecap2xls"))$adh,4), data.frame(daysadh=0.0495, daysdose=0.0812, perdoses=0.1128, n=727))
expect_equal(round(process_eamd("test_ecap2.xls",exclude_formats = c("ecap1","ecap2","ecap3","simplemed","mems","mems2","adheretech","adheretechxls","ecap_old"))$adh,4), data.frame(daysadh=0.0495, daysdose=0.0812, perdoses=0.1128, n=727))
expect_equal(round(process_eamd("test_ecap2.xls",nonmonit=data.frame(start="2020-03-17",end="2020-03-19"))$adh,4), data.frame(daysadh=0.0495, daysdose=0.0812, perdoses=0.1128, n=727))
})