Skip to content

Commit

Permalink
improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kingaa committed Dec 9, 2024
1 parent 2a13c1b commit 5202570
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
24 changes: 17 additions & 7 deletions tests/mif2_index.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ gompertz() -> gompertz
set.seed(1481104436)

gompertz |>
mif2(Nmif=4,Np=1000,
mif2(
Nmif=4,Np=1000,
.indices=seq.int(1000),
rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
cooling.fraction.50=0.5) |>
cooling.fraction.50=0.5
) |>
slot("indices") -> idx
stopifnot(
length(idx)==1000,
Expand All @@ -20,16 +22,24 @@ stopifnot(
set.seed(962724905)

gompertz |>
mif2(Nmif=4,Np=100,
mif2(
Nmif=4,Np=100,
.indices=as.list(seq.int(100)),
rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
cooling.fraction.50=0.5) |>
cooling.fraction.50=0.5
) |>
slot("indices") -> idx
stopifnot(
length(idx)==100,
class(idx)=="list"
)

try(mif2(gompertz,Nmif=1,Np=100,
.indices=1:5,rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
cooling.fraction=0.5))
try(
mif2(
gompertz,
Nmif=1,Np=100,
.indices=1:5,
rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
cooling.fraction.50=0.5
)
)
27 changes: 18 additions & 9 deletions tests/mif2_index.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ Type 'q()' to quit R.
> set.seed(1481104436)
>
> gompertz |>
+ mif2(Nmif=4,Np=1000,
+ mif2(
+ Nmif=4,Np=1000,
+ .indices=seq.int(1000),
+ rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
+ cooling.fraction.50=0.5) |>
+ cooling.fraction.50=0.5
+ ) |>
+ slot("indices") -> idx
> stopifnot(
+ length(idx)==1000,
Expand All @@ -39,19 +41,26 @@ Type 'q()' to quit R.
> set.seed(962724905)
>
> gompertz |>
+ mif2(Nmif=4,Np=100,
+ mif2(
+ Nmif=4,Np=100,
+ .indices=as.list(seq.int(100)),
+ rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
+ cooling.fraction.50=0.5) |>
+ cooling.fraction.50=0.5
+ ) |>
+ slot("indices") -> idx
> stopifnot(
+ length(idx)==100,
+ class(idx)=="list"
+ )
>
> try(mif2(gompertz,Nmif=1,Np=100,
+ .indices=1:5,rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
+ cooling.fraction=0.5))
Error : in 'mif2': The argument 'cooling.fraction'is not recognized.
Use the 'userdata' argument to supply extra objects to basic model components. See '?userdata'.
> try(
+ mif2(
+ gompertz,
+ Nmif=1,Np=100,
+ .indices=1:5,
+ rw.sd=rw_sd(r=0.02,K=0.02,sigma=0.02),
+ cooling.fraction.50=0.5
+ )
+ )
Error : in 'mif2': '.indices' has improper length.
>

0 comments on commit 5202570

Please sign in to comment.