Skip to content

Commit

Permalink
add test check for warning if not matching year_start
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdalgarno committed Sep 4, 2024
1 parent d07cd4e commit b129e05
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions tests/testthat/test-predict-growth.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,18 @@
# limitations under the License.

test_that("bb_predict_growth works", {
x <- bboudata::bbourecruit_a
set.seed(101)
fit_recruitment <- bb_fit_recruitment(
data = x, nthin = 10, year_start = 5,
quiet = TRUE
)

x <- bboudata::bbousurv_a
set.seed(101)
fit_survival <- bb_fit_survival(
data = x, nthin = 10,
quiet = TRUE
)

predict <- bb_predict_growth(fit_survival, fit_recruitment)
predict <- bb_predict_growth(bboutools:::fit_survival, bboutools:::fit_recruitment)
expect_s3_class(predict, "tbl")
expect_snapshot_data(predict, "bb_predict_growth")
})

test_that("bb_predict_growth warning when different year start", {
survival <- fit_survival
recruitment <- fit_recruitment
.year_start_bboufit(survival) <- 5L
expect_warning(bb_predict_growth(survival, recruitment))
})

test_that("bb_predict_growth works with sex ratio", {
predict <- bb_predict_growth(bboutools:::fit_survival, bboutools:::fit_recruitment, sex_ratio = 0.7)
expect_s3_class(predict, "tbl")
Expand Down

0 comments on commit b129e05

Please sign in to comment.