Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added minimal set of tests for new theta functionatlity.
Uses coveralls instead, so .codecov not needed.
- Loading branch information
Showing
5 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
context("Check as.theta") | ||
|
||
m <- 2 | ||
d <- 2 | ||
x <- list(m = m, | ||
d = d, | ||
pie = c(0.5, 0.5), | ||
mu = list(comp1 = rep(0,d), comp2 = rep(1,d)), | ||
sigma = list(comp1 = diag(d), comp2 = diag(d))) | ||
|
||
test_that("Check that as.theta works as intended", { | ||
expect_true(is.theta(as.theta(x))) | ||
suppressWarnings(expect_error(as.theta(x[-4]))) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
context("Check plot.theta") | ||
|
||
theta <- rtheta() # Create a random correctly formatted theta | ||
file <- tempfile(fileext = ".pdf") | ||
|
||
test_that("plotting theta objects works", { | ||
pdf(file) | ||
out <- plot(theta) | ||
dev.off() | ||
expect_true(is.list(out)) | ||
expect_identical(length(out), 3L) | ||
expect_identical(names(out), letters[24+0:2]) | ||
}) | ||
|
||
unlink(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
context("Check print.theta and summary.theta") | ||
|
||
theta <- rtheta() # Create a random correctly formatted theta | ||
|
||
test_that("Printing theta works", capture_output({ | ||
expect_output(print(theta)) | ||
expect_output(summary(theta)) | ||
expect_identical(theta, print(theta)) | ||
expect_identical(theta, summary(theta)) | ||
})) |