knitr::opts_chunk$set( error = TRUE, collapse = TRUE, comment = "#>", out.width = "100%" )
library(testthat) library(jeksterslabRboot) context("Test eval.")
result <- ci_eval( ci = c(1, 3), thetahat = 2, theta = 2 )
Confidence interval contain zero.
test_that("TRUE", { expect_true( zero_hit( lo = -1, up = 1 ), theta_hit( lo = -1, theta = 0, up = 1 ) ) })
Confidence interval does not contain zero.
test_that("FALSE", { expect_false( zero_hit( lo = 1, up = 2 ), theta_hit( lo = 1, theta = 0, up = 2 ) ) })
test_that("1", { expect_equal( len( lo = 1, up = 2 ), shape( lo = -1, thetahat = 0, up = 1 ), 1 ) })
ci_eval
test_that("zero_hit", { expect_false( as.logical(result[1]) ) })
test_that("theta_hit", { expect_true( as.logical(result[2]) ) })
test_that("len", { expect_equivalent( result[3], 2 ) })
test_that("shape", { expect_equivalent( result[4], 1 ) })
test_that("message", { expect_message( ci_eval( ci = c(0, 1, 2, 3), thetahat = 2, theta = 2, label = "wrong length" ) ) })
test_that("error", { expect_error( ci_eval( ci = 1, thetahat = 2, theta = 2 ) ) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.