test_that("reading empty file works (returns v2 dataframe)", {
d <- read_raw("test_data/empty_001.dat")
expect_s3_class(d, "data.frame")
expect_length(d, 5L)
expect_named(d, c("ts", "data", "sdata", "step", "rank"))
expect_type(d$ts, "double")
expect_type(d$data, "integer")
expect_type(d$sdata, "character")
expect_type(d$step, "character")
expect_type(d$rank, "integer")
expect_equal(nrow(d), 0L)
})
test_that("reading normal v1 file works", {
d <- read_raw("test_data/timing_992_7056_100.dat.xz")
expect_s3_class(d, "data.frame")
expect_length(d, 4L)
expect_named(d, c("ts", "data", "step", "rank"))
expect_type(d$ts, "double")
expect_type(d$step, "character")
expect_type(d$rank, "integer")
expect_type(d$data, "integer")
num_rows <- nrow(d)
expect_equal(num_rows, 2391L)
expect_equal(d$rank, rep(992L, num_rows))
})
test_that("reading normal v2 file works", {
d <- read_raw("test_data/v2-timing_3_8_1.dat.xz")
expect_s3_class(d, "data.frame")
expect_length(d, 5L)
expect_named(d, c("ts", "data", "sdata", "step", "rank"))
expect_type(d$ts, "double")
expect_type(d$step, "character")
expect_type(d$rank, "integer")
expect_type(d$data, "integer")
expect_type(d$sdata, "character")
num_rows <- nrow(d)
expect_equal(num_rows, 53L)
expect_equal(d$rank, rep(3L, num_rows))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.