-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from Merck/test-style
Remove `library()` calls from tests
- Loading branch information
Showing
8 changed files
with
18 additions
and
48 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 |
---|---|---|
@@ -1,12 +1,4 @@ | ||
library(testthat) | ||
library(metalite) | ||
|
||
ae_summary <- function(...) { | ||
paste("results of", deparse(match.call(), nlines = 1)) | ||
} | ||
ae_specific <- function(...) { | ||
paste("results of", deparse(match.call(), nlines = 1)) | ||
} | ||
|
||
|
||
test_check("metalite") |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Create two example functions | ||
ae_summary <- function(...) { | ||
ae_summary <<- function(...) { | ||
paste("results of", deparse(match.call(), nlines = 1)) | ||
} | ||
ae_specific <- function(...) { | ||
|
||
ae_specific <<- function(...) { | ||
paste("results of", deparse(match.call(), nlines = 1)) | ||
} |
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 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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
library(r2rtf) | ||
|
||
|
||
test_that("meta_adam testing", { | ||
test <- meta_adam( | ||
population = r2rtf::r2rtf_adsl, | ||
|
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 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 |
---|---|---|
@@ -1,47 +1,45 @@ | ||
library(dplyr) | ||
|
||
test_that("variable 'RACE' checking", { | ||
expect_equal(names(meta_example() |> meta_split("RACE")), sort(unique(meta_example()$data_population$RACE))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = WHITE' checking in data_population", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_population %>% filter(RACE == "WHITE") | ||
z <- meta_example()$data_population %>% dplyr::filter(RACE == "WHITE") | ||
expect_equal(x$WHITE$data_population$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = BLACK OR AFRICAN AMERICAN' checking in data_population", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_population %>% filter(RACE == "BLACK OR AFRICAN AMERICAN") | ||
z <- meta_example()$data_population %>% dplyr::filter(RACE == "BLACK OR AFRICAN AMERICAN") | ||
expect_equal(x$`BLACK OR AFRICAN AMERICAN`$data_population$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = AMERICAN INDIAN OR ALASKA NATIVE' checking in data_population", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_population %>% filter(RACE == "AMERICAN INDIAN OR ALASKA NATIVE") | ||
z <- meta_example()$data_population %>% dplyr::filter(RACE == "AMERICAN INDIAN OR ALASKA NATIVE") | ||
expect_equal(x$`AMERICAN INDIAN OR ALASKA NATIVE`$data_population$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = WHITE' checking in data_observation", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_observation %>% filter(RACE == "WHITE") | ||
z <- meta_example()$data_observation %>% dplyr::filter(RACE == "WHITE") | ||
expect_equal(x$WHITE$data_observation$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = BLACK OR AFRICAN AMERICAN' checking in data_observation", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_observation %>% filter(RACE == "BLACK OR AFRICAN AMERICAN") | ||
z <- meta_example()$data_observation %>% dplyr::filter(RACE == "BLACK OR AFRICAN AMERICAN") | ||
expect_equal(x$`BLACK OR AFRICAN AMERICAN`$data_observation$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) | ||
|
||
|
||
test_that("variable 'RACE = AMERICAN INDIAN OR ALASKA NATIVE' checking in data_observation", { | ||
x <- meta_example() |> meta_split("RACE") | ||
z <- meta_example()$data_observation %>% filter(RACE == "AMERICAN INDIAN OR ALASKA NATIVE") | ||
z <- meta_example()$data_observation %>% dplyr::filter(RACE == "AMERICAN INDIAN OR ALASKA NATIVE") | ||
expect_equal(x$`AMERICAN INDIAN OR ALASKA NATIVE`$data_observation$USUBJID, unlist(as.list(z$USUBJID))) | ||
}) |
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 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