1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-12 06:21:57 +02:00

extra unit tests

This commit is contained in:
2018-07-02 09:34:20 +02:00
parent 2c8d4cb8bf
commit a1acb2f3ac
4 changed files with 53 additions and 5 deletions

View File

@ -2,6 +2,8 @@ context("g.test.R")
test_that("G-test works", {
# GOODNESS-OF-FIT
# example 1: clearfield rice vs. red rice
x <- c(772, 1611, 737)
x.expected <- vector2ratio(x, ratio = "1:2:1")
@ -16,4 +18,13 @@ test_that("G-test works", {
expected = 0.01787343,
tolerance = 0.00000001)
# INDEPENDENCE
# this should always yield a p value of around 0
x <- matrix(data = round(runif(4) * 100000, 0),
ncol = 2,
byrow = TRUE)
expect_lt(g.test(x),
0.0001)
})