-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
493 additions
and
20 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 |
---|---|---|
|
@@ -9,3 +9,4 @@ cran-comments.md | |
^docs$ | ||
^pkgdown$ | ||
^\.github$ | ||
^codecov\.yml$ |
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,49 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true |
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,50 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::covr | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
covr::codecov( | ||
quiet = FALSE, | ||
clean = FALSE, | ||
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
) | ||
shell: Rscript {0} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
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 |
---|---|---|
|
@@ -12,13 +12,15 @@ Authors@R: c( | |
person("NHS-R community", email = "[email protected]", role = "cph") | ||
) | ||
Maintainer: Tom Smith <[email protected]> | ||
Description: R-package to implement the waiting list management approach described in this paper by Fong et al 2022 | ||
Description: R-package to implement the waiting list management approach described in this paper by Fong et al 2022. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 | ||
Suggests: | ||
knitr, | ||
rmarkdown | ||
rmarkdown, | ||
testthat (>= 3.0.0) | ||
VignetteBuilder: knitr | ||
URL: https://nhs-r-community.github.io/NHSRwaitinglist/ | ||
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
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
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 @@ | ||
comment: false | ||
|
||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,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(NHSRwaitinglist) | ||
|
||
test_check("NHSRwaitinglist") |
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,54 @@ | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("function catches null values and reports error", { | ||
# em <- "target_wait(): no error message when function is run with no inputs." | ||
# expect_error(target_wait(), em) | ||
# }) | ||
# | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("function catches mismatched input lengths", { | ||
# em <- "target_wait(): no error message when functions inputs are of different length." | ||
# expect_error(target_wait(c(22,25,26), c(4, 3)), em) | ||
# }) | ||
# | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("it returns an error if either input aren't numeric", { | ||
# in1 <- Sys.Date() | ||
# in2 <- 4 | ||
# | ||
# em <- "target_wait(): all inputs must be numeric." | ||
# expect_error(target_wait(in1, in2), em) | ||
# }) | ||
|
||
test_that("it returns an expected result with fixed single values, against arithmetic", { | ||
em <- "average_wait(): arithmetic error with single value inputs." | ||
expect_equal(average_wait(52, 4), 52/4) | ||
}) | ||
|
||
test_that("it returns an expected result with fixed single values", { | ||
em <- "average_wait(): arithmetic error with single value inputs." | ||
expect_equal(average_wait(52, 4), 13) | ||
}) | ||
|
||
|
||
|
||
test_that("it returns an expected result with vector of fixed values", { | ||
em <- "average_wait(): aritmetic error with vector of values as inputs." | ||
expect_equal( | ||
average_wait( | ||
c(35, 30, 52), | ||
c(4,4,6) | ||
) | ||
, c(8.75, 7.5, 8.6666667) | ||
) | ||
}) | ||
|
||
|
||
test_that("it returns the same length output as provided on input", { | ||
n <- round(runif(1, 0,30)) | ||
in1 <- rnorm(n = n, 50, 20) | ||
in2 <- rnorm(n = n, 4, 2) | ||
em <- "target_queue_size(): output vector length != input vector length." | ||
expect_length(average_wait(in1, in2), length(in1)) | ||
}) | ||
|
||
|
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,53 @@ | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("function catches null values and reports error", { | ||
# em <- "queue_load(): no error message when function is run with no inputs." | ||
# expect_error(queue_load(), em) | ||
# }) | ||
# | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("function catches mismatched input lengths", { | ||
# em <- "queue_load(): no error message when functions inputs are of different length." | ||
# expect_error(queue_load(c(22,25,26), c(15, 20)), em) | ||
# }) | ||
# | ||
# # Anticipated test from the error handling that Matt Dray is drafting | ||
# test_that("it returns an error if either input aren't numeric", { | ||
# in1 <- Sys.Date() | ||
# in2 <- 27 | ||
# | ||
# em <- "queue_load(): all inputs must be numeric." | ||
# expect_error(queue_load(in1, in2), em) | ||
# }) | ||
|
||
test_that("it returns an expected result with fixed single values, against arithmetic", { | ||
em <- "queue_load(): arithmetic error with single value inputs." | ||
expect_equal(queue_load(30, 27), 30/27) | ||
}) | ||
|
||
test_that("it returns an expected result with fixed single values", { | ||
em <- "queue_load(): arithmetic error with single value inputs." | ||
expect_equal(queue_load(30, 27), 1.11111111) | ||
}) | ||
|
||
|
||
test_that("it returns an expected result with vector of fixed values", { | ||
em <- "queue_load(): arithmetic error with vector of values as inputs." | ||
expect_equal( | ||
queue_load( | ||
c(35, 30, 52), | ||
c(27,25,42) | ||
) | ||
, c( 1.2962963, 1.2, 1.23809524) | ||
) | ||
}) | ||
|
||
|
||
test_that("it returns the same length output as provided on input", { | ||
n <- round(runif(1, 0,30)) | ||
in1 <- rnorm(n = n, 50, 20) | ||
in2 <- rnorm(n = n, 30, 5) | ||
em <- "target_queue_size(): output vector length != input vector length." | ||
expect_length(queue_load(in1, in2), length(in1)) | ||
}) | ||
|
||
|
Oops, something went wrong.