-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created tests for crowding and education
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ Imports: | |
stringr, | ||
tibble, | ||
utils | ||
Suggests: | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 |
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,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(cancerprof) | ||
|
||
test_check("cancerprof") |
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,13 @@ | ||
test_that("demo-crowding", { | ||
test_crowding1 <- demo_crowding("WA", "hsa", "All Races (includes Hispanic)") | ||
|
||
|
||
# object, length, dimensions, | ||
# ranges -ex: greater than 10 rows | ||
# errors | ||
# | ||
expect_type(test_crowding1, "list") | ||
|
||
|
||
#expect_error() - catches an expected error | ||
}) |
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 @@ | ||
test_that("demo-education", { | ||
test_education1 <- demo_education("wa", "county", "at least high school", "males") | ||
|
||
expect_type(test_education1, "list") | ||
|
||
|
||
expect_error( | ||
demo_education("wa", "county", "less than 9th grade", "males"), | ||
"For Less than 9th Grade, Race and Sex must be NULL" | ||
) | ||
expect_error( | ||
demo_education("wa", "county", "at least high school", "all races (includes hispanic", "females"), | ||
"For At Least High School, Race must be NULL and Sex must be NOT NULL" | ||
) | ||
}) |