Skip to content

Commit ba06717

Browse files
committed
cleanup
1 parent e01c4b7 commit ba06717

File tree

1 file changed

+32
-35
lines changed

1 file changed

+32
-35
lines changed

tests/testthat/test-extract_df.R

+32-35
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
1-
test_that("extract_df() returns a dataframe w the correct number of sims",
2-
{
3-
nyrs_test <- 100
4-
xx <- projections(
5-
NOut = 3, ConstantRateBycatch = list(Rate = 0.01, CV = 0.3),
6-
InitDepl = 0.8,
7-
lh.params = list(
8-
S0 = 0.944, S1plus = 0.99,
9-
K1plus = 9000, AgeMat = 18, nages = 20, z = 2.39, lambdaMax = 1.02
10-
),
11-
nyears = nyrs_test, obs_CV = 0
12-
)
13-
yy <- extract_df(xx)
14-
expect_true(colnames(yy)[nyrs_test+1]=="sim")
15-
})
1+
test_that("extract_df() returns a dataframe w the correct number of sims", {
2+
nyrs_test <- 100
3+
xx <- projections(
4+
NOut = 3, ConstantRateBycatch = list(Rate = 0.01, CV = 0.3),
5+
InitDepl = 0.8,
6+
lh.params = list(
7+
S0 = 0.944, S1plus = 0.99,
8+
K1plus = 9000, AgeMat = 18, nages = 20, z = 2.39, lambdaMax = 1.02
9+
),
10+
nyears = nyrs_test, obs_CV = 0
11+
)
12+
yy <- extract_df(xx)
13+
expect_true(colnames(yy)[nyrs_test + 1] == "sim")
14+
})
1615

17-
test_that("extract_df() has all needed columns from the projections",
18-
{
19-
20-
xx <- projections(
21-
NOut = 3, ConstantRateBycatch = list(Rate = 0.01, CV = 0.3),
22-
InitDepl = 0.8,
23-
lh.params = list(
24-
S0 = 0.944, S1plus = 0.99,
25-
K1plus = 9000, AgeMat = 18, nages = 20, z = 2.39, lambdaMax = 1.02
26-
),
27-
nyears = 50, obs_CV = 0
28-
)
29-
yy <- extract_df(xx)
30-
expect_true("sim" %in% colnames(yy) &
31-
"Bycatch_Catch" %in% colnames(yy) &
32-
"Bycatch_CV" %in% colnames(yy) &
33-
"Bycatch_Rate" %in% colnames(yy) &
34-
"Bycatch_Rate_CV" %in% colnames(yy) &
35-
"InitDepl" %in% colnames(yy))
36-
})
16+
test_that("extract_df() has all needed columns from the projections", {
17+
xx <- projections(
18+
NOut = 3, ConstantRateBycatch = list(Rate = 0.01, CV = 0.3),
19+
InitDepl = 0.8,
20+
lh.params = list(
21+
S0 = 0.944, S1plus = 0.99,
22+
K1plus = 9000, AgeMat = 18, nages = 20, z = 2.39, lambdaMax = 1.02
23+
),
24+
nyears = 50, obs_CV = 0
25+
)
26+
yy <- extract_df(xx)
27+
expect_true("sim" %in% colnames(yy) &
28+
"Bycatch_Catch" %in% colnames(yy) &
29+
"Bycatch_CV" %in% colnames(yy) &
30+
"Bycatch_Rate" %in% colnames(yy) &
31+
"Bycatch_Rate_CV" %in% colnames(yy) &
32+
"InitDepl" %in% colnames(yy))
33+
})

0 commit comments

Comments
 (0)