Skip to content

Commit

Permalink
Update test_readGENEActiv.R
Browse files Browse the repository at this point in the history
to better cover timestamps
  • Loading branch information
vincentvanhees committed Mar 25, 2024
1 parent 7325e24 commit 7467aa1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/testthat/test_readGENEActiv.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test_that("GENEActivReader reads data from file correctly", {
expect_equal(cppdata$info$SampleRate, 85.7)
expect_equal(cppdata$info$numBlocksTotal, 222048)
expect_equal(length(cppdata$time), 300)
expect_equal(cppdata$time[300], 3488)
expect_equal(length(cppdata$x), 300)
expect_equal(length(cppdata$y), 300)
expect_equal(length(cppdata$z), 300)
Expand All @@ -21,7 +22,7 @@ test_that("GENEActivReader reads data from file correctly", {
test_that("readGENEActiv reads data from file correctly", {
old <- options(digits.secs = 3)
binfile = system.file("testfiles/GENEActiv_testfile.bin", package = "GGIRread")[1]
rdata = readGENEActiv(filename = binfile, start = 1, end = 1, desiredtz = "Europe/London")
rdata = readGENEActiv(filename = binfile, start = 1, end = 2, desiredtz = "Europe/London")

expect_equal(rdata$header$ReadOK, 1)
expect_equal(rdata$header$ReadErrors, 0)
Expand All @@ -31,12 +32,13 @@ test_that("readGENEActiv reads data from file correctly", {
expect_equal(rdata$header$RecordingID, "")
expect_equal(rdata$header$DeviceLocation, "")
expect_equal(rdata$header$DeviceModel, "1.1")
expect_equal(length(rdata$data$time), 300)
expect_equal(length(rdata$data$x), 300)
expect_equal(length(rdata$data$y), 300)
expect_equal(length(rdata$data$z), 300)
expect_equal(length(rdata$data$temperature), 300)
expect_equal(length(rdata$data$light), 300)
expect_equal(length(rdata$data$time), 600)
expect_equal(rdata$data$time[600], 1369905181)
expect_equal(length(rdata$data$x), 600)
expect_equal(length(rdata$data$y), 600)
expect_equal(length(rdata$data$z), 600)
expect_equal(length(rdata$data$temperature), 600)
expect_equal(length(rdata$data$light), 600)
expect_equal(rdata$data$temperature[1], 21.5)
expect_equal(rdata$data$light[2], 2.666667, tolerance = 4)
expect_equal(rdata$data$z[300], -0.80836403369903564453, tolerance = 15)
Expand Down

0 comments on commit 7467aa1

Please sign in to comment.