test_that("RunningStats works", {
    set.seed(1)
    rs <- new(RunningStats, na_rm=TRUE)
    expect_no_error(show(rs))
    chunk <- runif(1000)
    rs$update(chunk)
    expect_equal(rs$get_count(), length(chunk))
    expect_equal(rs$get_mean(), mean(chunk))
    expect_equal(rs$get_min(), min(chunk))
    expect_equal(rs$get_max(), max(chunk))
    expect_equal(rs$get_var(), var(chunk))
    expect_equal(rs$get_sd(), sd(chunk))
    chunk2 <- runif(1000)
    rs$update(chunk2)
    expect_equal(rs$get_count(), 2000)
    chunk3 <- (c(rep(NA, 10), runif(10)))
    rs$update(chunk3)
    rs$returnCountAsInteger64 <- TRUE
    expect_equal(rs$get_count(), bit64::as.integer64(2010))
    expect_equal(rs$get_mean(), mean(c(chunk,chunk2,chunk3), na.rm=TRUE))
    rs$reset()
    expect_equal(rs$get_count(), bit64::as.integer64(0))
    expect_equal(rs$get_sum(), 0)
    expect_true(is.na(rs$get_mean()))
    expect_true(is.na(rs$get_var()))
    expect_true(is.na(rs$get_sd()))
    expect_equal(rs$get_min(), Inf)
    expect_equal(rs$get_max(), -Inf)
})
