Skip to content

Commit

Permalink
Merge branch 'FEAT-update-testing-fixtures' of https://github.com/PIF…
Browse files Browse the repository at this point in the history
…SCstockassessments/ss3diags into FEAT-update-testing-fixtures
  • Loading branch information
MOshima-PIFSC committed Jul 11, 2023
2 parents bad3ef0 + bc2ac72 commit 0214a34
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 64 deletions.
74 changes: 29 additions & 45 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,41 @@ Package: ss3diags
Title: Stock Synthesis Model Diagnostics for Intergated Stock Assessments
Version: 2.1.1
Date: 2023-06-07
Authors@R:
c(person(given = "Henning",
family = "Winker",
role = c("aut"),
email = "henning.winker@ec.europa.eu"),
person(given = "Felipe",
family = "Carvalho",
role = c("aut"),
email = "felipe.carvalho@noaa.gov"),
person(given = "Massimiliano",
family = "Cardinale",
role = c("aut"),
email = "massimiliano.cardinale@slu.se"),
person(given = "Laurence",
family = "Kell",
role = c("aut"),
email = "laurie@seaplusplus.co.uk"),
person(given = "Megumi",
family = "Oshima",
role = c("aut","cre"),
email = "megumi.oshima@noaa.gov"),
person(given = "Eric",
family = "Fletcher",
role = c("aut"),
email = "eric.fletcher@noaa")
)
Description: Compilation of diagnostic functions for Stock Synthesis models, which
developed for the manuscript "Using Model Diagnostics in Integrated Stock Assessments".
Authors@R: c(
person("Henning", "Winker", , "henning.winker@ec.europa.eu", role = "aut"),
person("Felipe", "Carvalho", , "felipe.carvalho@noaa.gov", role = "aut"),
person("Massimiliano", "Cardinale", , "massimiliano.cardinale@slu.se", role = "aut"),
person("Laurence", "Kell", , "laurie@seaplusplus.co.uk", role = "aut"),
person("Megumi", "Oshima", , "megumi.oshima@noaa.gov", role = c("aut", "cre")),
person("Eric", "Fletcher", , "eric.fletcher@noaa", role = "aut")
)
Description: Compilation of diagnostic functions for Stock Synthesis
models, which developed for the manuscript "Using Model Diagnostics in
Integrated Stock Assessments".
License: EUPL
URL: https://github.com/PIFSCstockassessments/ss3diags
BugReports: https://github.com/PIFSCstockassessments/ss3diags/issues
Depends:
R (>= 3.5)
R (>= 3.5)
Imports:
reshape2,
mvtnorm,
randtests,
r4ss(>= 1.46.1),
dplyr,
gplots,
lifecycle,
magrittr,
dplyr,
rlang,
lifecycle
Remotes: r4ss/r4ss#821
License: EUPL
mvtnorm,
r4ss(>= 1.46.1),
randtests,
reshape2,
rlang
Suggests:
knitr,
markdown,
rmarkdown,
testthat (>= 3.0.0)
Remotes:
r4ss/r4ss#821
Encoding: UTF-8
LazyData: True
LazyDataCompression: gzip
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Suggests:
testthat (>= 3.0.0),
knitr,
rmarkdown,
markdown
URL: https://github.com/PIFSCstockassessments/ss3diags
BugReports: https://github.com/PIFSCstockassessments/ss3diags/issues
3 changes: 2 additions & 1 deletion tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ if(file.exists(file.path(files_path, "ss"))|file.exists(file.path(files_path, "s
r4ss::retro(dir = run_tmp, oldsubdir = "", newsubdir = "retrospectives", years = 0:-3, show_in_console = FALSE)
# Creating retrospective object here so that multiple test files can access it without having to re-run retrospective for each test
retroModels <- r4ss::SSgetoutput(
dirvec = file.path(run_tmp, "retrospectives",
dirvec = file.path(
run_tmp, "retrospectives",
paste0("retro", 0:-3)
)
)
Expand Down
19 changes: 9 additions & 10 deletions tests/testthat/test-HCxval.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dir.create(path, showWarnings = FALSE)
## Hindcast plotting of indices

test_that("Hindcast plot is created for simple model indices", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
SSplotHCxval(retrosum.simple,
Expand Down Expand Up @@ -41,11 +41,11 @@ test_that("Hindcast plot is created for simple model indices", {
#### note: function was too complicated to replicate in the test script so used values directly from running the function. If code for calculations changes, the values will change and it will error or if the SS3 input files change, the values will be different and it will error.

test_that("MASE table gives expected values for simple model", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)

mase <- SSplotHCxval(retrosum.simple, add = T, verbose = F)

expect_match(mase$Index[1], "SURVEY1")
Expand All @@ -55,9 +55,8 @@ test_that("MASE table gives expected values for simple model", {


test_that("SSretroComps returns the correct comp data for simple model", {

skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
retro_comps <- SSretroComps(retroSimple)
Expand All @@ -72,8 +71,8 @@ test_that("SSretroComps returns the correct comp data for simple model", {


test_that("SSmase base.adj changes", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
ssmase <- SSmase(retrosum.simple, MAE.base.adj = 0.15)
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test-retro.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dir.create(path, showWarnings = FALSE)

## SSB
test_that("Retrospective plot is created for SSB (w/ deprecated parameters)", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
SSplotRetro(retrosum.simple,
Expand All @@ -23,8 +23,8 @@ test_that("Retrospective plot is created for SSB (w/ deprecated parameters)", {

## F
test_that("Retrospective plot is created for F (w/ deprecated parameters)", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
SSplotRetro(retrosum.simple,
Expand All @@ -41,8 +41,8 @@ test_that("Retrospective plot is created for F (w/ deprecated parameters)", {
## Mohn's Rho table using SShcbias function. It's the same code used in SSplotRetro to make the table.
## SSB
test_that("Mohn's Rho table is created for SSB", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
n <- retrosum.simple$n
Expand Down Expand Up @@ -70,8 +70,8 @@ test_that("Mohn's Rho table is created for SSB", {

## F
test_that("Mohn's Rho table is created for F", {
skip_if(
!exists("retrosum.simple") ,
skip_if(
!exists("retrosum.simple"),
message = "skipping test that requires SS3 executable"
)
n <- retrosum.simple$n
Expand Down

0 comments on commit 0214a34

Please sign in to comment.