Skip to content

Commit 310bf48

Browse files
committed
Add tests for cluster system
1 parent 5edd2d8 commit 310bf48

13 files changed

+196
-52
lines changed

tests/testthat/test_run_MC_CW_IRSL_LOC.R

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ test_that("basic run", {
2727
method = "par"
2828
))
2929

30+
## test cluster system
31+
expect_silent(run_MC_CW_IRSL_LOC(
32+
A = 0.12,
33+
times = 0:100,
34+
clusters = create_ClusterSystem(10),
35+
n_filled = 100,
36+
r = 1e-7,
37+
method = "seq"
38+
))
39+
3040
## check output
3141
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3242
expect_length(results_par, 2)

tests/testthat/test_run_MC_CW_IRSL_TUN.R

+12
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ test_that("basic run", {
3131
method = "par"
3232
))
3333

34+
##check cluster system
35+
expect_silent(run_MC_CW_IRSL_TUN(
36+
A = 0.8,
37+
rho = 1e-4,
38+
times = 0:100,
39+
clusters = create_ClusterSystem(10),
40+
N_e = 20,
41+
r_c = 0.05,
42+
delta.r = 0.1,
43+
method = "seq"
44+
))
45+
3446
## check output
3547
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3648
expect_length(results_par, 2)

tests/testthat/test_run_MC_CW_OSL_DELOC.R

+17-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_CW_OSL_DELOC")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_CW_OSL_DELOC(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_CW_OSL_DELOC(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_CW_OSL_DELOC(
@@ -18,7 +18,7 @@ test_that("basic run", {
1818
R = 1e-7,
1919
method = "seq"
2020
))
21-
21+
2222
results_par <- expect_silent(run_MC_CW_OSL_DELOC(
2323
A = 1e-3,
2424
times = 0:100,
@@ -28,11 +28,22 @@ test_that("basic run", {
2828
R = 1e-7,
2929
method = "par"
3030
))
31-
31+
32+
## check cluster system
33+
expect_silent(run_MC_CW_OSL_DELOC(
34+
A = 1e-3,
35+
times = 0:100,
36+
clusters = create_ClusterSystem(10),
37+
N_e = 2,
38+
n_filled = 100,
39+
R = 1e-7,
40+
method = "seq"
41+
))
42+
3243
## check output
3344
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3445
expect_length(results_par, 2)
3546
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
3647
expect_length(results_seq, 2)
37-
38-
})
48+
49+
})

tests/testthat/test_run_MC_ISO_DELOC.R

+18-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_ISO_DELOC")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_ISO_DELOC(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_ISO_DELOC(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_ISO_DELOC(
@@ -19,7 +19,7 @@ test_that("basic run", {
1919
R = 1e-7,
2020
method = "seq"
2121
))
22-
22+
2323
results_par <- expect_silent(run_MC_ISO_DELOC(
2424
E = 0.5,
2525
s = 1e8,
@@ -30,11 +30,23 @@ test_that("basic run", {
3030
R = 1e-7,
3131
method = "par"
3232
))
33-
33+
34+
## check cluster system
35+
expect_silent(run_MC_ISO_DELOC(
36+
E = 0.5,
37+
s = 1e8,
38+
`T` = 20,
39+
times = 0:100,
40+
clusters = create_ClusterSystem(10),
41+
n_filled = 100,
42+
R = 1e-7,
43+
method = "seq"
44+
))
45+
3446
## check output
3547
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3648
expect_length(results_par, 2)
3749
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
3850
expect_length(results_seq, 2)
39-
40-
})
51+
52+
})

tests/testthat/test_run_MC_ISO_LOC.R

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_ISOL_LOC")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_ISO_LOC(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_ISO_LOC(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_ISO_LOC(
@@ -18,7 +18,7 @@ test_that("basic run", {
1818
r = 1e-7,
1919
method = "seq"
2020
))
21-
21+
2222
results_par <- expect_silent(run_MC_ISO_LOC(
2323
s = 1e8,
2424
E = 0.5,
@@ -28,11 +28,22 @@ test_that("basic run", {
2828
r = 1e-7,
2929
method = "par"
3030
))
31-
31+
32+
##check cluster system
33+
expect_silent(run_MC_ISO_LOC(
34+
s = 1e8,
35+
E = 0.5,
36+
times = 0:100,
37+
clusters = create_ClusterSystem(10),
38+
n_filled = 100,
39+
r = 1e-7,
40+
method = "seq"
41+
))
42+
3243
## check output
3344
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3445
expect_length(results_par, 2)
3546
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
3647
expect_length(results_seq, 2)
37-
48+
3849
})

tests/testthat/test_run_MC_ISO_TUN.R

+20-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_ISO_TUN")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_ISO_TUN(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_ISO_TUN(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_ISO_TUN(
@@ -21,7 +21,7 @@ test_that("basic run", {
2121
delta.r = 0.5,
2222
method = "seq"
2323
))
24-
24+
2525
results_par <- expect_silent(run_MC_ISO_TUN(
2626
E = 0.5,
2727
s = 1e12,
@@ -34,11 +34,25 @@ test_that("basic run", {
3434
delta.r = 0.5,
3535
method = "par"
3636
))
37-
37+
38+
##check cluster system
39+
expect_silent(run_MC_ISO_TUN(
40+
E = 0.5,
41+
s = 1e12,
42+
`T` = 150,
43+
rho = 1e-4,
44+
times = 0:100,
45+
clusters = create_ClusterSystem(10),
46+
N_e = 2,
47+
r_c = 1e-4,
48+
delta.r = 0.5,
49+
method = "seq"
50+
))
51+
3852
## check output
3953
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
4054
expect_length(results_par, 2)
4155
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
4256
expect_length(results_seq, 2)
43-
44-
})
57+
58+
})

tests/testthat/test_run_MC_LM_OSL_DELOC.R

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ test_that("basic run", {
2727
method = "par"
2828
))
2929

30+
##check the cluster system
31+
expect_silent(run_MC_LM_OSL_DELOC(
32+
A = 0.12,
33+
times = 0:100,
34+
clusters = create_ClusterSystem(10),
35+
N_e = 20,
36+
R = 0.1,
37+
method = "seq"
38+
))
39+
3040
## check output
3141
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3242
expect_length(results_par, 2)

tests/testthat/test_run_MC_LM_OSL_LOC.R

+15-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_LM_OSL_LOC")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_LM_OSL_LOC(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_LM_OSL_LOC(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_LM_OSL_LOC(
@@ -17,7 +17,7 @@ test_that("basic run", {
1717
r = 1e-7,
1818
method = "seq"
1919
))
20-
20+
2121
results_par <- expect_silent(run_MC_LM_OSL_LOC(
2222
A = 1e-3,
2323
times = 0:100,
@@ -26,11 +26,21 @@ test_that("basic run", {
2626
r = 1e-7,
2727
method = "par"
2828
))
29-
29+
30+
## check the cluster system
31+
expect_silent(run_MC_LM_OSL_LOC(
32+
A = 1e-3,
33+
times = 0:100,
34+
clusters = create_ClusterSystem(10),
35+
n_filled = 100,
36+
r = 1e-7,
37+
method = "seq"
38+
))
39+
3040
## check output
3141
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3242
expect_length(results_par, 2)
3343
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
3444
expect_length(results_seq, 2)
35-
45+
3646
})

tests/testthat/test_run_MC_LM_OSL_TUN.R

+12
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ test_that("basic run", {
3131
method = "par"
3232
))
3333

34+
## create cluster system
35+
expect_silent(run_MC_LM_OSL_TUN(
36+
A = 1,
37+
rho = 1e-2,
38+
times = 0:1000,
39+
clusters = create_ClusterSystem(10),
40+
N_e = 20,
41+
r_c = 0.01,
42+
delta.r = 1e-1,
43+
method = "seq"
44+
))
45+
3446
## check output
3547
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3648
expect_length(results_par, 2)

tests/testthat/test_run_MC_TL_DELOC.R

+17-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ context("run_MC_TL_DELOC")
22

33
test_that("basic run", {
44
testthat::skip_on_cran()
5-
5+
66
##break the function on purpose
77
expect_error(run_MC_TL_DELOC(method = "error"), "Allowed keywords for 'method' are either 'par' or 'seq'!")
88
expect_error(run_MC_TL_DELOC(output = "error"), "Allowed keywords for 'output' are either 'signal' or 'remaining_e'!")
9-
9+
1010
## run function with basic setting
1111
## sequential and multicore
1212
results_seq <- expect_silent(run_MC_TL_DELOC(
@@ -18,7 +18,7 @@ test_that("basic run", {
1818
R = 1e-7,
1919
method = "seq"
2020
))
21-
21+
2222
results_par <- expect_silent(run_MC_TL_DELOC(
2323
E = 0.5,
2424
s = 1e8,
@@ -28,11 +28,22 @@ test_that("basic run", {
2828
R = 1e-7,
2929
method = "par"
3030
))
31-
31+
32+
##create cluster system
33+
expect_silent(run_MC_TL_DELOC(
34+
E = 0.5,
35+
s = 1e8,
36+
times = 0:100,
37+
clusters = create_ClusterSystem(10),
38+
n_filled = 100,
39+
R = 1e-7,
40+
method = "seq"
41+
))
42+
3243
## check output
3344
expect_s3_class(results_par, class = "RLumCarlo_Model_Output")
3445
expect_length(results_par, 2)
3546
expect_s3_class(results_seq, class = "RLumCarlo_Model_Output")
3647
expect_length(results_seq, 2)
37-
38-
})
48+
49+
})

0 commit comments

Comments
 (0)