Skip to content

Commit

Permalink
Tidying unit test files for pilot3utils - lintr.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Devine committed Feb 14, 2024
1 parent a77407a commit df6246b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion R/example.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ testthat_example <- function(filename) {
mustWork = TRUE
)
}

2 changes: 0 additions & 2 deletions tests/testthat.r
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@
library(testthat)
library(pilot3utils)


test_check("pilot3utils")

2 changes: 0 additions & 2 deletions tests/testthat/test-adam_functions.r
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ test_that("format_sitegr1 works", {
expect_equal(format_sitegr1("715"), "900")
expect_equal(format_sitegr1("717"), "900")
expect_length(format_sitegr1("717"), 1)

})

test_that("round_sas works", {
expect_equal(round_sas(10.56, digits = 0), 11)
expect_equal(round_sas(9.06, digits = 0), 9)
expect_equal(round_sas(-5.6, digits = 0), -6)
expect_length(round_sas(10.56, digits = 0), 1)

})
2 changes: 0 additions & 2 deletions tests/testthat/test-fmt.r
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ test_that("fmt_pval works", {
expect_equal(fmt_pval(0.52, digits = 3), " 0.520")
expect_length(fmt_pval(0.445, digits = 1), 1)
expect_length(fmt_pval(0.445, digits = 4), 1)

})

test_that("fmt_ci works", {
expect_equal(fmt_ci(1, -0.25, 1.32), " 1.00 (-0.25, 1.32)")
expect_equal(fmt_ci(1.5, -0.04, 1.09), " 1.50 (-0.04, 1.09)")
expect_equal(fmt_ci(-2.5, -0.09, 2.07), "-2.50 (-0.09, 2.07)")
expect_length(fmt_ci(1, -0.25, 1.32), 1)

})
2 changes: 1 addition & 1 deletion tests/testthat/test-helpers.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("pad_row works", {
"TEST01", "01-701-1015", "SYSBP", "Systolic Blood Pressure (mmHg)", "WEEK 2",
"TEST01", "01-701-1028", "DIABP", "Diastolic Blood Pressure (mmHg)", "BASELINE",
"TEST01", "01-701-1028", "SYSBP", "Systolic Blood Pressure (mmHg)", "BASELINE"
)
)
expect_equal(nrow(pad_row(.data)), 7)
expect_equal(nrow(pad_row(.data, n = 3)), 9)
expect_equal(nrow(pad_row(.data, n = 5)), 11)
Expand Down

0 comments on commit df6246b

Please sign in to comment.