Last updated on 2023-02-09 06:55:31 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.5.0 | 8.04 | 153.47 | 161.51 | OK | |
r-devel-linux-x86_64-debian-gcc | 0.5.0 | 6.81 | 114.23 | 121.04 | OK | |
r-devel-linux-x86_64-fedora-clang | 0.5.0 | 204.46 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.5.0 | 210.78 | OK | |||
r-devel-windows-x86_64 | 0.5.0 | 41.00 | 239.00 | 280.00 | ERROR | |
r-patched-linux-x86_64 | 0.5.0 | 8.34 | 147.94 | 156.28 | OK | |
r-release-linux-x86_64 | 0.5.0 | 5.67 | 141.32 | 146.99 | OK | |
r-release-macos-arm64 | 0.5.0 | 77.00 | OK | |||
r-release-macos-x86_64 | 0.5.0 | 106.00 | OK | |||
r-release-windows-x86_64 | 0.5.0 | 47.00 | 241.00 | 288.00 | OK | |
r-oldrel-macos-arm64 | 0.5.0 | 84.00 | OK | |||
r-oldrel-macos-x86_64 | 0.5.0 | 111.00 | OK | |||
r-oldrel-windows-ix86+x86_64 | 0.5.0 | 19.00 | 223.00 | 242.00 | ERROR |
Version: 0.5.0
Check: tests
Result: ERROR
Running 'Test-class.R' [46s]
Running 'check.R' [17s]
Running 'cli_fcn.R' [3s]
Running 'db_state.R' [5s]
Running 'evaluate_expr.R' [3s]
Running 'one-test.R' [6s]
Running 'progress.R' [3s]
Running 'test_db.R' [6s]
Running 'test_plans.R' [5s]
Running 'utils.R' [3s]
Running 'zzz.onLoad.R' [8s]
Running the tests in 'tests/check.R' failed.
Complete output:
> check <- future.tests::check
>
> message("*** check() ...")
*** check() ...
>
> ## Validate options
> check()
Usage: Rscript -e future.tests::check --args <options>
Options:
--help Display this help
--test-timeout=<seconds> Sets per-test timeout in seconds
--test-tags=<tags> Comma-separated tags specifying tests to include
--test-plan=<plan> Future plan to test against
--session-info Output session information at the end
Example:
Rscript -e future.tests::check --args --help
Rscript -e future.tests::check --args --test-plan=sequential
Rscript -e future.tests::check --args --test-plan=multisession,workers=4
> check(.args = c("--debug", "--help"))
Usage: Rscript -e future.tests::check --args <options>
Options:
--help Display this help
--test-timeout=<seconds> Sets per-test timeout in seconds
--test-tags=<tags> Comma-separated tags specifying tests to include
--test-plan=<plan> Future plan to test against
--session-info Output session information at the end
Example:
Rscript -e future.tests::check --args --help
Rscript -e future.tests::check --args --test-plan=sequential
Rscript -e future.tests::check --args --test-plan=multisession,workers=4
>
> ## Run checks with plan(sequential)
> results <- check(plan = "sequential", session_info = TRUE, debug = TRUE)
── Settings ────────────────────────────────────────────────────────────────────
- future.tests version : 0.5.0
- R_FUTURE_TESTS_ROOT :
- Option 'future.tests.root': NULL
- Default test set folder : D:/RCompile/CRANpkg/lib/4.3/future.tests/test-db
- Max number of workers : 2
- Timeout : N/A
── Running 51 test sets with plan(sequential) ──────────────────────────────────
ℹ Backend package: future 1.31.0
- future() - conditions
\ future() - conditions (1/1)
✔ future() - conditions (1 test) (154ms)
- %<-% - conditions
\ %<-% - conditions (1/1)
✔ %<-% - conditions (1 test) (174ms)
- future() - muffle conditions
\ future() - muffle conditions (1/1)
✔ future() - muffle conditions (1 test) (80ms)
- Argument '...'
\ Argument '...' (1/1)
✔ Argument '...' (1 test) (19ms)
- Argument '...' from parent function
\ Argument '...' from parent function (1/1)
✔ Argument '...' from parent function (1 test) (15ms)
- Argument '...' - non existing
\ Argument '...' - non existing (1/1)
✔ Argument '...' - non existing (1 test) (15ms)
- Argument '...' - exception
\ Argument '...' - exception (1/1)
✔ Argument '...' - exception (1 test) (18ms)
- Early signaling of errors
\ Early signaling of errors (1/4)
| Early signaling of errors (2/4)
/ Early signaling of errors (3/4)
- Early signaling of errors (4/4)
✔ Early signaling of errors (4 tests) (41ms)
- Early signaling of warnings
\ Early signaling of warnings (1/4)
| Early signaling of warnings (2/4)
/ Early signaling of warnings (3/4)
- Early signaling of warnings (4/4)
✔ Early signaling of warnings (4 tests) (44ms)
- Early signaling of messages
\ Early signaling of messages (1/4)
| Early signaling of messages (2/4)
/ Early signaling of messages (3/4)
- Early signaling of messages (4/4)
✔ Early signaling of messages (4 tests) (52ms)
- futureAssign() - lazy evaluation
\ futureAssign() - lazy evaluation (1/2)
| futureAssign() - lazy evaluation (2/2)
✔ futureAssign() - lazy evaluation (2 tests) (22ms)
- futureAssign() - potential task name clashes
\ futureAssign() - potential task name clashes (1/1)
✔ futureAssign() - potential task name clashes (1 test) (21ms)
- futureAssign() - global variables with and without lazy evaluation
\ futureAssign() - global variables with and without lazy evaluation (1/2)
| futureAssign() - global variables with and without lazy evaluation (2/2)
✔ futureAssign() - global variables with and without lazy evaluation (2 tests) (54ms)
- futureAssign() - lazy evaluation via disposable option
\ futureAssign() - lazy evaluation via disposable option (1/2)
| futureAssign() - lazy evaluation via disposable option (2/2)
✔ futureAssign() - lazy evaluation via disposable option (2 tests) (27ms)
- %<-% - local evaluation
\ %<-% - local evaluation (1/2)
| %<-% - local evaluation (2/2)
✔ %<-% - local evaluation (2 tests) (32ms)
- %<-% - local evaluation & global variable
\ %<-% - local evaluation & global variable (1/2)
| %<-% - local evaluation & global variable (2/2)
✔ %<-% - local evaluation & global variable (2 tests) (27ms)
- %<-% - errors
\ %<-% - errors (1/2)
| %<-% - errors (2/2)
✔ %<-% - errors (2 tests) (30ms)
- %<-% - errors and listenv
\ %<-% - errors and listenv (1/2)
| %<-% - errors and listenv (2/2)
✔ %<-% - errors and listenv (2 tests) (101ms)
- %<-% & %->%
\ %<-% & %->% (1/2)
| %<-% & %->% (2/2)
✖ %<-% & %->% (2 tests) (24ms)
✔ lazy=FALSE
✖ lazy=TRUE
- %<-% - nested
\ %<-% - nested (1/1)
✔ %<-% - nested (1 test) (58ms)
- futureCall()
\ futureCall() (1/4)
| futureCall() (2/4)
/ futureCall() (3/4)
- futureCall() (4/4)
✔ futureCall() (4 tests) (148ms)
- futureCall() - globals = list(a = 3)
\ futureCall() - globals = list(a = 3) (1/2)
| futureCall() - globals = list(a = 3) (2/2)
✔ futureCall() - globals = list(a = 3) (2 tests) (30ms)
- futureCall() - globals = "a"
\ futureCall() - globals = "a" (1/2)
| futureCall() - globals = "a" (2/2)
✔ futureCall() - globals = "a" (2 tests) (20ms)
- future() - rm() a global variable
\ future() - rm() a global variable (1/2)
| future() - rm() a global variable (2/2)
✔ future() - rm() a global variable (2 tests) (28ms)
- future() - non-exported package objects
\ future() - non-exported package objects (1/1)
✔ future() - non-exported package objects (1 test) (100ms)
- future() - NSE '...'
\ future() - NSE '...' (1/1)
✔ future() - NSE '...' (1 test) (19ms)
- resolved() on lazy futures
\ resolved() on lazy futures (1/1)
✔ resolved() on lazy futures (1 test) (9ms)
- demo("mandelbrot", package = "future")
\ demo("mandelbrot", package = "future") (1/2)
| demo("mandelbrot", package = "future") (2/2)
✔ demo("mandelbrot", package = "future") (2 tests) (829ms)
- nbrOfWorkers()
\ nbrOfWorkers() (1/1)
✔ nbrOfWorkers() (1 test) (2ms)
- future() - preserve R options
\ future() - preserve R options (1/1)
✔ future() - preserve R options (1 test) (211ms)
- future() - preserve R options
\ future() - preserve R options (1/1)
✔ future() - preserve R options (1 test) (143ms)
- plan()
\ plan() (1/1)
✔ plan() (1 test) (2ms)
- plan() - workers=<numeric>
\ plan() - workers=<numeric> (1/1)
✔ plan() - workers=<numeric> (1 test) (1ms)
- plan() - workers=<function>
\ plan() - workers=<function> (1/1)
✔ plan() - workers=<function> (1 test) (2ms)
- plan() - workers=<invalid>
\ plan() - workers=<invalid> (1/1)
✔ plan() - workers=<invalid> (1 test) (1ms)
- resolve()
\ resolve() (1/8)
| resolve() (2/8)
/ resolve() (3/8)
- resolve() (4/8)
\ resolve() (5/8)
| resolve() (6/8)
/ resolve() (7/8)
- resolve() (8/8)
✔ resolve() (8 tests) (4.2s)
- resolve() - run-time exception
\ resolve() - run-time exception (1/8)
| resolve() - run-time exception (2/8)
/ resolve() - run-time exception (3/8)
- resolve() - run-time exception (4/8)
\ resolve() - run-time exception (5/8)
| resolve() - run-time exception (6/8)
/ resolve() - run-time exception (7/8)
- resolve() - run-time exception (8/8)
✔ resolve() - run-time exception (8 tests) (93ms)
- resolve(<list of futures and values>)
\ resolve(<list of futures and values>) (1/2)
| resolve(<list of futures and values>) (2/2)
✔ resolve(<list of futures and values>) (2 tests) (29ms)
- resolve(<list of futures>)
\ resolve(<list of futures>) (1/2)
| resolve(<list of futures>) (2/2)
✔ resolve(<list of futures>) (2 tests) (39ms)
- resolve(<named matrix list of futures and values>) - time ordering
\ resolve(<named matrix list of futures and values>) - time ordering (1/1)
✔ resolve(<named matrix list of futures and values>) - time ordering (1 test) (529ms)
- resolved() - assert non-blocking while launching lazy futures
\ resolved() - assert non-blocking while launching lazy futures (1/1)
✔ resolved() - assert non-blocking while launching lazy futures (1 test) (3.1s)
- Random Number Generation (RNG) - seeds and preserving RNGkind
\ Random Number Generation (RNG) - seeds and preserving RNGkind (1/1)
✔ Random Number Generation (RNG) - seeds and preserving RNGkind (1 test) (11ms)
- Random Number Generation (RNG) - future
\ Random Number Generation (RNG) - future (1/2)
| Random Number Generation (RNG) - future (2/2)
✔ Random Number Generation (RNG) - future (2 tests) (259ms)
- Random Number Generation (RNG) - %<-%
\ Random Number Generation (RNG) - %<-% (1/2)
| Random Number Generation (RNG) - %<-% (2/2)
✔ Random Number Generation (RNG) - %<-% (2 tests) (199ms)
- Orchestration Stability - future() does not update RNG state
\ Orchestration Stability - future() does not update RNG state (1/1)
✔ Orchestration Stability - future() does not update RNG state (1 test) (16ms)
- Orchestration Stability - run() does not update RNG state
\ Orchestration Stability - run() does not update RNG state (1/1)
✔ Orchestration Stability - run() does not update RNG state (1 test) (14ms)
- Orchestration Stability - result() does not update RNG state
\ Orchestration Stability - result() does not update RNG state (1/1)
✔ Orchestration Stability - result() does not update RNG state (1 test) (21ms)
- Orchestration Stability - value() does not update RNG state
\ Orchestration Stability - value() does not update RNG state (1/1)
✔ Orchestration Stability - value() does not update RNG state (1 test) (17ms)
- future() - standard output
\ future() - standard output (1/2)
| future() - standard output (2/2)
✔ future() - standard output (2 tests) (80ms)
- %<-% - standard output
\ %<-% - standard output (1/2)
| %<-% - standard output (2/2)
✔ %<-% - standard output (2 tests) (55ms)
- value() - visibility
\ value() - visibility (1/1)
✔ value() - visibility (1 test) (20ms)
Number of tests: 95
Duration: 12.9s
Results: 1 error ✖ | 0 timeouts ✔
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R Under development (unstable) (2023-02-07 r83776 ucrt)
os Windows Server 2022 x64 (build 20348)
system x86_64, mingw32
ui RTerm
language C
collate C
ctype German_Germany.utf8
tz Europe/Berlin
date 2023-02-08
pandoc 2.14.0.1 @ C:\\PROGRA~1\\Pandoc\\pandoc.exe
─ Packages ───────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
P bit * 4.0.5 2022-11-15 [?] CRAN (R 4.3.0)
P cli 3.6.0 2023-01-09 [?] CRAN (R 4.3.0)
P codetools 0.2-19 2023-02-01 [?] CRAN (R 4.3.0)
P crayon 1.5.2 2022-09-29 [?] CRAN (R 4.3.0)
P data.table 1.14.6 2022-11-16 [?] CRAN (R 4.3.0)
P digest 0.6.31 2022-12-11 [?] CRAN (R 4.3.0)
P ff * 4.0.9 2023-01-25 [?] CRAN (R 4.3.0)
P future * 1.31.0 2023-02-01 [?] CRAN (R 4.3.0)
P future.tests 0.5.0 2022-12-16 [?] CRAN (R 4.3.0)
P globals 0.16.2 2022-11-21 [?] CRAN (R 4.3.0)
P listenv 0.9.0 2022-12-16 [?] CRAN (R 4.3.0)
P parallelly 1.34.0 2023-01-13 [?] CRAN (R 4.3.0)
P prettyunits 1.1.1 2020-01-24 [?] CRAN (R 4.3.0)
P sessioninfo 1.2.2 2021-12-06 [?] CRAN (R 4.3.0)
[1] D:/temp/RtmpopHxdd/RLIBS_1d6cc38889c3
[2] D:/RCompile/recent/R/library
P ── Loaded and on-disk path mismatch.
──────────────────────────────────────────────────────────────────────────────
[[1]]
[[1]][[1]]
[[1]][[1]][[1]]
TestResult:
- Test:
- Title: 'future() - conditions'
- Tags: 'future', 'conditions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: truth <- captureConditions({
17: message("hello")
18: warning("whoops")
19: message("world")
20: })
21: f <- future({
22: print(1:3)
23: message("hello")
24: warning("whoops")
25: message("world")
26: 42L
27: })
28: r <- result(f)
29: str(r)
30: stopifnot(value(f) == 42L)
31: conditions <- r$conditions
32: stopifnot(is.list(conditions), length(conditions) == 3L)
33: conditions <- lapply(conditions, FUN = function(c) c$condition)
34: for (kk in seq_along(conditions)) {
35: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
36: identical(conditions[[kk]]$message, truth[[kk]]$message))
37: }
38: conditions <- captureConditions(value(f))
39: stopifnot(is.list(conditions), length(conditions) == 3L)
40: for (kk in seq_along(conditions)) {
41: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
42: identical(conditions[[kk]]$message, truth[[kk]]$message))
43: }
44: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'List of 9'
2: ' $ value : int 42'
3: ' $ visible : logi TRUE'
4: ' $ stdout : chr "[1] 1 2 3\n"'
5: ' $ conditions:List of 3'
6: ' ..$ :List of 2'
7: ' .. ..$ condition:List of 2'
8: ' .. .. ..$ message: chr "hello\n"'
9: ' .. .. ..$ call : language message("hello")'
10: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleMessage" "message" "condition"'
11: ' .. ..$ signaled : int 0'
12: ' ..$ :List of 2'
13: ' .. ..$ condition:List of 2'
14: ' .. .. ..$ message: chr "whoops"'
15: ' .. .. ..$ call : language eval(quote({ print(1:3) ...'
16: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleWarning" "warning" "condition"'
17: ' .. ..$ signaled : int 0'
18: ' ..$ :List of 2'
19: ' .. ..$ condition:List of 2'
20: ' .. .. ..$ message: chr "world\n"'
21: ' .. .. ..$ call : language message("world")'
22: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleMessage" "message" "condition"'
23: ' .. ..$ signaled : int 0'
24: ' $ rng : logi FALSE'
25: ' $ started : POSIXct[1:1], format: "2023-02-08 19:27:36"'
26: ' $ finished : POSIXct[1:1], format: "2023-02-08 19:27:36"'
27: ' $ r_info :List of 4'
28: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
29: ' .. ..$ : int [1:3] 4 3 0'
30: ' ..$ os : chr "windows"'
31: ' ..$ os_name : chr "Windows"'
32: ' ..$ captures_utf8: logi TRUE'
33: ' $ version : chr "1.8"'
34: ' - attr(*, "class")= chr "FutureResult"'
35: '[1] 1 2 3'
36: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.154 secs
[[1]][[2]]
[[1]][[2]][[1]]
TestResult:
- Test:
- Title: '%<-% - conditions'
- Tags: '%<-%', 'conditions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: truth <- captureConditions({
17: message("hello")
18: warning("whoops")
19: message("world")
20: })
21: v %<-% {
22: print(1:3)
23: message("hello")
24: warning("whoops")
25: message("world")
26: 42L
27: }
28: conditions <- captureConditions(v)
29: stopifnot(v == 42L)
30: stopifnot(is.list(conditions), length(conditions) == 3L)
31: for (kk in seq_along(conditions)) {
32: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
33: identical(conditions[[kk]]$message, truth[[kk]]$message))
34: }
35: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.174 secs
[[1]][[3]]
[[1]][[3]][[1]]
TestResult:
- Test:
- Title: 'future() - muffle conditions'
- Tags: 'future', 'conditions', 'muffle'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: f <- future({
17: print(1:3)
18: message("hello")
19: warning("whoops")
20: message("world")
21: 42L
22: }, conditions = character(0L))
23: r <- result(f)
24: str(r)
25: stopifnot(value(f) == 42L)
26: conditions <- r$conditions
27: stopifnot(is.list(conditions), length(conditions) == 0L)
28: conditions <- captureConditions(value(f))
29: stopifnot(is.list(conditions), length(conditions) == 0L)
30: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'List of 9'
2: ' $ value : int 42'
3: ' $ visible : logi TRUE'
4: ' $ stdout : chr "[1] 1 2 3\n"'
5: ' $ conditions: list()'
6: ' $ rng : logi FALSE'
7: ' $ started : POSIXct[1:1], format: "2023-02-08 19:27:36"'
8: ' $ finished : POSIXct[1:1], format: "2023-02-08 19:27:36"'
9: ' $ r_info :List of 4'
10: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
11: ' .. ..$ : int [1:3] 4 3 0'
12: ' ..$ os : chr "windows"'
13: ' ..$ os_name : chr "Windows"'
14: ' ..$ captures_utf8: logi TRUE'
15: ' $ version : chr "1.8"'
16: ' - attr(*, "class")= chr "FutureResult"'
17: '[1] 1 2 3'
18: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.079 secs
[[1]][[4]]
[[1]][[4]][[1]]
TestResult:
- Test:
- Title: 'Argument '...''
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, ...) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, ...)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(y == 6)
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.018 secs
[[1]][[5]]
[[1]][[5]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' from parent function'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, ...) {
3: sumt <- function(x) {
4: message("Arguments '...' exists: ", exists("...",
5: inherits = TRUE))
6: y %<-% {
7: sum(x, ...)
8: }
9: y
10: }
11: sumt(x)
12: }
13: y <- try(fcn(1:2, 3))
14: print(y)
15: stopifnot(y == 6)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.015 secs
[[1]][[6]]
[[1]][[6]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' - non existing'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, y) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, y)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(y == 6)
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[7]]
[[1]][[7]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' - exception'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, y) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, y, ...)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(inherits(y, "try-error"))
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Error in eval(quote({ : '...' used in an incorrect context'
2: '[1] "Error in eval(quote({ : '...' used in an incorrect context\n"'
3: 'attr(,"class")'
4: '[1] "try-error"'
5: 'attr(,"condition")'
6: '<simpleError in eval(quote({ sum(x, y, ...)}), new.env()): '...' used in an incorrect context>'
- Success: TRUE
- Processing time: 0.018 secs
[[1]][[8]]
[[1]][[8]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[8]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[8]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[8]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[9]]
[[1]][[9]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[9]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[9]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[9]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[10]]
[[1]][[10]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[10]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.013 secs
[[1]][[10]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.018 secs
[[1]][[10]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[11]]
[[1]][[11]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: delayedAssign("a", {
3: cat("Delayed assignment evaluated\n")
4: 1
5: })
6: futureAssign("b", {
7: cat("Future assignment evaluated\n")
8: 2
9: }, lazy = lazy)
10: cat(sprintf("b = %s\n", b))
11: cat(sprintf("a = %s\n", a))
12: stopifnot(identical(a, 1))
13: stopifnot(identical(b, 2))
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future assignment evaluated'
2: 'b = 2'
3: 'Delayed assignment evaluated'
4: 'a = 1'
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[11]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: delayedAssign("a", {
3: cat("Delayed assignment evaluated\n")
4: 1
5: })
6: futureAssign("b", {
7: cat("Future assignment evaluated\n")
8: 2
9: }, lazy = lazy)
10: cat(sprintf("b = %s\n", b))
11: cat(sprintf("a = %s\n", a))
12: stopifnot(identical(a, 1))
13: stopifnot(identical(b, 2))
14: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future assignment evaluated'
2: 'b = 2'
3: 'Delayed assignment evaluated'
4: 'a = 1'
- Success: TRUE
- Processing time: 0.012 secs
[[1]][[12]]
[[1]][[12]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - potential task name clashes'
- Tags: 'futureAssign'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: u <- new.env()
3: v <- new.env()
4: futureAssign("a", {
5: 2
6: }, assign.env = u)
7: futureAssign("a", {
8: 4
9: }, assign.env = v)
10: cat(sprintf("u$a = %s\n", u$a))
11: cat(sprintf("v$a = %s\n", v$a))
12: stopifnot(identical(u$a, 2))
13: stopifnot(identical(v$a, 4))
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'u$a = 2'
2: 'v$a = 4'
- Success: TRUE
- Processing time: 0.021 secs
[[1]][[13]]
[[1]][[13]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - global variables with and without lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 1
3: futureAssign("b", {
4: 2 * a
5: })
6: a <- 2
7: stopifnot(b == 2)
8: a <- 1
9: f <- futureAssign("b", {
10: 2 + a
11: }, lazy = lazy)
12: a <- 2
13: stopifnot(b == 3)
14: print(f)
15: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '{'
5: ' 2 + a'
6: '}'
7: 'Lazy evaluation: FALSE'
8: 'Asynchronous evaluation: FALSE'
9: 'Local evaluation: TRUE'
10: 'Environment: 0x000002be9cc8b9b0'
11: 'Capture standard output: TRUE'
12: 'Capture condition classes: 'condition' (excluding 'nothing')'
13: 'Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes)'
14: 'Packages: <none>'
15: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
16: 'Resolved: TRUE'
17: 'Value: 56 bytes of class 'numeric''
18: 'Early signaling: FALSE'
19: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
20: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.030 secs
[[1]][[13]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - global variables with and without lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 1
3: futureAssign("b", {
4: 2 * a
5: })
6: a <- 2
7: stopifnot(b == 2)
8: a <- 1
9: f <- futureAssign("b", {
10: 2 + a
11: }, lazy = lazy)
12: a <- 2
13: stopifnot(b == 3)
14: print(f)
15: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '{'
5: ' 2 + a'
6: '}'
7: 'Lazy evaluation: TRUE'
8: 'Asynchronous evaluation: FALSE'
9: 'Local evaluation: TRUE'
10: 'Environment: 0x000002be9d41c030'
11: 'Capture standard output: TRUE'
12: 'Capture condition classes: 'condition' (excluding 'nothing')'
13: 'Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes)'
14: 'Packages: <none>'
15: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
16: 'Resolved: TRUE'
17: 'Value: 56 bytes of class 'numeric''
18: 'Early signaling: FALSE'
19: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
20: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.023 secs
[[1]][[14]]
[[1]][[14]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation via disposable option'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: options(future.disposable = list(lazy = lazy))
3: on.exit(options(future.disposable = NULL))
4: a <- 1
5: f <- futureAssign("b", {
6: 4/a
7: })
8: a <- 2
9: stopifnot(b == 4)
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[14]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation via disposable option'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: options(future.disposable = list(lazy = lazy))
3: on.exit(options(future.disposable = NULL))
4: a <- 1
5: f <- futureAssign("b", {
6: 4/a
7: })
8: a <- 2
9: stopifnot(b == 4)
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.013 secs
[[1]][[15]]
[[1]][[15]][[1]]
TestResult:
- Test:
- Title: '%<-% - local evaluation'
- Tags: '%<-%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 1
4: } %lazy% lazy
5: stopifnot(!exists("x", inherits = FALSE), identical(v, 1))
6: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.020 secs
[[1]][[15]][[2]]
TestResult:
- Test:
- Title: '%<-% - local evaluation'
- Tags: '%<-%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 1
4: } %lazy% lazy
5: stopifnot(!exists("x", inherits = FALSE), identical(v, 1))
6: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.012 secs
[[1]][[16]]
[[1]][[16]][[1]]
TestResult:
- Test:
- Title: '%<-% - local evaluation & global variable'
- Tags: '%<-%', 'lazy', 'global'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 2
3: v %<-% {
4: x <- a
5: } %lazy% lazy
6: stopifnot(!exists("x", inherits = FALSE), identical(v, a))
7: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[16]][[2]]
TestResult:
- Test:
- Title: '%<-% - local evaluation & global variable'
- Tags: '%<-%', 'lazy', 'global'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 2
3: v %<-% {
4: x <- a
5: } %lazy% lazy
6: stopifnot(!exists("x", inherits = FALSE), identical(v, a))
7: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.013 secs
[[1]][[17]]
[[1]][[17]][[1]]
TestResult:
- Test:
- Title: '%<-% - errors'
- Tags: '%<-%', 'lazy', 'error'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 3
4: stop("Woops!")
5: x
6: } %lazy% lazy
7: stopifnot(!exists("x", inherits = FALSE))
8: res <- tryCatch(identical(v, 3), error = identity)
9: stopifnot(inherits(res, "error"))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[17]][[2]]
TestResult:
- Test:
- Title: '%<-% - errors'
- Tags: '%<-%', 'lazy', 'error'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 3
4: stop("Woops!")
5: x
6: } %lazy% lazy
7: stopifnot(!exists("x", inherits = FALSE))
8: res <- tryCatch(identical(v, 3), error = identity)
9: stopifnot(inherits(res, "error"))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[18]]
[[1]][[18]][[1]]
TestResult:
- Test:
- Title: '%<-% - errors and listenv'
- Tags: '%<-%', 'lazy', 'error', 'listenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: y <- listenv::listenv()
3: for (ii in 1:3) {
4: y[[ii]] %<-% {
5: if (ii%%2 == 0)
6: stop("Woops!")
7: ii
8: }
9: } %lazy% lazy
10: res <- tryCatch(as.list(y), error = identity)
11: stopifnot(inherits(res, "error"))
12: z <- y[c(1, 3)]
13: z <- unlist(z)
14: stopifnot(all(z == c(1, 3)))
15: res <- tryCatch(y[[2]], error = identity)
16: stopifnot(inherits(res, "error"))
17: res <- tryCatch(y[1:2], error = identity)
18: stopifnot(inherits(res, "error"))
19: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.051 secs
[[1]][[18]][[2]]
TestResult:
- Test:
- Title: '%<-% - errors and listenv'
- Tags: '%<-%', 'lazy', 'error', 'listenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: y <- listenv::listenv()
3: for (ii in 1:3) {
4: y[[ii]] %<-% {
5: if (ii%%2 == 0)
6: stop("Woops!")
7: ii
8: }
9: } %lazy% lazy
10: res <- tryCatch(as.list(y), error = identity)
11: stopifnot(inherits(res, "error"))
12: z <- y[c(1, 3)]
13: z <- unlist(z)
14: stopifnot(all(z == c(1, 3)))
15: res <- tryCatch(y[[2]], error = identity)
16: stopifnot(inherits(res, "error"))
17: res <- tryCatch(y[1:2], error = identity)
18: stopifnot(inherits(res, "error"))
19: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.049 secs
[[1]][[19]]
[[1]][[19]][[1]]
TestResult:
- Test:
- Title: '%<-% & %->%'
- Tags: '%<-%', '%->%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: c %<-% 1 %lazy% lazy
3: cat(sprintf("c = %s\n", c))
4: 1 %->% d %lazy% lazy
5: cat(sprintf("d = %s\n", d))
6: stopifnot(d == c)
7: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'c = 1'
2: 'd = 1'
- Success: TRUE
- Processing time: 0.015 secs
[[1]][[19]][[2]]
TestResult:
- Test:
- Title: '%<-% & %->%'
- Tags: '%<-%', '%->%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: c %<-% 1 %lazy% lazy
3: cat(sprintf("c = %s\n", c))
4: 1 %->% d %lazy% lazy
5: cat(sprintf("d = %s\n", d))
6: stopifnot(d == c)
7: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Error: promise already under evaluation: recursive default argument reference or earlier problems?
- Captured output:
1: ''
- Success: FALSE
- Processing time: 0.008 secs
[[1]][[20]]
[[1]][[20]][[1]]
TestResult:
- Test:
- Title: '%<-% - nested'
- Tags: '%<-%', 'nested'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: a %<-% {
3: b <- 1
4: c %<-% 2
5: d <- 3
6: 4 %->% e
7: b + c + d + e
8: }
9: cat(sprintf("a = %s\n", a))
10: stopifnot(a == 10)
11: {
12: a + 1
13: } %->% b
14: cat(sprintf("b = %s\n", b))
15: stopifnot(b == a + 1)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'a = 10'
2: 'b = 11'
- Success: TRUE
- Processing time: 0.057 secs
[[1]][[21]]
[[1]][[21]][[1]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: FALSE
2. globals: FALSE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9d082990'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 2 objects totaling 1.26 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 0 bytes of class 'NULL''
16: 'Conditions captured: [n=1] 'simpleError''
17: 'Early signaling: FALSE'
18: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
19: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
20: 'List of 2'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' - attr(*, "where")=List of 2'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1288'
31: ' - attr(*, "already-done")= logi TRUE'
32: '- FUN(): --------------------'
33: 'FUN : function (x, y) '
34: 'f : Classes 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' <environment: 0x000002be9d0d1968> '
35: 'globals : logi FALSE'
36: 'lazy : logi FALSE'
37: 'stdout : logi TRUE'
38: 'v0 : num 90'
39: '-----------------------------'
40: 'List of 4'
41: ' $ globals: logi FALSE'
42: ' $ lazy : logi FALSE'
43: ' $ v0 : num 90'
44: ' $ res :List of 2'
45: ' ..$ message: chr "object 'a' not found"'
46: ' ..$ call : language (function (x, y) a * (x - y))(x = 42, y = 12)'
47: ' ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"'
- Success: TRUE
- Processing time: 0.040 secs
[[1]][[21]][[2]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: TRUE
2. globals: FALSE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9d7b93b0'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 2 objects totaling 1.26 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
19: 'Class: 'Future', 'environment''
20: 'List of 2'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' - attr(*, "where")=List of 2'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1288'
31: ' - attr(*, "already-done")= logi TRUE'
32: '- FUN(): --------------------'
33: 'FUN : function (x, y) '
34: 'f : Classes 'Future', 'environment' <environment: 0x000002be9d812a18> '
35: 'globals : logi FALSE'
36: 'lazy : logi TRUE'
37: 'stdout : logi TRUE'
38: 'v0 : num 90'
39: '-----------------------------'
40: 'List of 4'
41: ' $ globals: logi FALSE'
42: ' $ lazy : logi TRUE'
43: ' $ v0 : num 90'
44: ' $ res :List of 2'
45: ' ..$ message: chr "object 'a' not found"'
46: ' ..$ call : language (function (x, y) a * (x - y))(x = 42, y = 12)'
47: ' ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"'
- Success: TRUE
- Processing time: 0.038 secs
[[1]][[21]][[3]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9decb3f8'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
19: 'List of 3'
20: ' $ FUN :function (x, y) '
21: ' $ args:List of 2'
22: ' ..$ x: num 42'
23: ' ..$ y: num 12'
24: ' $ a : num 3'
25: ' - attr(*, "where")=List of 3'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' ..$ a :<environment: R_EmptyEnv> '
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1344'
31: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
32: ' - attr(*, "already-done")= logi TRUE'
33: '- FUN(): --------------------'
34: 'a : num 3'
35: '-----------------------------'
36: 'List of 4'
37: ' $ globals: logi TRUE'
38: ' $ lazy : logi FALSE'
39: ' $ v0 : num 90'
40: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.038 secs
[[1]][[21]][[4]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9ba3af08'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
19: 'Class: 'Future', 'environment''
20: 'List of 3'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' $ a : num 3'
26: ' - attr(*, "where")=List of 3'
27: ' ..$ FUN :<environment: R_EmptyEnv> '
28: ' ..$ args:<environment: R_EmptyEnv> '
29: ' ..$ a :<environment: R_EmptyEnv> '
30: ' - attr(*, "resolved")= logi FALSE'
31: ' - attr(*, "total_size")= num 1344'
32: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
33: ' - attr(*, "already-done")= logi TRUE'
34: '- FUN(): --------------------'
35: 'a : num 3'
36: '-----------------------------'
37: 'List of 4'
38: ' $ globals: logi TRUE'
39: ' $ lazy : logi TRUE'
40: ' $ v0 : num 90'
41: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[22]]
[[1]][[22]][[1]]
TestResult:
- Test:
- Title: 'futureCall() - globals = list(a = 3)'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-value'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) a * (x - y), args = args,
6: globals = list(a = 3), lazy = lazy)
7: rm(list = "args")
8: print(f)
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
15: stopifnot(all.equal(v, v0))
16: }
17: else {
18: stopifnot(!globals)
19: }
20: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9c66f7d8'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
19: 'List of 4'
20: ' $ globals: logi TRUE'
21: ' $ lazy : logi FALSE'
22: ' $ v0 : num 90'
23: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.015 secs
[[1]][[22]][[2]]
TestResult:
- Test:
- Title: 'futureCall() - globals = list(a = 3)'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-value'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) a * (x - y), args = args,
6: globals = list(a = 3), lazy = lazy)
7: rm(list = "args")
8: print(f)
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
15: stopifnot(all.equal(v, v0))
16: }
17: else {
18: stopifnot(!globals)
19: }
20: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9ca8a330'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
19: 'Class: 'Future', 'environment''
20: 'List of 4'
21: ' $ globals: logi TRUE'
22: ' $ lazy : logi TRUE'
23: ' $ v0 : num 90'
24: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.015 secs
[[1]][[23]]
[[1]][[23]][[1]]
TestResult:
- Test:
- Title: 'futureCall() - globals = "a"'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-name'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) {
6: a * (x - y)
7: }, args = args, globals = "a", lazy = lazy)
8: rm(list = c("a", "args"))
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: stopifnot(all.equal(v, v0))
15: }
16: else {
17: }
18: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[23]][[2]]
TestResult:
- Test:
- Title: 'futureCall() - globals = "a"'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-name'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) {
6: a * (x - y)
7: }, args = args, globals = "a", lazy = lazy)
8: rm(list = c("a", "args"))
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: stopifnot(all.equal(v, v0))
15: }
16: else {
17: }
18: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[24]]
[[1]][[24]][[1]]
TestResult:
- Test:
- Title: 'future() - rm() a global variable'
- Tags: 'future', 'globalenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 42
3: f <- future({
4: a
5: a <- 3.14
6: rm(a)
7: a
8: }, lazy = lazy)
9: rm(list = "a")
10: stopifnot(value(f) == 42L)
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.013 secs
[[1]][[24]][[2]]
TestResult:
- Test:
- Title: 'future() - rm() a global variable'
- Tags: 'future', 'globalenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 42
3: f <- future({
4: a
5: a <- 3.14
6: rm(a)
7: a
8: }, lazy = lazy)
9: rm(list = "a")
10: stopifnot(value(f) == 42L)
11: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[25]]
[[1]][[25]][[1]]
TestResult:
- Test:
- Title: 'future() - non-exported package objects'
- Tags: 'future', 'globals'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: if (requireNamespace("utils") && require("utils")) {
3: env <- pos.to.env(match("package:utils", search()))
4: ns <- getNamespace("utils")
5: privates <- setdiff(names(ns), names(env))
6: non_exported <- NULL
7: for (name in privates) {
8: if (exists(name, envir = ns, mode = "function", inherits = FALSE)) {
9: non_exported <- get(name, envir = ns, mode = "function",
10: inherits = FALSE)
11: }
12: }
13: stopifnot(is.function(non_exported))
14: f <- future({
15: non_exported
16: }, lazy = TRUE)
17: stopifnot("non_exported" %in% names(f$globals), identical(f$globals[["non_exported"]],
18: non_exported))
19: v <- value(f)
20: stopifnot(identical(v, non_exported))
21: }
22: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.099 secs
[[1]][[26]]
[[1]][[26]][[1]]
TestResult:
- Test:
- Title: 'future() - NSE '...''
- Tags: 'future', 'globals', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: my_fcn <- function(...) {
3: globals <- globals::globalsByName("...", envir = environment())
4: f <- future({
5: fcn <- function() sum(...)
6: fcn()
7: }, envir = parent.frame(), globals = globals)
8: v <- value(f)
9: v
10: }
11: y <- my_fcn()
12: stopifnot(y == 0L)
13: y <- my_fcn(1:10)
14: stopifnot(identical(y, 55L))
15: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.019 secs
[[1]][[27]]
[[1]][[27]][[1]]
TestResult:
- Test:
- Title: 'resolved() on lazy futures'
- Tags: 'resolved', 'lazy'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f <- future(42, lazy = TRUE)
3: while (!resolved(f)) {
4: Sys.sleep(0.1)
5: }
6: v <- value(f)
7: stopifnot(identical(v, 42))
8: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.008 secs
[[1]][[28]]
[[1]][[28]][[1]]
TestResult:
- Test:
- Title: 'demo("mandelbrot", package = "future")'
- Tags: 'demo', 'mandelbrot'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: if (getRversion() <= "3.2.0") {
3: message("Test requires R (>= 3.2.0). Skipping")
4: return()
5: }
6: options(future.demo.mandelbrot.nrow = 2L)
7: options(future.demo.mandelbrot.resolution = 50L)
8: options(future.demo.mandelbrot.delay = FALSE)
9: on.exit(grDevices::graphics.off())
10: demo("mandelbrot", package = "future", ask = FALSE)
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(value = NULL, visible = FALSE)
- Visible: FALSE
- Captured output:
1: ''
2: ''
3: ' demo(mandelbrot)'
4: ' ---- ~~~~~~~~~~'
5: ''
6: '> library("future")'
7: ''
8: '> library("graphics")'
9: ''
10: '> plot_what_is_done <- function(counts) {'
11: '+ for (kk in seq_along(counts)) {'
12: '+ f <- counts[[kk]]'
13: '+ '
14: '+ ## Already plotted?'
15: '+ if (!inherits(f, "Future")) next'
16: '+ '
17: '+ ## Not resolved?'
18: '+ if (!resolved(f)) next'
19: '+ '
20: '+ message(sprintf("Plotting tile #%d of %d ...", kk, n))'
21: '+ counts[[kk]] <- value(f)'
22: '+ screen(kk)'
23: '+ plot(counts[[kk]])'
24: '+ }'
25: '+ '
26: '+ counts'
27: '+ }'
28: ''
29: '> ## Options'
30: '> region <- getOption("future.demo.mandelbrot.region", 1L)'
31: ''
32: '> if (!is.list(region)) {'
33: '+ if (region == 1L) {'
34: '+ region <- list(xmid = -0.75, ymid = 0.0, side = 3.0)'
35: '+ } else if (region == 2L) {'
36: '+ region <- list(xmid = 0.283, ymid = -0.0095, side = 0.00026)'
37: '+ } else if (region == 3L) {'
38: '+ region <- list(xmid = 0.282989, ymid = -0.01, side = 3e-8)'
39: '+ }'
40: '+ }'
41: ''
42: '> nrow <- getOption("future.demo.mandelbrot.nrow", 3L)'
43: ''
44: '> resolution <- getOption("future.demo.mandelbrot.resolution", 400L)'
45: ''
46: '> delay <- getOption("future.demo.mandelbrot.delay", interactive())'
47: ''
48: '> if (isTRUE(delay)) {'
49: '+ delay <- function(counts) Sys.sleep(1.0)'
50: '+ } else if (!is.function(delay)) {'
51: '+ delay <- function(counts) {}'
52: '+ }'
53: ''
54: '> ## Generate Mandelbrot tiles to be computed'
55: '> Cs <- mandelbrot_tiles(xmid = region$xmid, ymid = region$ymid,'
56: '+ side = region$side, nrow = nrow,'
57: '+ resolution = resolution)'
58: ''
59: '> if (interactive()) {'
60: '+ dev.new()'
61: '+ plot.new()'
62: '+ split.screen(dim(Cs))'
63: '+ for (ii in seq_along(Cs)) {'
64: '+ screen(ii)'
65: '+ par(mar = c(0, 0, 0, 0))'
66: '+ text(x = 1 / 2, y = 1 / 2, sprintf("Future #%d\nunresolved", ii), cex = 2)'
67: '+ }'
68: '+ } else {'
69: '+ split.screen(dim(Cs))'
70: '+ }'
71: '[1] 1 2 3 4'
72: ''
73: '> ## Create all Mandelbrot tiles via lazy futures'
74: '> n <- length(Cs)'
75: ''
76: '> message(sprintf("Creating %d Mandelbrot tiles:", n), appendLF = FALSE)'
77: ''
78: '> counts <- lapply(seq_along(Cs), FUN=function(ii) {'
79: '+ message(" ", ii, appendLF = FALSE)'
80: '+ C <- Cs[[ii]]'
81: '+ future({'
82: '+ message(sprintf("Calculating tile #%d of %d ...", ii, n), appendLF = FALSE)'
83: '+ fit <- mandelbrot(C)'
84: '+ '
85: '+ ## Emulate slowness'
86: '+ delay(fit)'
87: '+ '
88: '+ message(" done")'
89: '+ fit'
90: '+ }, lazy = TRUE)'
91: '+ })'
92: ''
93: '> message(".")'
94: ''
95: '> ## Calculate and plot tiles'
96: '> repeat {'
97: '+ counts <- plot_what_is_done(counts)'
98: '+ if (!any(sapply(counts, FUN = inherits, "Future"))) break'
99: '+ }'
100: ''
101: '> close.screen()'
102: '[1] 1 2 3 4'
103: ''
104: '> message("SUGGESTION: Try to rerun this demo after changing strategy for how futures are resolved, e.g. plan(multisession).\n")'
- Success: TRUE
- Processing time: 0.445 secs
[[1]][[28]][[2]]
TestResult:
- Test:
- Title: 'demo("mandelbrot", package = "future")'
- Tags: 'demo', 'mandelbrot'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: if (getRversion() <= "3.2.0") {
3: message("Test requires R (>= 3.2.0). Skipping")
4: return()
5: }
6: options(future.demo.mandelbrot.nrow = 2L)
7: options(future.demo.mandelbrot.resolution = 50L)
8: options(future.demo.mandelbrot.delay = FALSE)
9: on.exit(grDevices::graphics.off())
10: demo("mandelbrot", package = "future", ask = FALSE)
11: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(value = NULL, visible = FALSE)
- Visible: FALSE
- Captured output:
1: ''
2: ''
3: ' demo(mandelbrot)'
4: ' ---- ~~~~~~~~~~'
5: ''
6: '> library("future")'
7: ''
8: '> library("graphics")'
9: ''
10: '> plot_what_is_done <- function(counts) {'
11: '+ for (kk in seq_along(counts)) {'
12: '+ f <- counts[[kk]]'
13: '+ '
14: '+ ## Already plotted?'
15: '+ if (!inherits(f, "Future")) next'
16: '+ '
17: '+ ## Not resolved?'
18: '+ if (!resolved(f)) next'
19: '+ '
20: '+ message(sprintf("Plotting tile #%d of %d ...", kk, n))'
21: '+ counts[[kk]] <- value(f)'
22: '+ screen(kk)'
23: '+ plot(counts[[kk]])'
24: '+ }'
25: '+ '
26: '+ counts'
27: '+ }'
28: ''
29: '> ## Options'
30: '> region <- getOption("future.demo.mandelbrot.region", 1L)'
31: ''
32: '> if (!is.list(region)) {'
33: '+ if (region == 1L) {'
34: '+ region <- list(xmid = -0.75, ymid = 0.0, side = 3.0)'
35: '+ } else if (region == 2L) {'
36: '+ region <- list(xmid = 0.283, ymid = -0.0095, side = 0.00026)'
37: '+ } else if (region == 3L) {'
38: '+ region <- list(xmid = 0.282989, ymid = -0.01, side = 3e-8)'
39: '+ }'
40: '+ }'
41: ''
42: '> nrow <- getOption("future.demo.mandelbrot.nrow", 3L)'
43: ''
44: '> resolution <- getOption("future.demo.mandelbrot.resolution", 400L)'
45: ''
46: '> delay <- getOption("future.demo.mandelbrot.delay", interactive())'
47: ''
48: '> if (isTRUE(delay)) {'
49: '+ delay <- function(counts) Sys.sleep(1.0)'
50: '+ } else if (!is.function(delay)) {'
51: '+ delay <- function(counts) {}'
52: '+ }'
53: ''
54: '> ## Generate Mandelbrot tiles to be computed'
55: '> Cs <- mandelbrot_tiles(xmid = region$xmid, ymid = region$ymid,'
56: '+ side = region$side, nrow = nrow,'
57: '+ resolution = resolution)'
58: ''
59: '> if (interactive()) {'
60: '+ dev.new()'
61: '+ plot.new()'
62: '+ split.screen(dim(Cs))'
63: '+ for (ii in seq_along(Cs)) {'
64: '+ screen(ii)'
65: '+ par(mar = c(0, 0, 0, 0))'
66: '+ text(x = 1 / 2, y = 1 / 2, sprintf("Future #%d\nunresolved", ii), cex = 2)'
67: '+ }'
68: '+ } else {'
69: '+ split.screen(dim(Cs))'
70: '+ }'
71: '[1] 1 2 3 4'
72: ''
73: '> ## Create all Mandelbrot tiles via lazy futures'
74: '> n <- length(Cs)'
75: ''
76: '> message(sprintf("Creating %d Mandelbrot tiles:", n), appendLF = FALSE)'
77: ''
78: '> counts <- lapply(seq_along(Cs), FUN=function(ii) {'
79: '+ message(" ", ii, appendLF = FALSE)'
80: '+ C <- Cs[[ii]]'
81: '+ future({'
82: '+ message(sprintf("Calculating tile #%d of %d ...", ii, n), appendLF = FALSE)'
83: '+ fit <- mandelbrot(C)'
84: '+ '
85: '+ ## Emulate slowness'
86: '+ delay(fit)'
87: '+ '
88: '+ message(" done")'
89: '+ fit'
90: '+ }, lazy = TRUE)'
91: '+ })'
92: ''
93: '> message(".")'
94: ''
95: '> ## Calculate and plot tiles'
96: '> repeat {'
97: '+ counts <- plot_what_is_done(counts)'
98: '+ if (!any(sapply(counts, FUN = inherits, "Future"))) break'
99: '+ }'
100: ''
101: '> close.screen()'
102: '[1] 1 2 3 4'
103: ''
104: '> message("SUGGESTION: Try to rerun this demo after changing strategy for how futures are resolved, e.g. plan(multisession).\n")'
- Success: TRUE
- Processing time: 0.384 secs
[[1]][[29]]
[[1]][[29]][[1]]
TestResult:
- Test:
- Title: 'nbrOfWorkers()'
- Tags: 'nbrOfWorkers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: n <- nbrOfWorkers()
3: message(sprintf("nbrOfWorkers: %g", n))
4: stopifnot(is.numeric(n), length(n) == 1L, n >= 1L)
5: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.001 secs
[[1]][[30]]
[[1]][[30]][[1]]
TestResult:
- Test:
- Title: 'future() - preserve R options'
- Tags: 'future', 'options', 'reset', 'data.table'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: if (requireNamespace("data.table")) {
3: data.table <- data.table::data.table
4: for (kk in 1:2) {
5: f <- future(data.table())
6: v <- value(f)
7: print(v)
8: stopifnot(inherits(v, "data.frame"), inherits(v,
9: "data.table"), nrow(v) == 0L, ncol(v) == 0L)
10: }
11: }
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Null data.table (0 rows and 0 cols)'
2: 'Null data.table (0 rows and 0 cols)'
- Success: TRUE
- Processing time: 0.210 secs
[[1]][[31]]
[[1]][[31]][[1]]
TestResult:
- Test:
- Title: 'future() - preserve R options'
- Tags: 'future', 'options', 'reset', 'ff'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: info <- Sys.info()
3: is_localhost <- value(future(identical(Sys.info(), info)))
4: if (is_localhost && requireNamespace("ff")) {
5: data <- ff::ff(1:12)
6: for (kk in 1:2) {
7: f <- future(data[4], packages = "ff")
8: v <- value(f)
9: print(v)
10: stopifnot(is.integer(v), length(v) == 1L, identical(v,
11: 4L))
12: }
13: }
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 4'
2: '[1] 4'
- Success: TRUE
- Processing time: 0.143 secs
[[1]][[32]]
[[1]][[32]][[1]]
TestResult:
- Test:
- Title: 'plan()'
- Tags: 'plan'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: print(current_plan)
4: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: structure(function (..., envir = parent.frame()) , {, future <- SequentialFuture(..., envir = envir), if (!future$lazy) , future <- run(future), invisible(future), }, class = c("FutureStrategy", "sequential", "uniprocess", "future", , "function"), call = plan(sequential))
- Visible: FALSE
- Captured output:
1: 'sequential:'
2: '- args: function (..., envir = parent.frame())'
3: '- tweaked: FALSE'
4: '- call: plan(sequential)'
- Success: TRUE
- Processing time: 0.002 secs
[[1]][[33]]
[[1]][[33]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<numeric>'
- Tags: 'plan', 'workers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: if (!inherits(current_plan, "multiprocess"))
4: return()
5: plan(current_plan, workers = 1L)
6: n <- nbrOfWorkers()
7: cat(sprintf("Number of workers: %d\n", n))
8: stopifnot(n == 1L)
9: f <- future(42L)
10: stopifnot(value(f) == 42L)
11: plan(current_plan, workers = 2L)
12: n <- nbrOfWorkers()
13: cat(sprintf("Number of workers: %d\n", n))
14: stopifnot(n == 2L)
15: f <- future(42L)
16: stopifnot(value(f) == 42L)
17: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.001 secs
[[1]][[34]]
[[1]][[34]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<function>'
- Tags: 'plan', 'workers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: n0 <- nbrOfWorkers()
4: if (!inherits(current_plan, "multiprocess"))
5: return()
6: workers_value <- eval(formals(current_plan)$workers)
7: workers <- function() workers_value
8: plan(current_plan, workers = workers)
9: n <- nbrOfWorkers()
10: cat(sprintf("Number of workers: %d\n", n))
11: stopifnot(n == n0)
12: f <- future(42L)
13: stopifnot(value(f) == 42L)
14: workers <- function() 1L
15: plan(current_plan, workers = workers)
16: n <- nbrOfWorkers()
17: cat(sprintf("Number of workers: %d\n", n))
18: stopifnot(n == 1L)
19: f <- future(42L)
20: stopifnot(value(f) == 42L)
21: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.001 secs
[[1]][[35]]
[[1]][[35]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<invalid>'
- Tags: 'plan', 'workers', 'exceptions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: if (!inherits(current_plan, "multiprocess"))
4: return()
5: res <- tryCatch({
6: plan(current_plan, workers = 0L)
7: }, error = identity)
8: print(res)
9: stopifnot(inherits(res, "error"))
10: res <- tryCatch({
11: plan(current_plan, workers = NA_integer_)
12: }, error = identity)
13: print(res)
14: stopifnot(inherits(res, "error"))
15: res <- tryCatch({
16: plan(current_plan, workers = TRUE)
17: }, error = identity)
18: print(res)
19: stopifnot(inherits(res, "error"))
20: res <- tryCatch({
21: plan(current_plan, workers = NA_character_)
22: }, error = identity)
23: print(res)
24: stopifnot(inherits(res, "error"))
25: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.001 secs
[[1]][[36]]
[[1]][[36]][[1]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.523 secs
[[1]][[36]][[2]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.517 secs
[[1]][[36]][[3]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.529 secs
[[1]][[36]][[4]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.528 secs
[[1]][[36]][[5]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.519 secs
[[1]][[36]][[6]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.526 secs
[[1]][[36]][[7]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.516 secs
[[1]][[36]][[8]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.514 secs
[[1]][[37]]
[[1]][[37]][[1]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[37]][[2]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.012 secs
[[1]][[37]][[3]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.012 secs
[[1]][[37]][[4]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[37]][[5]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[37]][[6]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[37]][[7]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.012 secs
[[1]][[37]][[8]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.010 secs
[[1]][[38]]
[[1]][[38]][[1]]
TestResult:
- Test:
- Title: 'resolve(<list of futures and values>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.015 secs
[[1]][[38]][[2]]
TestResult:
- Test:
- Title: 'resolve(<list of futures and values>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[39]]
[[1]][[39]][[1]]
TestResult:
- Test:
- Title: 'resolve(<list of futures>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = !lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.021 secs
[[1]][[39]][[2]]
TestResult:
- Test:
- Title: 'resolve(<list of futures>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = !lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.017 secs
[[1]][[40]]
[[1]][[40]][[1]]
TestResult:
- Test:
- Title: 'resolve(<named matrix list of futures and values>) - time ordering'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: x <- list()
3: x$a <- future(1)
4: x$b <- future({
5: Sys.sleep(0.5)
6: 2
7: })
8: x[[4]] <- 4
9: dim(x) <- c(2, 2)
10: y <- resolve(x, idxs = 1)
11: stopifnot(identical(y, x))
12: stopifnot(resolved(x[[1]]))
13: y <- resolve(x, idxs = 2)
14: stopifnot(identical(y, x))
15: stopifnot(resolved(x[[2]]))
16: y <- resolve(x, idxs = 3)
17: stopifnot(identical(y, x))
18: y <- resolve(x, idxs = seq_along(x))
19: stopifnot(identical(y, x))
20: y <- resolve(x, idxs = names(x))
21: stopifnot(identical(y, x))
22: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.529 secs
[[1]][[41]]
[[1]][[41]][[1]]
TestResult:
- Test:
- Title: 'resolved() - assert non-blocking while launching lazy futures'
- Tags: 'resolved', 'lazy'
- Reset workers: TRUE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: message("Creating lazy futures:")
3: n <- min(3, nbrOfWorkers() + 1L)
4: xs <- as.list(1:n)
5: fs <- lapply(xs, FUN = function(kk) {
6: future({
7: Sys.sleep(kk)
8: kk
9: }, lazy = TRUE)
10: })
11: vs <- vector("list", length = length(fs))
12: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
13: print(ss)
14: stopifnot(all(ss == "created"))
15: rs <- rep(NA, times = length(fs))
16: for (ff in seq_along(fs)) {
17: for (kk in ff:length(fs)) {
18: message(sprintf("Checking if future #%d is resolved:",
19: kk))
20: rs[[kk]] <- resolved(fs[[kk]])
21: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
22: print(ss)
23: nbrOfFinished <- sum(ss == "finished")
24: if (inherits(fs[[kk]], "UniprocessFuture")) {
25: stopifnot(rs[[kk]])
26: stopifnot(ss[[kk]] == "finished")
27: }
28: else if (inherits(fs[[kk]], "MultiprocessFuture")) {
29: if (nbrOfWorkers() + ff - 1L + nbrOfFinished >=
30: kk) {
31: stopifnot(ss[[kk]] == "running")
32: }
33: else {
34: stopifnot(ss[[kk]] == "created")
35: }
36: stopifnot(!rs[[kk]])
37: }
38: }
39: message(sprintf("Waiting for future #%d to finish ... ",
40: ff), appendLF = FALSE)
41: vs[[ff]] <- value(fs[[ff]])
42: message("done")
43: rs[[ff]] <- resolved(fs[[ff]])
44: stopifnot(rs[ff])
45: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
46: stopifnot(ss[ff] == "finished")
47: nbrOfFinished <- sum(ss == "finished")
48: if (inherits(fs[[kk]], "UniprocessFuture")) {
49: stopifnot(nbrOfFinished == length(fs))
50: }
51: else {
52: stopifnot(nbrOfFinished == ff)
53: }
54: }
55: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
56: print(ss)
57: stopifnot(all(ss == "finished"))
58: message("Collecting values:")
59: vs <- value(fs)
60: str(vs)
61: stopifnot(identical(vs, xs))
62: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] "created" "created"'
2: '[1] "finished" "created" '
3: '[1] "finished" "finished"'
4: '[1] "finished" "finished"'
5: '[1] "finished" "finished"'
6: 'List of 2'
7: ' $ : int 1'
8: ' $ : int 2'
- Success: TRUE
- Processing time: 3.103 secs
[[1]][[42]]
[[1]][[42]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - seeds and preserving RNGkind'
- Tags: 'rng', 'seed'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: okind <- RNGkind()
3: seed <- c(407L, 1420090545L, 65713854L, -990249945L, 1780737596L,
4: -1213437427L, 1082168682L)
5: f <- future(42, seed = seed)
6: print(f)
7: stopifnot(identical(f$seed, seed))
8: stopifnot(identical(RNGkind()[1], okind[1]))
9: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '[1] 42'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000002be9b8edb70'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: <none>'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: c(407, 1420090545, 65713854, -990249945, 1780737596, -1213437427, 1082168682)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: 5b75dc6b-d24b-7801-f907-34c299afc681'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.011 secs
[[1]][[43]]
[[1]][[43]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - future'
- Tags: 'rng', 'seed', 'lazy', 'future'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "future", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(3L, 1L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x000002be9b15c228>'
147: '<environment: 0x000002be9b148b30>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 3'
164: ''
165: '[[2]]'
166: '[1] 1'
167: ''
- Success: TRUE
- Processing time: 0.160 secs
[[1]][[43]][[2]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - future'
- Tags: 'rng', 'seed', 'lazy', 'future'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "future", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(1L, 2L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x000002be9b15c228>'
147: '<environment: 0x000002be9b148b30>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 1'
164: ''
165: '[[2]]'
166: '[1] 2'
167: ''
- Success: TRUE
- Processing time: 0.099 secs
[[1]][[44]]
[[1]][[44]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - %<-%'
- Tags: 'rng', 'seed', 'lazy', '%<-%'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "%<-%", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(0L, 1L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x000002be9b15c228>'
147: '<environment: 0x000002be9b148b30>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 0'
164: ''
165: '[[2]]'
166: '[1] 1'
167: ''
- Success: TRUE
- Processing time: 0.104 secs
[[1]][[44]][[2]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - %<-%'
- Tags: 'rng', 'seed', 'lazy', '%<-%'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "%<-%", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(3L, 3L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x000002be9b15c228>'
147: '<environment: 0x000002be9b148b30>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 3'
164: ''
165: '[[2]]'
166: '[1] 3'
167: ''
- Success: TRUE
- Processing time: 0.094 secs
[[1]][[45]]
[[1]][[45]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - future() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: rng0 <- globalenv()$.Random.seed
3: f1 <- future(1)
4: stopifnot(identical(globalenv()$.Random.seed, rng0))
5: f2 <- future(2)
6: stopifnot(identical(globalenv()$.Random.seed, rng0))
7: v1 <- value(f1)
8: stopifnot(identical(v1, 1))
9: v2 <- value(f2)
10: stopifnot(identical(v2, 2))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[46]]
[[1]][[46]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - run() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1, lazy = TRUE)
3: f2 <- future(2, lazy = TRUE)
4: rng0 <- globalenv()$.Random.seed
5: f1 <- run(f1)
6: stopifnot(identical(globalenv()$.Random.seed, rng0))
7: f2 <- run(f2)
8: stopifnot(identical(globalenv()$.Random.seed, rng0))
9: v1 <- value(f1)
10: stopifnot(identical(v1, 1))
11: v2 <- value(f2)
12: stopifnot(identical(v2, 2))
13: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.014 secs
[[1]][[47]]
[[1]][[47]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - result() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1)
3: f2 <- future(2)
4: rng0 <- globalenv()$.Random.seed
5: r1 <- result(f1)
6: stopifnot(identical(r1$value, 1))
7: stopifnot(identical(globalenv()$.Random.seed, rng0))
8: r2 <- result(f2)
9: stopifnot(identical(r2$value, 2))
10: stopifnot(identical(globalenv()$.Random.seed, rng0))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.020 secs
[[1]][[48]]
[[1]][[48]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - value() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1)
3: f2 <- future(2)
4: rng0 <- globalenv()$.Random.seed
5: v1 <- value(f1)
6: stopifnot(identical(v1, 1))
7: stopifnot(identical(globalenv()$.Random.seed, rng0))
8: v2 <- value(f2)
9: stopifnot(identical(v2, 2))
10: stopifnot(identical(globalenv()$.Random.seed, rng0))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[49]]
[[1]][[49]][[1]]
TestResult:
- Test:
- Title: 'future() - standard output'
- Tags: 'future', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: f <- future({
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: }, stdout = stdout)
19: r <- result(f)
20: str(r)
21: stopifnot(value(f) == 42L)
22: if (stdout) {
23: print(r)
24: message(sprintf("- stdout = %s", stdout))
25: stopifnot(identical(r$stdout, truth))
26: }
27: else {
28: print(r)
29: print(plan())
30: message(sprintf("- stdout = %s", stdout))
31: stopifnot(is.null(r$stdout) || r$stdout == "")
32: }
33: }
- Arguments tested:
1. stdout: FALSE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: 'List of 9'
3: ' $ value : int 42'
4: ' $ visible : logi TRUE'
5: ' $ stdout : NULL'
6: ' $ conditions: list()'
7: ' $ rng : logi FALSE'
8: ' $ started : POSIXct[1:1], format: "2023-02-08 19:27:48"'
9: ' $ finished : POSIXct[1:1], format: "2023-02-08 19:27:49"'
10: ' $ r_info :List of 4'
11: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
12: ' .. ..$ : int [1:3] 4 3 0'
13: ' ..$ os : chr "windows"'
14: ' ..$ os_name : chr "Windows"'
15: ' ..$ captures_utf8: logi TRUE'
16: ' $ version : chr "1.8"'
17: ' - attr(*, "class")= chr "FutureResult"'
18: 'FutureResult:'
19: 'value: 'integer''
20: 'visible: TRUE'
21: 'stdout: NULL'
22: 'conditions: [n = 0] '
23: 'RNG used: FALSE'
24: 'duration: 0.004915953 secs (started 2023-02-08 19:27:48.995927)'
25: 'version: 1.8'
26: 'sequential:'
27: '- args: function (..., envir = parent.frame())'
28: '- tweaked: FALSE'
29: '- call: plan(sequential)'
- Success: TRUE
- Processing time: 0.042 secs
[[1]][[49]][[2]]
TestResult:
- Test:
- Title: 'future() - standard output'
- Tags: 'future', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: f <- future({
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: }, stdout = stdout)
19: r <- result(f)
20: str(r)
21: stopifnot(value(f) == 42L)
22: if (stdout) {
23: print(r)
24: message(sprintf("- stdout = %s", stdout))
25: stopifnot(identical(r$stdout, truth))
26: }
27: else {
28: print(r)
29: print(plan())
30: message(sprintf("- stdout = %s", stdout))
31: stopifnot(is.null(r$stdout) || r$stdout == "")
32: }
33: }
- Arguments tested:
1. stdout: TRUE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: 'List of 9'
3: ' $ value : int 42'
4: ' $ visible : logi TRUE'
5: ' $ stdout : chr " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 3"| __truncated__'
6: ' $ conditions: list()'
7: ' $ rng : logi FALSE'
8: ' $ started : POSIXct[1:1], format: "2023-02-08 19:27:49"'
9: ' $ finished : POSIXct[1:1], format: "2023-02-08 19:27:49"'
10: ' $ r_info :List of 4'
11: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
12: ' .. ..$ : int [1:3] 4 3 0'
13: ' ..$ os : chr "windows"'
14: ' ..$ os_name : chr "Windows"'
15: ' ..$ captures_utf8: logi TRUE'
16: ' $ version : chr "1.8"'
17: ' - attr(*, "class")= chr "FutureResult"'
18: ' [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25'
19: '[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50'
20: ' int [1:50] 1 2 3 4 5 6 7 8 9 10 ...'
21: 'a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 '
22: '"Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"'
23: '"1" 5.1 3.5 1.4 0.2 "setosa"'
24: '"2" 4.9 3 1.4 0.2 "setosa"'
25: '"3" 4.7 3.2 1.3 0.2 "setosa"'
26: '"4" 4.6 3.1 1.5 0.2 "setosa"'
27: '"5" 5 3.6 1.4 0.2 "setosa"'
28: '"6" 5.4 3.9 1.7 0.4 "setosa"'
29: '"7" 4.6 3.4 1.4 0.3 "setosa"'
30: '"8" 5 3.4 1.5 0.2 "setosa"'
31: '"9" 4.4 2.9 1.4 0.2 "setosa"'
32: '"10" 4.9 3.1 1.5 0.1 "setosa"'
33: 'FutureResult:'
34: 'value: 'integer''
35: 'visible: TRUE'
36: 'stdout: character'
37: 'conditions: [n = 0] '
38: 'RNG used: FALSE'
39: 'duration: 0.004264116 secs (started 2023-02-08 19:27:49.050246)'
40: 'version: 1.8'
- Success: TRUE
- Processing time: 0.038 secs
[[1]][[50]]
[[1]][[50]][[1]]
TestResult:
- Test:
- Title: '%<-% - standard output'
- Tags: '%<-%', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: v %<-% {
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: } %stdout% stdout
19: out <- utils::capture.output(y <- v)
20: stopifnot(y == 42L)
21: if (!stdout) {
22: stopifnot(out == "")
23: }
24: else {
25: print(out)
26: stopifnot(identical(out, truth_rows))
27: }
28: }
- Arguments tested:
1. stdout: FALSE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[50]][[2]]
TestResult:
- Test:
- Title: '%<-% - standard output'
- Tags: '%<-%', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: v %<-% {
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: } %stdout% stdout
19: out <- utils::capture.output(y <- v)
20: stopifnot(y == 42L)
21: if (!stdout) {
22: stopifnot(out == "")
23: }
24: else {
25: print(out)
26: stopifnot(identical(out, truth_rows))
27: }
28: }
- Arguments tested:
1. stdout: TRUE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: ' [1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25" '
3: ' [2] "[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50" '
4: ' [3] " int [1:50] 1 2 3 4 5 6 7 8 9 10 ..." '
5: ' [4] "a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 " '
6: ' [5] "\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\""'
7: ' [6] "\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"" '
8: ' [7] "\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"" '
9: ' [8] "\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"" '
10: ' [9] "\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"" '
11: '[10] "\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"" '
12: '[11] "\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"" '
13: '[12] "\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"" '
14: '[13] "\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"" '
15: '[14] "\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"" '
16: '[15] "\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"" '
- Success: TRUE
- Processing time: 0.023 secs
[[1]][[51]]
[[1]][[51]][[1]]
TestResult:
- Test:
- Title: 'value() - visibility'
- Tags: 'value', 'visibility'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f <- future(42)
3: res <- withVisible({
4: value(f)
5: })
6: v <- res$value
7: stopifnot(identical(v, 42))
8: stopifnot(res$visible)
9: f <- future(invisible(42))
10: res <- withVisible({
11: value(f)
12: })
13: v <- res$value
14: stopifnot(identical(v, 42))
15: stopifnot(!res$visible)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.020 secs
attr(,"plan")
sequential:
- args: function (..., envir = parent.frame())
- tweaked: FALSE
- call: plan(sequential)
attr(,"exit_code")
[1] 1
Total number of errors: 1
> proc.time()
user system elapsed
8.50 0.26 16.90
Flavor: r-devel-windows-x86_64
Version: 0.5.0
Check: tests
Result: ERROR
Running 'Test-class.R' [45s]
Running 'check.R' [18s]
Running 'cli_fcn.R' [3s]
Running 'db_state.R' [5s]
Running 'evaluate_expr.R' [3s]
Running 'one-test.R' [5s]
Running 'progress.R' [3s]
Running 'test_db.R' [5s]
Running 'test_plans.R' [4s]
Running 'utils.R' [3s]
Running 'zzz.onLoad.R' [7s]
Running the tests in 'tests/check.R' failed.
Complete output:
> check <- future.tests::check
>
> message("*** check() ...")
*** check() ...
>
> ## Validate options
> check()
Usage: Rscript -e future.tests::check --args <options>
Options:
--help Display this help
--test-timeout=<seconds> Sets per-test timeout in seconds
--test-tags=<tags> Comma-separated tags specifying tests to include
--test-plan=<plan> Future plan to test against
--session-info Output session information at the end
Example:
Rscript -e future.tests::check --args --help
Rscript -e future.tests::check --args --test-plan=sequential
Rscript -e future.tests::check --args --test-plan=multisession,workers=4
> check(.args = c("--debug", "--help"))
Usage: Rscript -e future.tests::check --args <options>
Options:
--help Display this help
--test-timeout=<seconds> Sets per-test timeout in seconds
--test-tags=<tags> Comma-separated tags specifying tests to include
--test-plan=<plan> Future plan to test against
--session-info Output session information at the end
Example:
Rscript -e future.tests::check --args --help
Rscript -e future.tests::check --args --test-plan=sequential
Rscript -e future.tests::check --args --test-plan=multisession,workers=4
>
> ## Run checks with plan(sequential)
> results <- check(plan = "sequential", session_info = TRUE, debug = TRUE)
-- Settings --------------------------------------------------------------------
- future.tests version : 0.5.0
- R_FUTURE_TESTS_ROOT :
- Option 'future.tests.root': NULL
- Default test set folder : D:/temp/RtmpmSgb8t/RLIBS_16c64236d5cab/future.tests/test-db
- Max number of workers : 2
- Timeout : N/A
-- Running 51 test sets with plan(sequential) ----------------------------------
i Backend package: future 1.31.0
- future() - conditions
\ future() - conditions (1/1)
v future() - conditions (1 test) (125ms)
- %<-% - conditions
\ %<-% - conditions (1/1)
v %<-% - conditions (1 test) (63ms)
- future() - muffle conditions
\ future() - muffle conditions (1/1)
v future() - muffle conditions (1 test) (110ms)
- Argument '...'
\ Argument '...' (1/1)
v Argument '...' (1 test) (16ms)
- Argument '...' from parent function
\ Argument '...' from parent function (1/1)
v Argument '...' from parent function (1 test) (32ms)
- Argument '...' - non existing
\ Argument '...' - non existing (1/1)
v Argument '...' - non existing (1 test) (0ms)
- Argument '...' - exception
\ Argument '...' - exception (1/1)
v Argument '...' - exception (1 test) (16ms)
- Early signaling of errors
\ Early signaling of errors (1/4)
| Early signaling of errors (2/4)
/ Early signaling of errors (3/4)
- Early signaling of errors (4/4)
v Early signaling of errors (4 tests) (47ms)
- Early signaling of warnings
\ Early signaling of warnings (1/4)
| Early signaling of warnings (2/4)
/ Early signaling of warnings (3/4)
- Early signaling of warnings (4/4)
v Early signaling of warnings (4 tests) (47ms)
- Early signaling of messages
\ Early signaling of messages (1/4)
| Early signaling of messages (2/4)
/ Early signaling of messages (3/4)
- Early signaling of messages (4/4)
v Early signaling of messages (4 tests) (47ms)
- futureAssign() - lazy evaluation
\ futureAssign() - lazy evaluation (1/2)
| futureAssign() - lazy evaluation (2/2)
v futureAssign() - lazy evaluation (2 tests) (32ms)
- futureAssign() - potential task name clashes
\ futureAssign() - potential task name clashes (1/1)
v futureAssign() - potential task name clashes (1 test) (32ms)
- futureAssign() - global variables with and without lazy evaluation
\ futureAssign() - global variables with and without lazy evaluation (1/2)
| futureAssign() - global variables with and without lazy evaluation (2/2)
v futureAssign() - global variables with and without lazy evaluation (2 tests) (63ms)
- futureAssign() - lazy evaluation via disposable option
\ futureAssign() - lazy evaluation via disposable option (1/2)
| futureAssign() - lazy evaluation via disposable option (2/2)
v futureAssign() - lazy evaluation via disposable option (2 tests) (32ms)
- %<-% - local evaluation
\ %<-% - local evaluation (1/2)
| %<-% - local evaluation (2/2)
v %<-% - local evaluation (2 tests) (16ms)
- %<-% - local evaluation & global variable
\ %<-% - local evaluation & global variable (1/2)
| %<-% - local evaluation & global variable (2/2)
v %<-% - local evaluation & global variable (2 tests) (0ms)
- %<-% - errors
\ %<-% - errors (1/2)
| %<-% - errors (2/2)
v %<-% - errors (2 tests) (32ms)
- %<-% - errors and listenv
\ %<-% - errors and listenv (1/2)
| %<-% - errors and listenv (2/2)
v %<-% - errors and listenv (2 tests) (94ms)
- %<-% & %->%
\ %<-% & %->% (1/2)
| %<-% & %->% (2/2)
x %<-% & %->% (2 tests) (63ms)
v lazy=FALSE
x lazy=TRUE
- %<-% - nested
\ %<-% - nested (1/1)
v %<-% - nested (1 test) (47ms)
- futureCall()
\ futureCall() (1/4)
| futureCall() (2/4)
/ futureCall() (3/4)
- futureCall() (4/4)
v futureCall() (4 tests) (141ms)
- futureCall() - globals = list(a = 3)
\ futureCall() - globals = list(a = 3) (1/2)
| futureCall() - globals = list(a = 3) (2/2)
v futureCall() - globals = list(a = 3) (2 tests) (16ms)
- futureCall() - globals = "a"
\ futureCall() - globals = "a" (1/2)
| futureCall() - globals = "a" (2/2)
v futureCall() - globals = "a" (2 tests) (0ms)
- future() - rm() a global variable
\ future() - rm() a global variable (1/2)
| future() - rm() a global variable (2/2)
v future() - rm() a global variable (2 tests) (32ms)
- future() - non-exported package objects
\ future() - non-exported package objects (1/1)
v future() - non-exported package objects (1 test) (110ms)
- future() - NSE '...'
\ future() - NSE '...' (1/1)
v future() - NSE '...' (1 test) (16ms)
- resolved() on lazy futures
\ resolved() on lazy futures (1/1)
v resolved() on lazy futures (1 test) (16ms)
- demo("mandelbrot", package = "future")
\ demo("mandelbrot", package = "future") (1/2)
| demo("mandelbrot", package = "future") (2/2)
v demo("mandelbrot", package = "future") (2 tests) (1.5s)
- nbrOfWorkers()
\ nbrOfWorkers() (1/1)
v nbrOfWorkers() (1 test) (0ms)
- future() - preserve R options
\ future() - preserve R options (1/1)
v future() - preserve R options (1 test) (281ms)
- future() - preserve R options
\ future() - preserve R options (1/1)
v future() - preserve R options (1 test) (219ms)
- plan()
\ plan() (1/1)
v plan() (1 test) (0ms)
- plan() - workers=<numeric>
\ plan() - workers=<numeric> (1/1)
v plan() - workers=<numeric> (1 test) (0ms)
- plan() - workers=<function>
\ plan() - workers=<function> (1/1)
v plan() - workers=<function> (1 test) (0ms)
- plan() - workers=<invalid>
\ plan() - workers=<invalid> (1/1)
v plan() - workers=<invalid> (1 test) (0ms)
- resolve()
\ resolve() (1/8)
| resolve() (2/8)
/ resolve() (3/8)
- resolve() (4/8)
\ resolve() (5/8)
| resolve() (6/8)
/ resolve() (7/8)
- resolve() (8/8)
v resolve() (8 tests) (4.9s)
- resolve() - run-time exception
\ resolve() - run-time exception (1/8)
| resolve() - run-time exception (2/8)
/ resolve() - run-time exception (3/8)
- resolve() - run-time exception (4/8)
\ resolve() - run-time exception (5/8)
| resolve() - run-time exception (6/8)
/ resolve() - run-time exception (7/8)
- resolve() - run-time exception (8/8)
v resolve() - run-time exception (8 tests) (79ms)
- resolve(<list of futures and values>)
\ resolve(<list of futures and values>) (1/2)
| resolve(<list of futures and values>) (2/2)
v resolve(<list of futures and values>) (2 tests) (47ms)
- resolve(<list of futures>)
\ resolve(<list of futures>) (1/2)
| resolve(<list of futures>) (2/2)
v resolve(<list of futures>) (2 tests) (32ms)
- resolve(<named matrix list of futures and values>) - time ordering
\ resolve(<named matrix list of futures and values>) - time ordering (1/1)
v resolve(<named matrix list of futures and values>) - time ordering (1 test) (531ms)
- resolved() - assert non-blocking while launching lazy futures
\ resolved() - assert non-blocking while launching lazy futures (1/1)
v resolved() - assert non-blocking while launching lazy futures (1 test) (3.1s)
- Random Number Generation (RNG) - seeds and preserving RNGkind
\ Random Number Generation (RNG) - seeds and preserving RNGkind (1/1)
v Random Number Generation (RNG) - seeds and preserving RNGkind (1 test) (16ms)
- Random Number Generation (RNG) - future
\ Random Number Generation (RNG) - future (1/2)
| Random Number Generation (RNG) - future (2/2)
v Random Number Generation (RNG) - future (2 tests) (281ms)
- Random Number Generation (RNG) - %<-%
\ Random Number Generation (RNG) - %<-% (1/2)
| Random Number Generation (RNG) - %<-% (2/2)
v Random Number Generation (RNG) - %<-% (2 tests) (203ms)
- Orchestration Stability - future() does not update RNG state
\ Orchestration Stability - future() does not update RNG state (1/1)
v Orchestration Stability - future() does not update RNG state (1 test) (32ms)
- Orchestration Stability - run() does not update RNG state
\ Orchestration Stability - run() does not update RNG state (1/1)
v Orchestration Stability - run() does not update RNG state (1 test) (16ms)
- Orchestration Stability - result() does not update RNG state
\ Orchestration Stability - result() does not update RNG state (1/1)
v Orchestration Stability - result() does not update RNG state (1 test) (16ms)
- Orchestration Stability - value() does not update RNG state
\ Orchestration Stability - value() does not update RNG state (1/1)
v Orchestration Stability - value() does not update RNG state (1 test) (16ms)
- future() - standard output
\ future() - standard output (1/2)
| future() - standard output (2/2)
v future() - standard output (2 tests) (94ms)
- %<-% - standard output
\ %<-% - standard output (1/2)
| %<-% - standard output (2/2)
v %<-% - standard output (2 tests) (141ms)
- value() - visibility
\ value() - visibility (1/1)
v value() - visibility (1 test) (16ms)
Number of tests: 95
Duration: 14.7s
Results: 1 error x | 0 timeouts v
- Session info ---------------------------------------------------------------
setting value
version R version 4.1.3 (2022-03-10)
os Windows Server 2008 x64 (build 6003) SP 2
system x86_64, mingw32
ui RTerm
language C
collate C
ctype German_Germany.1252
tz Europe/Berlin
date 2023-02-07
pandoc 1.19.2.1 @ D:\\compiler\\pandoc\\pandoc.exe
- Packages -------------------------------------------------------------------
package * version date (UTC) lib source
bit * 4.0.5 2022-11-15 [1] CRAN (R 4.1.3)
cli 3.6.0 2023-01-09 [1] CRAN (R 4.1.3)
codetools 0.2-19 2023-02-01 [1] CRAN (R 4.1.3)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.1.3)
data.table 1.14.6 2022-11-16 [1] CRAN (R 4.1.3)
digest 0.6.31 2022-12-11 [1] CRAN (R 4.1.3)
ff * 4.0.9 2023-01-25 [1] CRAN (R 4.1.3)
future * 1.31.0 2023-02-01 [1] CRAN (R 4.1.3)
future.tests 0.5.0 2022-12-16 [1] CRAN (R 4.1.3)
globals 0.16.2 2022-11-21 [1] CRAN (R 4.1.3)
listenv 0.9.0 2022-12-16 [1] CRAN (R 4.1.3)
parallelly 1.34.0 2023-01-13 [1] CRAN (R 4.1.3)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.3)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3)
[1] D:/temp/RtmpmSgb8t/RLIBS_16c64236d5cab
[2] D:/RCompile/recent/R-4.1.3/library
------------------------------------------------------------------------------
[[1]]
[[1]][[1]]
[[1]][[1]][[1]]
TestResult:
- Test:
- Title: 'future() - conditions'
- Tags: 'future', 'conditions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: truth <- captureConditions({
17: message("hello")
18: warning("whoops")
19: message("world")
20: })
21: f <- future({
22: print(1:3)
23: message("hello")
24: warning("whoops")
25: message("world")
26: 42L
27: })
28: r <- result(f)
29: str(r)
30: stopifnot(value(f) == 42L)
31: conditions <- r$conditions
32: stopifnot(is.list(conditions), length(conditions) == 3L)
33: conditions <- lapply(conditions, FUN = function(c) c$condition)
34: for (kk in seq_along(conditions)) {
35: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
36: identical(conditions[[kk]]$message, truth[[kk]]$message))
37: }
38: conditions <- captureConditions(value(f))
39: stopifnot(is.list(conditions), length(conditions) == 3L)
40: for (kk in seq_along(conditions)) {
41: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
42: identical(conditions[[kk]]$message, truth[[kk]]$message))
43: }
44: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'List of 9'
2: ' $ value : int 42'
3: ' $ visible : logi TRUE'
4: ' $ stdout : chr "[1] 1 2 3\n"'
5: ' $ conditions:List of 3'
6: ' ..$ :List of 2'
7: ' .. ..$ condition:List of 2'
8: ' .. .. ..$ message: chr "hello\n"'
9: ' .. .. ..$ call : language message("hello")'
10: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleMessage" "message" "condition"'
11: ' .. ..$ signaled : int 0'
12: ' ..$ :List of 2'
13: ' .. ..$ condition:List of 2'
14: ' .. .. ..$ message: chr "whoops"'
15: ' .. .. ..$ call : language eval(quote({ print(1:3) ...'
16: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleWarning" "warning" "condition"'
17: ' .. ..$ signaled : int 0'
18: ' ..$ :List of 2'
19: ' .. ..$ condition:List of 2'
20: ' .. .. ..$ message: chr "world\n"'
21: ' .. .. ..$ call : language message("world")'
22: ' .. .. ..- attr(*, "class")= chr [1:3] "simpleMessage" "message" "condition"'
23: ' .. ..$ signaled : int 0'
24: ' $ rng : logi FALSE'
25: ' $ started : POSIXct[1:1], format: "2023-02-07 06:03:31"'
26: ' $ finished : POSIXct[1:1], format: "2023-02-07 06:03:31"'
27: ' $ r_info :List of 4'
28: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
29: ' .. ..$ : int [1:3] 4 1 3'
30: ' ..$ os : chr "windows"'
31: ' ..$ os_name : chr "Windows"'
32: ' ..$ captures_utf8: logi FALSE'
33: ' $ version : chr "1.8"'
34: ' - attr(*, "class")= chr "FutureResult"'
35: '[1] 1 2 3'
36: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.125 secs
[[1]][[2]]
[[1]][[2]][[1]]
TestResult:
- Test:
- Title: '%<-% - conditions'
- Tags: '%<-%', 'conditions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: truth <- captureConditions({
17: message("hello")
18: warning("whoops")
19: message("world")
20: })
21: v %<-% {
22: print(1:3)
23: message("hello")
24: warning("whoops")
25: message("world")
26: 42L
27: }
28: conditions <- captureConditions(v)
29: stopifnot(v == 42L)
30: stopifnot(is.list(conditions), length(conditions) == 3L)
31: for (kk in seq_along(conditions)) {
32: stopifnot(identical(class(conditions[[kk]]), class(truth[[kk]])),
33: identical(conditions[[kk]]$message, truth[[kk]]$message))
34: }
35: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.062 secs
[[1]][[3]]
[[1]][[3]][[1]]
TestResult:
- Test:
- Title: 'future() - muffle conditions'
- Tags: 'future', 'conditions', 'muffle'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: captureConditions <- function (...)
3: {
4: conditions <- list()
5: withCallingHandlers(..., condition = function(c) {
6: conditions[[length(conditions) + 1L]] <<- c
7: if (inherits(c, "message")) {
8: invokeRestart("muffleMessage")
9: }
10: else if (inherits(c, "warning")) {
11: invokeRestart("muffleWarning")
12: }
13: })
14: conditions
15: }
16: f <- future({
17: print(1:3)
18: message("hello")
19: warning("whoops")
20: message("world")
21: 42L
22: }, conditions = character(0L))
23: r <- result(f)
24: str(r)
25: stopifnot(value(f) == 42L)
26: conditions <- r$conditions
27: stopifnot(is.list(conditions), length(conditions) == 0L)
28: conditions <- captureConditions(value(f))
29: stopifnot(is.list(conditions), length(conditions) == 0L)
30: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'List of 9'
2: ' $ value : int 42'
3: ' $ visible : logi TRUE'
4: ' $ stdout : chr "[1] 1 2 3\n"'
5: ' $ conditions: list()'
6: ' $ rng : logi FALSE'
7: ' $ started : POSIXct[1:1], format: "2023-02-07 06:03:32"'
8: ' $ finished : POSIXct[1:1], format: "2023-02-07 06:03:32"'
9: ' $ r_info :List of 4'
10: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
11: ' .. ..$ : int [1:3] 4 1 3'
12: ' ..$ os : chr "windows"'
13: ' ..$ os_name : chr "Windows"'
14: ' ..$ captures_utf8: logi FALSE'
15: ' $ version : chr "1.8"'
16: ' - attr(*, "class")= chr "FutureResult"'
17: '[1] 1 2 3'
18: '[1] 1 2 3'
- Success: TRUE
- Processing time: 0.109 secs
[[1]][[4]]
[[1]][[4]][[1]]
TestResult:
- Test:
- Title: 'Argument '...''
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, ...) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, ...)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(y == 6)
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[5]]
[[1]][[5]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' from parent function'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, ...) {
3: sumt <- function(x) {
4: message("Arguments '...' exists: ", exists("...",
5: inherits = TRUE))
6: y %<-% {
7: sum(x, ...)
8: }
9: y
10: }
11: sumt(x)
12: }
13: y <- try(fcn(1:2, 3))
14: print(y)
15: stopifnot(y == 6)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[6]]
[[1]][[6]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' - non existing'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, y) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, y)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(y == 6)
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 6'
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[7]]
[[1]][[7]][[1]]
TestResult:
- Test:
- Title: 'Argument '...' - exception'
- Tags: '%<-%', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: fcn <- function(x, y) {
3: message("Arguments '...' exists: ", exists("...", inherits = TRUE))
4: y %<-% {
5: sum(x, y, ...)
6: }
7: y
8: }
9: y <- try(fcn(1:2, 3))
10: print(y)
11: stopifnot(inherits(y, "try-error"))
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Error in eval(quote({ : '...' used in an incorrect context'
2: '[1] "Error in eval(quote({ : '...' used in an incorrect context\n"'
3: 'attr(,"class")'
4: '[1] "try-error"'
5: 'attr(,"condition")'
6: '<simpleError in eval(quote({ sum(x, y, ...)}), new.env()): '...' used in an incorrect context>'
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[8]]
[[1]][[8]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[8]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[8]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[8]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of errors'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: stop("bang!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), error = identity)
9: stopifnot(inherits(v, "error"), conditionMessage(v) ==
10: "bang!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[9]]
[[1]][[9]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[9]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[9]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[9]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of warnings'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: warning("watch out!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), warning = identity)
9: stopifnot(inherits(v, "warning"), conditionMessage(v) ==
10: "watch out!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[10]]
[[1]][[10]][[1]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[10]][[2]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: FALSE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[10]][[3]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: FALSE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[10]][[4]]
TestResult:
- Test:
- Title: 'Early signaling of messages'
- Tags: 'earlySignal', 'resolved', 'resolve'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. earlySignal: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: res <- tryCatch({
3: f <- future({
4: message("hello world!")
5: }, lazy = lazy, earlySignal = earlySignal)
6: stopifnot(inherits(f, "Future"))
7: r <- resolved(f)
8: v <- tryCatch(value(f), message = identity)
9: stopifnot(inherits(v, "message"), conditionMessage(v) ==
10: "hello world!")
11: TRUE
12: }, error = identity)
13: stopifnot(inherits(res, "error") || isTRUE(res))
14: }
- Arguments tested:
1. lazy: TRUE
2. earlySignal: TRUE
3. globals: TRUE
4. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[11]]
[[1]][[11]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: delayedAssign("a", {
3: cat("Delayed assignment evaluated\n")
4: 1
5: })
6: futureAssign("b", {
7: cat("Future assignment evaluated\n")
8: 2
9: }, lazy = lazy)
10: cat(sprintf("b = %s\n", b))
11: cat(sprintf("a = %s\n", a))
12: stopifnot(identical(a, 1))
13: stopifnot(identical(b, 2))
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future assignment evaluated'
2: 'b = 2'
3: 'Delayed assignment evaluated'
4: 'a = 1'
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[11]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: delayedAssign("a", {
3: cat("Delayed assignment evaluated\n")
4: 1
5: })
6: futureAssign("b", {
7: cat("Future assignment evaluated\n")
8: 2
9: }, lazy = lazy)
10: cat(sprintf("b = %s\n", b))
11: cat(sprintf("a = %s\n", a))
12: stopifnot(identical(a, 1))
13: stopifnot(identical(b, 2))
14: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future assignment evaluated'
2: 'b = 2'
3: 'Delayed assignment evaluated'
4: 'a = 1'
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[12]]
[[1]][[12]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - potential task name clashes'
- Tags: 'futureAssign'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: u <- new.env()
3: v <- new.env()
4: futureAssign("a", {
5: 2
6: }, assign.env = u)
7: futureAssign("a", {
8: 4
9: }, assign.env = v)
10: cat(sprintf("u$a = %s\n", u$a))
11: cat(sprintf("v$a = %s\n", v$a))
12: stopifnot(identical(u$a, 2))
13: stopifnot(identical(v$a, 4))
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'u$a = 2'
2: 'v$a = 4'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[13]]
[[1]][[13]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - global variables with and without lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 1
3: futureAssign("b", {
4: 2 * a
5: })
6: a <- 2
7: stopifnot(b == 2)
8: a <- 1
9: f <- futureAssign("b", {
10: 2 + a
11: }, lazy = lazy)
12: a <- 2
13: stopifnot(b == 3)
14: print(f)
15: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '{'
5: ' 2 + a'
6: '}'
7: 'Lazy evaluation: FALSE'
8: 'Asynchronous evaluation: FALSE'
9: 'Local evaluation: TRUE'
10: 'Environment: 0x000000000d5f7d20'
11: 'Capture standard output: TRUE'
12: 'Capture condition classes: 'condition' (excluding 'nothing')'
13: 'Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes)'
14: 'Packages: <none>'
15: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
16: 'Resolved: TRUE'
17: 'Value: 56 bytes of class 'numeric''
18: 'Early signaling: FALSE'
19: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
20: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[13]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - global variables with and without lazy evaluation'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 1
3: futureAssign("b", {
4: 2 * a
5: })
6: a <- 2
7: stopifnot(b == 2)
8: a <- 1
9: f <- futureAssign("b", {
10: 2 + a
11: }, lazy = lazy)
12: a <- 2
13: stopifnot(b == 3)
14: print(f)
15: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '{'
5: ' 2 + a'
6: '}'
7: 'Lazy evaluation: TRUE'
8: 'Asynchronous evaluation: FALSE'
9: 'Local evaluation: TRUE'
10: 'Environment: 0x0000000006f01428'
11: 'Capture standard output: TRUE'
12: 'Capture condition classes: 'condition' (excluding 'nothing')'
13: 'Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes)'
14: 'Packages: <none>'
15: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
16: 'Resolved: TRUE'
17: 'Value: 56 bytes of class 'numeric''
18: 'Early signaling: FALSE'
19: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
20: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[14]]
[[1]][[14]][[1]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation via disposable option'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: options(future.disposable = list(lazy = lazy))
3: on.exit(options(future.disposable = NULL))
4: a <- 1
5: f <- futureAssign("b", {
6: 4/a
7: })
8: a <- 2
9: stopifnot(b == 4)
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[14]][[2]]
TestResult:
- Test:
- Title: 'futureAssign() - lazy evaluation via disposable option'
- Tags: 'futureAssign', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: options(future.disposable = list(lazy = lazy))
3: on.exit(options(future.disposable = NULL))
4: a <- 1
5: f <- futureAssign("b", {
6: 4/a
7: })
8: a <- 2
9: stopifnot(b == 4)
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[15]]
[[1]][[15]][[1]]
TestResult:
- Test:
- Title: '%<-% - local evaluation'
- Tags: '%<-%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 1
4: } %lazy% lazy
5: stopifnot(!exists("x", inherits = FALSE), identical(v, 1))
6: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[15]][[2]]
TestResult:
- Test:
- Title: '%<-% - local evaluation'
- Tags: '%<-%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 1
4: } %lazy% lazy
5: stopifnot(!exists("x", inherits = FALSE), identical(v, 1))
6: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[16]]
[[1]][[16]][[1]]
TestResult:
- Test:
- Title: '%<-% - local evaluation & global variable'
- Tags: '%<-%', 'lazy', 'global'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 2
3: v %<-% {
4: x <- a
5: } %lazy% lazy
6: stopifnot(!exists("x", inherits = FALSE), identical(v, a))
7: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[16]][[2]]
TestResult:
- Test:
- Title: '%<-% - local evaluation & global variable'
- Tags: '%<-%', 'lazy', 'global'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 2
3: v %<-% {
4: x <- a
5: } %lazy% lazy
6: stopifnot(!exists("x", inherits = FALSE), identical(v, a))
7: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[17]]
[[1]][[17]][[1]]
TestResult:
- Test:
- Title: '%<-% - errors'
- Tags: '%<-%', 'lazy', 'error'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 3
4: stop("Woops!")
5: x
6: } %lazy% lazy
7: stopifnot(!exists("x", inherits = FALSE))
8: res <- tryCatch(identical(v, 3), error = identity)
9: stopifnot(inherits(res, "error"))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[17]][[2]]
TestResult:
- Test:
- Title: '%<-% - errors'
- Tags: '%<-%', 'lazy', 'error'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: v %<-% {
3: x <- 3
4: stop("Woops!")
5: x
6: } %lazy% lazy
7: stopifnot(!exists("x", inherits = FALSE))
8: res <- tryCatch(identical(v, 3), error = identity)
9: stopifnot(inherits(res, "error"))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[18]]
[[1]][[18]][[1]]
TestResult:
- Test:
- Title: '%<-% - errors and listenv'
- Tags: '%<-%', 'lazy', 'error', 'listenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: y <- listenv::listenv()
3: for (ii in 1:3) {
4: y[[ii]] %<-% {
5: if (ii%%2 == 0)
6: stop("Woops!")
7: ii
8: }
9: } %lazy% lazy
10: res <- tryCatch(as.list(y), error = identity)
11: stopifnot(inherits(res, "error"))
12: z <- y[c(1, 3)]
13: z <- unlist(z)
14: stopifnot(all(z == c(1, 3)))
15: res <- tryCatch(y[[2]], error = identity)
16: stopifnot(inherits(res, "error"))
17: res <- tryCatch(y[1:2], error = identity)
18: stopifnot(inherits(res, "error"))
19: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[18]][[2]]
TestResult:
- Test:
- Title: '%<-% - errors and listenv'
- Tags: '%<-%', 'lazy', 'error', 'listenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: y <- listenv::listenv()
3: for (ii in 1:3) {
4: y[[ii]] %<-% {
5: if (ii%%2 == 0)
6: stop("Woops!")
7: ii
8: }
9: } %lazy% lazy
10: res <- tryCatch(as.list(y), error = identity)
11: stopifnot(inherits(res, "error"))
12: z <- y[c(1, 3)]
13: z <- unlist(z)
14: stopifnot(all(z == c(1, 3)))
15: res <- tryCatch(y[[2]], error = identity)
16: stopifnot(inherits(res, "error"))
17: res <- tryCatch(y[1:2], error = identity)
18: stopifnot(inherits(res, "error"))
19: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[19]]
[[1]][[19]][[1]]
TestResult:
- Test:
- Title: '%<-% & %->%'
- Tags: '%<-%', '%->%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: c %<-% 1 %lazy% lazy
3: cat(sprintf("c = %s\n", c))
4: 1 %->% d %lazy% lazy
5: cat(sprintf("d = %s\n", d))
6: stopifnot(d == c)
7: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'c = 1'
2: 'd = 1'
- Success: TRUE
- Processing time: 0.062 secs
[[1]][[19]][[2]]
TestResult:
- Test:
- Title: '%<-% & %->%'
- Tags: '%<-%', '%->%', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: c %<-% 1 %lazy% lazy
3: cat(sprintf("c = %s\n", c))
4: 1 %->% d %lazy% lazy
5: cat(sprintf("d = %s\n", d))
6: stopifnot(d == c)
7: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Error: promise already under evaluation: recursive default argument reference or earlier problems?
- Captured output:
1: ''
- Success: FALSE
- Processing time: 0.000 secs
[[1]][[20]]
[[1]][[20]][[1]]
TestResult:
- Test:
- Title: '%<-% - nested'
- Tags: '%<-%', 'nested'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: a %<-% {
3: b <- 1
4: c %<-% 2
5: d <- 3
6: 4 %->% e
7: b + c + d + e
8: }
9: cat(sprintf("a = %s\n", a))
10: stopifnot(a == 10)
11: {
12: a + 1
13: } %->% b
14: cat(sprintf("b = %s\n", b))
15: stopifnot(b == a + 1)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'a = 10'
2: 'b = 11'
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[21]]
[[1]][[21]][[1]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: FALSE
2. globals: FALSE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000eb8f848'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 2 objects totaling 1.26 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 0 bytes of class 'NULL''
16: 'Conditions captured: [n=1] 'simpleError''
17: 'Early signaling: FALSE'
18: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
19: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
20: 'List of 2'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' - attr(*, "where")=List of 2'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1288'
31: ' - attr(*, "already-done")= logi TRUE'
32: '- FUN(): --------------------'
33: 'FUN : function (x, y) '
34: 'f : Classes 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' <environment: 0x000000000ebd9188> '
35: 'globals : logi FALSE'
36: 'lazy : logi FALSE'
37: 'stdout : logi TRUE'
38: 'v0 : num 90'
39: '-----------------------------'
40: 'List of 4'
41: ' $ globals: logi FALSE'
42: ' $ lazy : logi FALSE'
43: ' $ v0 : num 90'
44: ' $ res :List of 2'
45: ' ..$ message: chr "object 'a' not found"'
46: ' ..$ call : language (function (x, y) a * (x - y))(x = 42, y = 12)'
47: ' ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[21]][[2]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: TRUE
2. globals: FALSE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000f2898d0'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 2 objects totaling 1.26 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
19: 'Class: 'Future', 'environment''
20: 'List of 2'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' - attr(*, "where")=List of 2'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1288'
31: ' - attr(*, "already-done")= logi TRUE'
32: '- FUN(): --------------------'
33: 'FUN : function (x, y) '
34: 'f : Classes 'Future', 'environment' <environment: 0x000000000f2cf040> '
35: 'globals : logi FALSE'
36: 'lazy : logi TRUE'
37: 'stdout : logi TRUE'
38: 'v0 : num 90'
39: '-----------------------------'
40: 'List of 4'
41: ' $ globals: logi FALSE'
42: ' $ lazy : logi TRUE'
43: ' $ v0 : num 90'
44: ' $ res :List of 2'
45: ' ..$ message: chr "object 'a' not found"'
46: ' ..$ call : language (function (x, y) a * (x - y))(x = 42, y = 12)'
47: ' ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition"'
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[21]][[3]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000f9674e0'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
19: 'List of 3'
20: ' $ FUN :function (x, y) '
21: ' $ args:List of 2'
22: ' ..$ x: num 42'
23: ' ..$ y: num 12'
24: ' $ a : num 3'
25: ' - attr(*, "where")=List of 3'
26: ' ..$ FUN :<environment: R_EmptyEnv> '
27: ' ..$ args:<environment: R_EmptyEnv> '
28: ' ..$ a :<environment: R_EmptyEnv> '
29: ' - attr(*, "resolved")= logi FALSE'
30: ' - attr(*, "total_size")= num 1344'
31: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
32: ' - attr(*, "already-done")= logi TRUE'
33: '- FUN(): --------------------'
34: 'a : num 3'
35: '-----------------------------'
36: 'List of 4'
37: ' $ globals: logi TRUE'
38: ' $ lazy : logi FALSE'
39: ' $ v0 : num 90'
40: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[21]][[4]]
TestResult:
- Test:
- Title: 'futureCall()'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-automatic'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. globals: [n = 2] c(FALSE, TRUE)
=> Test combinations: 4 (= 2*2)
- Expression:
1: {
2: if (!isTRUE(getOption("future.tests.suppress_messages", TRUE))) {
3: options(future.debug = TRUE)
4: }
5: a <- 3
6: args <- list(x = 42, y = 12)
7: v0 <- do.call(function(x, y) a * (x - y), args = args)
8: f <- futureCall(function(x, y) a * (x - y), args = args,
9: globals = globals, lazy = lazy)
10: rm(list = c("a", "args"))
11: print(f)
12: str(f$globals)
13: cat("- FUN(): --------------------\n")
14: FUN <- f$globals$FUN
15: print(utils::ls.str(environment(FUN)))
16: cat("-----------------------------\n")
17: res <- tryCatch({
18: v <- value(f)
19: }, error = identity)
20: stopifnot(!inherits(res, "FutureError"))
21: if (!inherits(res, "error")) {
22: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
23: stopifnot(all.equal(v, v0))
24: }
25: else {
26: str(list(globals = globals, lazy = lazy, v0 = v0, res = res))
27: stopifnot(!globals)
28: }
29: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000dbb2af0'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (function 'FUN' of 1.15 KiB, list 'args' of 112 bytes, numeric 'a' of 56 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
19: 'Class: 'Future', 'environment''
20: 'List of 3'
21: ' $ FUN :function (x, y) '
22: ' $ args:List of 2'
23: ' ..$ x: num 42'
24: ' ..$ y: num 12'
25: ' $ a : num 3'
26: ' - attr(*, "where")=List of 3'
27: ' ..$ FUN :<environment: R_EmptyEnv> '
28: ' ..$ args:<environment: R_EmptyEnv> '
29: ' ..$ a :<environment: R_EmptyEnv> '
30: ' - attr(*, "resolved")= logi FALSE'
31: ' - attr(*, "total_size")= num 1344'
32: ' - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"'
33: ' - attr(*, "already-done")= logi TRUE'
34: '- FUN(): --------------------'
35: 'a : num 3'
36: '-----------------------------'
37: 'List of 4'
38: ' $ globals: logi TRUE'
39: ' $ lazy : logi TRUE'
40: ' $ v0 : num 90'
41: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[22]]
[[1]][[22]][[1]]
TestResult:
- Test:
- Title: 'futureCall() - globals = list(a = 3)'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-value'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) a * (x - y), args = args,
6: globals = list(a = 3), lazy = lazy)
7: rm(list = "args")
8: print(f)
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
15: stopifnot(all.equal(v, v0))
16: }
17: else {
18: stopifnot(!globals)
19: }
20: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000cfd1780'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
19: 'List of 4'
20: ' $ globals: logi TRUE'
21: ' $ lazy : logi FALSE'
22: ' $ v0 : num 90'
23: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[22]][[2]]
TestResult:
- Test:
- Title: 'futureCall() - globals = list(a = 3)'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-value'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) a * (x - y), args = args,
6: globals = list(a = 3), lazy = lazy)
7: rm(list = "args")
8: print(f)
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: str(list(globals = globals, lazy = lazy, v0 = v0, v = v))
15: stopifnot(all.equal(v, v0))
16: }
17: else {
18: stopifnot(!globals)
19: }
20: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Future:'
2: 'Label: '<none>''
3: 'Expression:'
4: 'do.call(what = FUN, args = args)'
5: 'Lazy evaluation: TRUE'
6: 'Asynchronous evaluation: TRUE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000e78ec00'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: 3 objects totaling 1.31 KiB (numeric 'a' of 56 bytes, function 'FUN' of 1.15 KiB, list 'args' of 112 bytes)'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)'
14: 'Resolved: FALSE'
15: 'Value: <not collected>'
16: 'Conditions captured: <none>'
17: 'Early signaling: FALSE'
18: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
19: 'Class: 'Future', 'environment''
20: 'List of 4'
21: ' $ globals: logi TRUE'
22: ' $ lazy : logi TRUE'
23: ' $ v0 : num 90'
24: ' $ v : num 90'
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[23]]
[[1]][[23]][[1]]
TestResult:
- Test:
- Title: 'futureCall() - globals = "a"'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-name'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) {
6: a * (x - y)
7: }, args = args, globals = "a", lazy = lazy)
8: rm(list = c("a", "args"))
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: stopifnot(all.equal(v, v0))
15: }
16: else {
17: }
18: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[23]][[2]]
TestResult:
- Test:
- Title: 'futureCall() - globals = "a"'
- Tags: 'futureCall', 'lazy', 'globals', 'globals-by-name'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 3
3: args <- list(x = 42, y = 12)
4: v0 <- do.call(function(x, y) a * (x - y), args = args)
5: f <- futureCall(function(x, y) {
6: a * (x - y)
7: }, args = args, globals = "a", lazy = lazy)
8: rm(list = c("a", "args"))
9: res <- tryCatch({
10: v <- value(f)
11: }, error = identity)
12: stopifnot(!inherits(res, "FutureError"))
13: if (!inherits(res, "error")) {
14: stopifnot(all.equal(v, v0))
15: }
16: else {
17: }
18: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[24]]
[[1]][[24]][[1]]
TestResult:
- Test:
- Title: 'future() - rm() a global variable'
- Tags: 'future', 'globalenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 42
3: f <- future({
4: a
5: a <- 3.14
6: rm(a)
7: a
8: }, lazy = lazy)
9: rm(list = "a")
10: stopifnot(value(f) == 42L)
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[24]][[2]]
TestResult:
- Test:
- Title: 'future() - rm() a global variable'
- Tags: 'future', 'globalenv'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: a <- 42
3: f <- future({
4: a
5: a <- 3.14
6: rm(a)
7: a
8: }, lazy = lazy)
9: rm(list = "a")
10: stopifnot(value(f) == 42L)
11: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[25]]
[[1]][[25]][[1]]
TestResult:
- Test:
- Title: 'future() - non-exported package objects'
- Tags: 'future', 'globals'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: if (requireNamespace("utils") && require("utils")) {
3: env <- pos.to.env(match("package:utils", search()))
4: ns <- getNamespace("utils")
5: privates <- setdiff(names(ns), names(env))
6: non_exported <- NULL
7: for (name in privates) {
8: if (exists(name, envir = ns, mode = "function", inherits = FALSE)) {
9: non_exported <- get(name, envir = ns, mode = "function",
10: inherits = FALSE)
11: }
12: }
13: stopifnot(is.function(non_exported))
14: f <- future({
15: non_exported
16: }, lazy = TRUE)
17: stopifnot("non_exported" %in% names(f$globals), identical(f$globals[["non_exported"]],
18: non_exported))
19: v <- value(f)
20: stopifnot(identical(v, non_exported))
21: }
22: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.109 secs
[[1]][[26]]
[[1]][[26]][[1]]
TestResult:
- Test:
- Title: 'future() - NSE '...''
- Tags: 'future', 'globals', '...'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: my_fcn <- function(...) {
3: globals <- globals::globalsByName("...", envir = environment())
4: f <- future({
5: fcn <- function() sum(...)
6: fcn()
7: }, envir = parent.frame(), globals = globals)
8: v <- value(f)
9: v
10: }
11: y <- my_fcn()
12: stopifnot(y == 0L)
13: y <- my_fcn(1:10)
14: stopifnot(identical(y, 55L))
15: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[27]]
[[1]][[27]][[1]]
TestResult:
- Test:
- Title: 'resolved() on lazy futures'
- Tags: 'resolved', 'lazy'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f <- future(42, lazy = TRUE)
3: while (!resolved(f)) {
4: Sys.sleep(0.1)
5: }
6: v <- value(f)
7: stopifnot(identical(v, 42))
8: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[28]]
[[1]][[28]][[1]]
TestResult:
- Test:
- Title: 'demo("mandelbrot", package = "future")'
- Tags: 'demo', 'mandelbrot'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: if (getRversion() <= "3.2.0") {
3: message("Test requires R (>= 3.2.0). Skipping")
4: return()
5: }
6: options(future.demo.mandelbrot.nrow = 2L)
7: options(future.demo.mandelbrot.resolution = 50L)
8: options(future.demo.mandelbrot.delay = FALSE)
9: on.exit(grDevices::graphics.off())
10: demo("mandelbrot", package = "future", ask = FALSE)
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(value = NULL, visible = FALSE)
- Visible: FALSE
- Captured output:
1: ''
2: ''
3: ' demo(mandelbrot)'
4: ' ---- ~~~~~~~~~~'
5: ''
6: '> library("future")'
7: ''
8: '> library("graphics")'
9: ''
10: '> plot_what_is_done <- function(counts) {'
11: '+ for (kk in seq_along(counts)) {'
12: '+ f <- counts[[kk]]'
13: '+ '
14: '+ ## Already plotted?'
15: '+ if (!inherits(f, "Future")) next'
16: '+ '
17: '+ ## Not resolved?'
18: '+ if (!resolved(f)) next'
19: '+ '
20: '+ message(sprintf("Plotting tile #%d of %d ...", kk, n))'
21: '+ counts[[kk]] <- value(f)'
22: '+ screen(kk)'
23: '+ plot(counts[[kk]])'
24: '+ }'
25: '+ '
26: '+ counts'
27: '+ }'
28: ''
29: '> ## Options'
30: '> region <- getOption("future.demo.mandelbrot.region", 1L)'
31: ''
32: '> if (!is.list(region)) {'
33: '+ if (region == 1L) {'
34: '+ region <- list(xmid = -0.75, ymid = 0.0, side = 3.0)'
35: '+ } else if (region == 2L) {'
36: '+ region <- list(xmid = 0.283, ymid = -0.0095, side = 0.00026)'
37: '+ } else if (region == 3L) {'
38: '+ region <- list(xmid = 0.282989, ymid = -0.01, side = 3e-8)'
39: '+ }'
40: '+ }'
41: ''
42: '> nrow <- getOption("future.demo.mandelbrot.nrow", 3L)'
43: ''
44: '> resolution <- getOption("future.demo.mandelbrot.resolution", 400L)'
45: ''
46: '> delay <- getOption("future.demo.mandelbrot.delay", interactive())'
47: ''
48: '> if (isTRUE(delay)) {'
49: '+ delay <- function(counts) Sys.sleep(1.0)'
50: '+ } else if (!is.function(delay)) {'
51: '+ delay <- function(counts) {}'
52: '+ }'
53: ''
54: '> ## Generate Mandelbrot tiles to be computed'
55: '> Cs <- mandelbrot_tiles(xmid = region$xmid, ymid = region$ymid,'
56: '+ side = region$side, nrow = nrow,'
57: '+ resolution = resolution)'
58: ''
59: '> if (interactive()) {'
60: '+ dev.new()'
61: '+ plot.new()'
62: '+ split.screen(dim(Cs))'
63: '+ for (ii in seq_along(Cs)) {'
64: '+ screen(ii)'
65: '+ par(mar = c(0, 0, 0, 0))'
66: '+ text(x = 1 / 2, y = 1 / 2, sprintf("Future #%d\nunresolved", ii), cex = 2)'
67: '+ }'
68: '+ } else {'
69: '+ split.screen(dim(Cs))'
70: '+ }'
71: '[1] 1 2 3 4'
72: ''
73: '> ## Create all Mandelbrot tiles via lazy futures'
74: '> n <- length(Cs)'
75: ''
76: '> message(sprintf("Creating %d Mandelbrot tiles:", n), appendLF = FALSE)'
77: ''
78: '> counts <- lapply(seq_along(Cs), FUN=function(ii) {'
79: '+ message(" ", ii, appendLF = FALSE)'
80: '+ C <- Cs[[ii]]'
81: '+ future({'
82: '+ message(sprintf("Calculating tile #%d of %d ...", ii, n), appendLF = FALSE)'
83: '+ fit <- mandelbrot(C)'
84: '+ '
85: '+ ## Emulate slowness'
86: '+ delay(fit)'
87: '+ '
88: '+ message(" done")'
89: '+ fit'
90: '+ }, lazy = TRUE)'
91: '+ })'
92: ''
93: '> message(".")'
94: ''
95: '> ## Calculate and plot tiles'
96: '> repeat {'
97: '+ counts <- plot_what_is_done(counts)'
98: '+ if (!any(sapply(counts, FUN = inherits, "Future"))) break'
99: '+ }'
100: ''
101: '> close.screen()'
102: '[1] 1 2 3 4'
103: ''
104: '> message("SUGGESTION: Try to rerun this demo after changing strategy for how futures are resolved, e.g. plan(multisession).\n")'
- Success: TRUE
- Processing time: 0.499 secs
[[1]][[28]][[2]]
TestResult:
- Test:
- Title: 'demo("mandelbrot", package = "future")'
- Tags: 'demo', 'mandelbrot'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: if (getRversion() <= "3.2.0") {
3: message("Test requires R (>= 3.2.0). Skipping")
4: return()
5: }
6: options(future.demo.mandelbrot.nrow = 2L)
7: options(future.demo.mandelbrot.resolution = 50L)
8: options(future.demo.mandelbrot.delay = FALSE)
9: on.exit(grDevices::graphics.off())
10: demo("mandelbrot", package = "future", ask = FALSE)
11: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(value = NULL, visible = FALSE)
- Visible: FALSE
- Captured output:
1: ''
2: ''
3: ' demo(mandelbrot)'
4: ' ---- ~~~~~~~~~~'
5: ''
6: '> library("future")'
7: ''
8: '> library("graphics")'
9: ''
10: '> plot_what_is_done <- function(counts) {'
11: '+ for (kk in seq_along(counts)) {'
12: '+ f <- counts[[kk]]'
13: '+ '
14: '+ ## Already plotted?'
15: '+ if (!inherits(f, "Future")) next'
16: '+ '
17: '+ ## Not resolved?'
18: '+ if (!resolved(f)) next'
19: '+ '
20: '+ message(sprintf("Plotting tile #%d of %d ...", kk, n))'
21: '+ counts[[kk]] <- value(f)'
22: '+ screen(kk)'
23: '+ plot(counts[[kk]])'
24: '+ }'
25: '+ '
26: '+ counts'
27: '+ }'
28: ''
29: '> ## Options'
30: '> region <- getOption("future.demo.mandelbrot.region", 1L)'
31: ''
32: '> if (!is.list(region)) {'
33: '+ if (region == 1L) {'
34: '+ region <- list(xmid = -0.75, ymid = 0.0, side = 3.0)'
35: '+ } else if (region == 2L) {'
36: '+ region <- list(xmid = 0.283, ymid = -0.0095, side = 0.00026)'
37: '+ } else if (region == 3L) {'
38: '+ region <- list(xmid = 0.282989, ymid = -0.01, side = 3e-8)'
39: '+ }'
40: '+ }'
41: ''
42: '> nrow <- getOption("future.demo.mandelbrot.nrow", 3L)'
43: ''
44: '> resolution <- getOption("future.demo.mandelbrot.resolution", 400L)'
45: ''
46: '> delay <- getOption("future.demo.mandelbrot.delay", interactive())'
47: ''
48: '> if (isTRUE(delay)) {'
49: '+ delay <- function(counts) Sys.sleep(1.0)'
50: '+ } else if (!is.function(delay)) {'
51: '+ delay <- function(counts) {}'
52: '+ }'
53: ''
54: '> ## Generate Mandelbrot tiles to be computed'
55: '> Cs <- mandelbrot_tiles(xmid = region$xmid, ymid = region$ymid,'
56: '+ side = region$side, nrow = nrow,'
57: '+ resolution = resolution)'
58: ''
59: '> if (interactive()) {'
60: '+ dev.new()'
61: '+ plot.new()'
62: '+ split.screen(dim(Cs))'
63: '+ for (ii in seq_along(Cs)) {'
64: '+ screen(ii)'
65: '+ par(mar = c(0, 0, 0, 0))'
66: '+ text(x = 1 / 2, y = 1 / 2, sprintf("Future #%d\nunresolved", ii), cex = 2)'
67: '+ }'
68: '+ } else {'
69: '+ split.screen(dim(Cs))'
70: '+ }'
71: '[1] 1 2 3 4'
72: ''
73: '> ## Create all Mandelbrot tiles via lazy futures'
74: '> n <- length(Cs)'
75: ''
76: '> message(sprintf("Creating %d Mandelbrot tiles:", n), appendLF = FALSE)'
77: ''
78: '> counts <- lapply(seq_along(Cs), FUN=function(ii) {'
79: '+ message(" ", ii, appendLF = FALSE)'
80: '+ C <- Cs[[ii]]'
81: '+ future({'
82: '+ message(sprintf("Calculating tile #%d of %d ...", ii, n), appendLF = FALSE)'
83: '+ fit <- mandelbrot(C)'
84: '+ '
85: '+ ## Emulate slowness'
86: '+ delay(fit)'
87: '+ '
88: '+ message(" done")'
89: '+ fit'
90: '+ }, lazy = TRUE)'
91: '+ })'
92: ''
93: '> message(".")'
94: ''
95: '> ## Calculate and plot tiles'
96: '> repeat {'
97: '+ counts <- plot_what_is_done(counts)'
98: '+ if (!any(sapply(counts, FUN = inherits, "Future"))) break'
99: '+ }'
100: ''
101: '> close.screen()'
102: '[1] 1 2 3 4'
103: ''
104: '> message("SUGGESTION: Try to rerun this demo after changing strategy for how futures are resolved, e.g. plan(multisession).\n")'
- Success: TRUE
- Processing time: 0.998 secs
[[1]][[29]]
[[1]][[29]][[1]]
TestResult:
- Test:
- Title: 'nbrOfWorkers()'
- Tags: 'nbrOfWorkers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: n <- nbrOfWorkers()
3: message(sprintf("nbrOfWorkers: %g", n))
4: stopifnot(is.numeric(n), length(n) == 1L, n >= 1L)
5: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[30]]
[[1]][[30]][[1]]
TestResult:
- Test:
- Title: 'future() - preserve R options'
- Tags: 'future', 'options', 'reset', 'data.table'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: if (requireNamespace("data.table")) {
3: data.table <- data.table::data.table
4: for (kk in 1:2) {
5: f <- future(data.table())
6: v <- value(f)
7: print(v)
8: stopifnot(inherits(v, "data.frame"), inherits(v,
9: "data.table"), nrow(v) == 0L, ncol(v) == 0L)
10: }
11: }
12: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'Null data.table (0 rows and 0 cols)'
2: 'Null data.table (0 rows and 0 cols)'
- Success: TRUE
- Processing time: 0.281 secs
[[1]][[31]]
[[1]][[31]][[1]]
TestResult:
- Test:
- Title: 'future() - preserve R options'
- Tags: 'future', 'options', 'reset', 'ff'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: info <- Sys.info()
3: is_localhost <- value(future(identical(Sys.info(), info)))
4: if (is_localhost && requireNamespace("ff")) {
5: data <- ff::ff(1:12)
6: for (kk in 1:2) {
7: f <- future(data[4], packages = "ff")
8: v <- value(f)
9: print(v)
10: stopifnot(is.integer(v), length(v) == 1L, identical(v,
11: 4L))
12: }
13: }
14: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] 4'
2: '[1] 4'
- Success: TRUE
- Processing time: 0.218 secs
[[1]][[32]]
[[1]][[32]][[1]]
TestResult:
- Test:
- Title: 'plan()'
- Tags: 'plan'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: print(current_plan)
4: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: structure(function (..., envir = parent.frame()) , {, future <- SequentialFuture(..., envir = envir), if (!future$lazy) , future <- run(future), invisible(future), }, class = c("FutureStrategy", "sequential", "uniprocess", "future", , "function"), call = plan(sequential))
- Visible: FALSE
- Captured output:
1: 'sequential:'
2: '- args: function (..., envir = parent.frame())'
3: '- tweaked: FALSE'
4: '- call: plan(sequential)'
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[33]]
[[1]][[33]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<numeric>'
- Tags: 'plan', 'workers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: if (!inherits(current_plan, "multiprocess"))
4: return()
5: plan(current_plan, workers = 1L)
6: n <- nbrOfWorkers()
7: cat(sprintf("Number of workers: %d\n", n))
8: stopifnot(n == 1L)
9: f <- future(42L)
10: stopifnot(value(f) == 42L)
11: plan(current_plan, workers = 2L)
12: n <- nbrOfWorkers()
13: cat(sprintf("Number of workers: %d\n", n))
14: stopifnot(n == 2L)
15: f <- future(42L)
16: stopifnot(value(f) == 42L)
17: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[34]]
[[1]][[34]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<function>'
- Tags: 'plan', 'workers'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: n0 <- nbrOfWorkers()
4: if (!inherits(current_plan, "multiprocess"))
5: return()
6: workers_value <- eval(formals(current_plan)$workers)
7: workers <- function() workers_value
8: plan(current_plan, workers = workers)
9: n <- nbrOfWorkers()
10: cat(sprintf("Number of workers: %d\n", n))
11: stopifnot(n == n0)
12: f <- future(42L)
13: stopifnot(value(f) == 42L)
14: workers <- function() 1L
15: plan(current_plan, workers = workers)
16: n <- nbrOfWorkers()
17: cat(sprintf("Number of workers: %d\n", n))
18: stopifnot(n == 1L)
19: f <- future(42L)
20: stopifnot(value(f) == 42L)
21: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[35]]
[[1]][[35]][[1]]
TestResult:
- Test:
- Title: 'plan() - workers=<invalid>'
- Tags: 'plan', 'workers', 'exceptions'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: current_plan <- plan()
3: if (!inherits(current_plan, "multiprocess"))
4: return()
5: res <- tryCatch({
6: plan(current_plan, workers = 0L)
7: }, error = identity)
8: print(res)
9: stopifnot(inherits(res, "error"))
10: res <- tryCatch({
11: plan(current_plan, workers = NA_integer_)
12: }, error = identity)
13: print(res)
14: stopifnot(inherits(res, "error"))
15: res <- tryCatch({
16: plan(current_plan, workers = TRUE)
17: }, error = identity)
18: print(res)
19: stopifnot(inherits(res, "error"))
20: res <- tryCatch({
21: plan(current_plan, workers = NA_character_)
22: }, error = identity)
23: print(res)
24: stopifnot(inherits(res, "error"))
25: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: TRUE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[36]]
[[1]][[36]][[1]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.936 secs
[[1]][[36]][[2]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.827 secs
[[1]][[36]][[3]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.562 secs
[[1]][[36]][[4]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.530 secs
[[1]][[36]][[5]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.515 secs
[[1]][[36]][[6]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.515 secs
[[1]][[36]][[7]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.515 secs
[[1]][[36]][[8]]
TestResult:
- Test:
- Title: 'resolve()'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future({
3: Sys.sleep(0.5)
4: list(a = 1, b = 42L)
5: }, lazy = lazy)
6: res <- resolve(f, result = result, recursive = recursive)
7: stopifnot(identical(res, f))
8: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.515 secs
[[1]][[37]]
[[1]][[37]][[1]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[37]][[2]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[37]][[3]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[37]][[4]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: FALSE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[37]][[5]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[37]][[6]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: FALSE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.000 secs
[[1]][[37]][[7]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: FALSE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[37]][[8]]
TestResult:
- Test:
- Title: 'resolve() - run-time exception'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
2. result: [n = 2] c(FALSE, TRUE)
3. recursive: [n = 2] c(FALSE, TRUE)
=> Test combinations: 8 (= 2*2*2)
- Expression:
1: {
2: f <- future(list(a = 1, b = 42L, c = stop("Nah!")), lazy = lazy)
3: res <- resolve(f, result = result, recursive = recursive)
4: stopifnot(identical(res, f))
5: }
- Arguments tested:
1. lazy: TRUE
2. result: TRUE
3. recursive: TRUE
4. globals: TRUE
5. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[38]]
[[1]][[38]][[1]]
TestResult:
- Test:
- Title: 'resolve(<list of futures and values>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[38]][[2]]
TestResult:
- Test:
- Title: 'resolve(<list of futures and values>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[39]]
[[1]][[39]][[1]]
TestResult:
- Test:
- Title: 'resolve(<list of futures>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = !lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[39]][[2]]
TestResult:
- Test:
- Title: 'resolve(<list of futures>)'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: x <- list()
3: x$a <- future(1, lazy = lazy)
4: x$b <- future(2, lazy = !lazy)
5: x[[3]] <- 3
6: y <- resolve(x)
7: stopifnot(identical(y, x))
8: stopifnot(resolved(x$a))
9: stopifnot(resolved(x[["b"]]))
10: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[40]]
[[1]][[40]][[1]]
TestResult:
- Test:
- Title: 'resolve(<named matrix list of futures and values>) - time ordering'
- Tags: 'resolve', 'lazy'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: x <- list()
3: x$a <- future(1)
4: x$b <- future({
5: Sys.sleep(0.5)
6: 2
7: })
8: x[[4]] <- 4
9: dim(x) <- c(2, 2)
10: y <- resolve(x, idxs = 1)
11: stopifnot(identical(y, x))
12: stopifnot(resolved(x[[1]]))
13: y <- resolve(x, idxs = 2)
14: stopifnot(identical(y, x))
15: stopifnot(resolved(x[[2]]))
16: y <- resolve(x, idxs = 3)
17: stopifnot(identical(y, x))
18: y <- resolve(x, idxs = seq_along(x))
19: stopifnot(identical(y, x))
20: y <- resolve(x, idxs = names(x))
21: stopifnot(identical(y, x))
22: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.530 secs
[[1]][[41]]
[[1]][[41]][[1]]
TestResult:
- Test:
- Title: 'resolved() - assert non-blocking while launching lazy futures'
- Tags: 'resolved', 'lazy'
- Reset workers: TRUE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: message("Creating lazy futures:")
3: n <- min(3, nbrOfWorkers() + 1L)
4: xs <- as.list(1:n)
5: fs <- lapply(xs, FUN = function(kk) {
6: future({
7: Sys.sleep(kk)
8: kk
9: }, lazy = TRUE)
10: })
11: vs <- vector("list", length = length(fs))
12: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
13: print(ss)
14: stopifnot(all(ss == "created"))
15: rs <- rep(NA, times = length(fs))
16: for (ff in seq_along(fs)) {
17: for (kk in ff:length(fs)) {
18: message(sprintf("Checking if future #%d is resolved:",
19: kk))
20: rs[[kk]] <- resolved(fs[[kk]])
21: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
22: print(ss)
23: nbrOfFinished <- sum(ss == "finished")
24: if (inherits(fs[[kk]], "UniprocessFuture")) {
25: stopifnot(rs[[kk]])
26: stopifnot(ss[[kk]] == "finished")
27: }
28: else if (inherits(fs[[kk]], "MultiprocessFuture")) {
29: if (nbrOfWorkers() + ff - 1L + nbrOfFinished >=
30: kk) {
31: stopifnot(ss[[kk]] == "running")
32: }
33: else {
34: stopifnot(ss[[kk]] == "created")
35: }
36: stopifnot(!rs[[kk]])
37: }
38: }
39: message(sprintf("Waiting for future #%d to finish ... ",
40: ff), appendLF = FALSE)
41: vs[[ff]] <- value(fs[[ff]])
42: message("done")
43: rs[[ff]] <- resolved(fs[[ff]])
44: stopifnot(rs[ff])
45: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
46: stopifnot(ss[ff] == "finished")
47: nbrOfFinished <- sum(ss == "finished")
48: if (inherits(fs[[kk]], "UniprocessFuture")) {
49: stopifnot(nbrOfFinished == length(fs))
50: }
51: else {
52: stopifnot(nbrOfFinished == ff)
53: }
54: }
55: ss <- vapply(fs, FUN = function(f) f$state, NA_character_)
56: print(ss)
57: stopifnot(all(ss == "finished"))
58: message("Collecting values:")
59: vs <- value(fs)
60: str(vs)
61: stopifnot(identical(vs, xs))
62: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] "created" "created"'
2: '[1] "finished" "created" '
3: '[1] "finished" "finished"'
4: '[1] "finished" "finished"'
5: '[1] "finished" "finished"'
6: 'List of 2'
7: ' $ : int 1'
8: ' $ : int 2'
- Success: TRUE
- Processing time: 3.104 secs
[[1]][[42]]
[[1]][[42]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - seeds and preserving RNGkind'
- Tags: 'rng', 'seed'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: okind <- RNGkind()
3: seed <- c(407L, 1420090545L, 65713854L, -990249945L, 1780737596L,
4: -1213437427L, 1082168682L)
5: f <- future(42, seed = seed)
6: print(f)
7: stopifnot(identical(f$seed, seed))
8: stopifnot(identical(RNGkind()[1], okind[1]))
9: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: 'SequentialFuture:'
2: 'Label: '<none>''
3: 'Expression:'
4: '[1] 42'
5: 'Lazy evaluation: FALSE'
6: 'Asynchronous evaluation: FALSE'
7: 'Local evaluation: TRUE'
8: 'Environment: 0x000000000f945c90'
9: 'Capture standard output: TRUE'
10: 'Capture condition classes: 'condition' (excluding 'nothing')'
11: 'Globals: <none>'
12: 'Packages: <none>'
13: 'L'Ecuyer-CMRG RNG seed: c(407, 1420090545, 65713854, -990249945, 1780737596, -1213437427, 1082168682)'
14: 'Resolved: TRUE'
15: 'Value: 56 bytes of class 'numeric''
16: 'Early signaling: FALSE'
17: 'Owner process: c802a6ba-d71f-b860-c40c-08c750a7743a'
18: 'Class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[43]]
[[1]][[43]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - future'
- Tags: 'rng', 'seed', 'lazy', 'future'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "future", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(3L, 0L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x00000000081a0ad8>'
147: '<environment: 0x00000000081dfaa0>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 3'
164: ''
165: '[[2]]'
166: '[1] 0'
167: ''
- Success: TRUE
- Processing time: 0.156 secs
[[1]][[43]][[2]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - future'
- Tags: 'rng', 'seed', 'lazy', 'future'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "future", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "future", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(0L, 3L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x00000000081a0ad8>'
147: '<environment: 0x00000000081dfaa0>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 0'
164: ''
165: '[[2]]'
166: '[1] 3'
167: ''
- Success: TRUE
- Processing time: 0.125 secs
[[1]][[44]]
[[1]][[44]][[1]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - %<-%'
- Tags: 'rng', 'seed', 'lazy', '%<-%'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "%<-%", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(3L, 2L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x00000000081a0ad8>'
147: '<environment: 0x00000000081dfaa0>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 3'
164: ''
165: '[[2]]'
166: '[1] 2'
167: ''
- Success: TRUE
- Processing time: 0.109 secs
[[1]][[44]][[2]]
TestResult:
- Test:
- Title: 'Random Number Generation (RNG) - %<-%'
- Tags: 'rng', 'seed', 'lazy', '%<-%'
- Reset workers: FALSE
- Arguments:
1. lazy: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: fsample <- function (x, size = 2L, seed = NULL, what = c("future",
3: "%<-%"), lazy = FALSE)
4: {
5: what <- match.arg(what)
6: .GlobalEnv <- globalenv()
7: oseed <- .GlobalEnv$.Random.seed
8: orng <- RNGkind("L'Ecuyer-CMRG")[1L]
9: on.exit(RNGkind(orng))
10: if (!is.null(seed)) {
11: on.exit({
12: if (is.null(oseed)) {
13: rm(list = ".Random.seed", envir = .GlobalEnv,
14: inherits = FALSE)
15: } else {
16: .GlobalEnv$.Random.seed <- oseed
17: }
18: }, add = TRUE)
19: set.seed(seed)
20: }
21: .seed <- .Random.seed
22: if (what == "future") {
23: fs <- list()
24: for (ii in seq_len(size)) {
25: .seed <- parallel::nextRNGStream(.seed)
26: fs[[ii]] <- future({
27: sample(x, size = 1L)
28: }, lazy = lazy, seed = .seed)
29: }
30: res <- value(fs)
31: }
32: else {
33: res <- listenv::listenv()
34: for (ii in seq_len(size)) {
35: .seed <- parallel::nextRNGStream(.seed)
36: res[[ii]] %<-% {
37: sample(x, size = 1L)
38: } %lazy% lazy %seed% .seed
39: }
40: res <- as.list(res)
41: }
42: res
43: }
44: dummy <- sample(0:3, size = 1L)
45: seed0 <- .Random.seed
46: y0 <- local({
47: print(unclass(plan))
48: utils::str(plan)
49: old_plan <- plan()
50: plan("sequential")
51: on.exit(plan(old_plan))
52: fsample(0:3, seed = 42L)
53: })
54: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
55: .GlobalEnv$.Random.seed <- seed0
56: y1 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
57: print(y1)
58: stopifnot(identical(y1, y0))
59: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
60: y2 <- fsample(0:3, seed = 42L, what = "%<-%", lazy = lazy)
61: print(y2)
62: stopifnot(identical(y2, y1))
63: stopifnot(identical(y2, y0))
64: stopifnot(identical(.GlobalEnv$.Random.seed, seed0))
65: y3 <- fsample(0:3, what = "%<-%", lazy = lazy)
66: print(y3)
67: }
- Arguments tested:
1. lazy: TRUE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: list(1L, 0L)
- Visible: FALSE
- Captured output:
1: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, '
2: ' .call = TRUE, .cleanup = TRUE, .init = TRUE) '
3: '{'
4: ' if (substitute) '
5: ' strategy <- substitute(strategy)'
6: ' if (is.logical(.skip)) '
7: ' stop_if_not(length(.skip) == 1L, !is.na(.skip))'
8: ' if (is.logical(.call)) '
9: ' stop_if_not(length(.call) == 1L, !is.na(.call))'
10: ' if (is.null(strategy) || identical(strategy, "next")) {'
11: ' strategy <- stack[[1L]]'
12: ' if (!inherits(strategy, "FutureStrategy")) {'
13: ' class(strategy) <- c("FutureStrategy", class(strategy))'
14: ' }'
15: ' stop_if_not(is.function(strategy))'
16: ' return(strategy)'
17: ' }'
18: ' else if (identical(strategy, "default")) {'
19: ' strategy <- getOption("future.plan", sequential)'
20: ' }'
21: ' else if (identical(strategy, "list")) {'
22: ' return(stack)'
23: ' }'
24: ' else if (identical(strategy, "reset")) {'
25: ' stack <<- defaultStack'
26: ' if (.cleanup) '
27: ' plan_cleanup()'
28: ' return(stack)'
29: ' }'
30: ' else if (identical(strategy, "pop")) {'
31: ' oldStack <- stack'
32: ' stack <<- stack[-1L]'
33: ' if (length(stack) == 0L) '
34: ' stack <<- defaultStack'
35: ' return(oldStack)'
36: ' }'
37: ' oldStack <- stack'
38: ' newStack <- NULL'
39: ' targs <- list(...)'
40: ' if (is.function(strategy)) {'
41: ' if (length(targs) > 0) {'
42: ' args <- c(list(strategy), targs, penvir = parent.frame())'
43: ' strategy <- do.call(tweak, args = args)'
44: ' }'
45: ' strategy <- list(strategy)'
46: ' }'
47: ' if (is.list(strategy)) {'
48: ' oldStack <- plan_set(strategy, skip = .skip, cleanup = .cleanup, '
49: ' init = .init)'
50: ' return(invisible(oldStack))'
51: ' }'
52: ' if (is.language(strategy)) {'
53: ' first <- as.list(strategy)[[1]]'
54: ' if (is.symbol(first)) {'
55: ' if (is.call(strategy)) {'
56: ' first <- get(as.character(first), mode = "function", '
57: ' envir = parent.frame(), inherits = TRUE)'
58: ' }'
59: ' else {'
60: ' first <- eval(first, envir = parent.frame(), '
61: ' enclos = baseenv())'
62: ' }'
63: ' if (is.list(first)) {'
64: ' strategies <- first'
65: ' res <- plan(strategies, substitute = FALSE, .cleanup = .cleanup, '
66: ' .init = .init)'
67: ' return(invisible(res))'
68: ' }'
69: ' if (is.function(first) && !inherits(first, "future")) {'
70: ' strategies <- eval(strategy, envir = parent.frame(), '
71: ' enclos = baseenv())'
72: ' if (is.list(strategies)) {'
73: ' for (kk in seq_along(strategies)) {'
74: ' strategy_kk <- strategies[[kk]]'
75: ' if (is.character(strategy_kk)) {'
76: ' strategy_kk <- tweak(strategy_kk, penvir = parent.frame())'
77: ' strategies[[kk]] <- strategy_kk'
78: ' }'
79: ' }'
80: ' newStack <- strategies'
81: ' stop_if_not(!is.null(newStack), is.list(newStack), '
82: ' length(newStack) >= 1L)'
83: ' }'
84: ' else if (is.function(strategies) && !inherits(strategies, '
85: ' "future")) {'
86: ' strategies <- list(strategies)'
87: ' newStack <- strategies'
88: ' stop_if_not(!is.null(newStack), is.list(newStack), '
89: ' length(newStack) >= 1L)'
90: ' }'
91: ' }'
92: ' }'
93: ' }'
94: ' if (is.null(newStack)) {'
95: ' if (is.symbol(strategy)) {'
96: ' strategy <- eval(strategy, envir = parent.frame(), '
97: ' enclos = baseenv())'
98: ' }'
99: ' else if (is.language(strategy)) {'
100: ' strategyT <- as.list(strategy)'
101: ' if (strategyT[[1]] == as.symbol("tweak")) {'
102: ' strategy <- eval(strategy, envir = parent.frame(), '
103: ' enclos = baseenv())'
104: ' }'
105: ' else {'
106: ' isSymbol <- sapply(strategyT, FUN = is.symbol)'
107: ' if (!all(isSymbol)) {'
108: ' strategy <- eval(strategyT[[1L]], envir = parent.frame(), '
109: ' enclos = baseenv())'
110: ' if (length(strategyT) > 1L) {'
111: ' args <- c(list(strategy), strategyT[-1L], '
112: ' penvir = parent.frame())'
113: ' strategy <- do.call(tweak, args = args)'
114: ' }'
115: ' }'
116: ' else {'
117: ' strategy <- eval(strategy, envir = parent.frame(), '
118: ' enclos = baseenv())'
119: ' }'
120: ' }'
121: ' }'
122: ' args <- c(list(strategy), targs, penvir = parent.frame())'
123: ' tstrategy <- do.call(tweak, args = args, quote = TRUE)'
124: ' newStack <- list(tstrategy)'
125: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
126: ' 1L)'
127: ' }'
128: ' if (!is.null(.call)) {'
129: ' call <- if (isTRUE(.call)) '
130: ' sys.call()'
131: ' else .call'
132: ' for (kk in seq_along(newStack)) {'
133: ' strategy <- newStack[[kk]]'
134: ' if (!is.null(attr(strategy, "call", exact = TRUE))) '
135: ' next'
136: ' attr(strategy, "call") <- call'
137: ' newStack[[kk]] <- strategy'
138: ' }'
139: ' stop_if_not(!is.null(newStack), is.list(newStack), length(newStack) >= '
140: ' 1L)'
141: ' }'
142: ' oldStack <- plan_set(newStack, skip = .skip, cleanup = .cleanup, '
143: ' init = .init)'
144: ' invisible(oldStack)'
145: '}'
146: '<bytecode: 0x00000000081a0ad8>'
147: '<environment: 0x00000000081dfaa0>'
148: 'function (strategy = NULL, ..., substitute = TRUE, .skip = FALSE, .call = TRUE, '
149: ' .cleanup = TRUE, .init = TRUE) '
150: '[[1]]'
151: '[1] 2'
152: ''
153: '[[2]]'
154: '[1] 0'
155: ''
156: '[[1]]'
157: '[1] 2'
158: ''
159: '[[2]]'
160: '[1] 0'
161: ''
162: '[[1]]'
163: '[1] 1'
164: ''
165: '[[2]]'
166: '[1] 0'
167: ''
- Success: TRUE
- Processing time: 0.094 secs
[[1]][[45]]
[[1]][[45]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - future() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: rng0 <- globalenv()$.Random.seed
3: f1 <- future(1)
4: stopifnot(identical(globalenv()$.Random.seed, rng0))
5: f2 <- future(2)
6: stopifnot(identical(globalenv()$.Random.seed, rng0))
7: v1 <- value(f1)
8: stopifnot(identical(v1, 1))
9: v2 <- value(f2)
10: stopifnot(identical(v2, 2))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[46]]
[[1]][[46]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - run() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1, lazy = TRUE)
3: f2 <- future(2, lazy = TRUE)
4: rng0 <- globalenv()$.Random.seed
5: f1 <- run(f1)
6: stopifnot(identical(globalenv()$.Random.seed, rng0))
7: f2 <- run(f2)
8: stopifnot(identical(globalenv()$.Random.seed, rng0))
9: v1 <- value(f1)
10: stopifnot(identical(v1, 1))
11: v2 <- value(f2)
12: stopifnot(identical(v2, 2))
13: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[47]]
[[1]][[47]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - result() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1)
3: f2 <- future(2)
4: rng0 <- globalenv()$.Random.seed
5: r1 <- result(f1)
6: stopifnot(identical(r1$value, 1))
7: stopifnot(identical(globalenv()$.Random.seed, rng0))
8: r2 <- result(f2)
9: stopifnot(identical(r2$value, 2))
10: stopifnot(identical(globalenv()$.Random.seed, rng0))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[48]]
[[1]][[48]][[1]]
TestResult:
- Test:
- Title: 'Orchestration Stability - value() does not update RNG state'
- Tags: 'orchestration', 'rng', 'seed', 'stealth'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f1 <- future(1)
3: f2 <- future(2)
4: rng0 <- globalenv()$.Random.seed
5: v1 <- value(f1)
6: stopifnot(identical(v1, 1))
7: stopifnot(identical(globalenv()$.Random.seed, rng0))
8: v2 <- value(f2)
9: stopifnot(identical(v2, 2))
10: stopifnot(identical(globalenv()$.Random.seed, rng0))
11: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
[[1]][[49]]
[[1]][[49]][[1]]
TestResult:
- Test:
- Title: 'future() - standard output'
- Tags: 'future', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: f <- future({
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: }, stdout = stdout)
19: r <- result(f)
20: str(r)
21: stopifnot(value(f) == 42L)
22: if (stdout) {
23: print(r)
24: message(sprintf("- stdout = %s", stdout))
25: stopifnot(identical(r$stdout, truth))
26: }
27: else {
28: print(r)
29: print(plan())
30: message(sprintf("- stdout = %s", stdout))
31: stopifnot(is.null(r$stdout) || r$stdout == "")
32: }
33: }
- Arguments tested:
1. stdout: FALSE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: 'List of 9'
3: ' $ value : int 42'
4: ' $ visible : logi TRUE'
5: ' $ stdout : NULL'
6: ' $ conditions: list()'
7: ' $ rng : logi FALSE'
8: ' $ started : POSIXct[1:1], format: "2023-02-07 06:03:46"'
9: ' $ finished : POSIXct[1:1], format: "2023-02-07 06:03:46"'
10: ' $ r_info :List of 4'
11: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
12: ' .. ..$ : int [1:3] 4 1 3'
13: ' ..$ os : chr "windows"'
14: ' ..$ os_name : chr "Windows"'
15: ' ..$ captures_utf8: logi FALSE'
16: ' $ version : chr "1.8"'
17: ' - attr(*, "class")= chr "FutureResult"'
18: 'FutureResult:'
19: 'value: 'integer''
20: 'visible: TRUE'
21: 'stdout: NULL'
22: 'conditions: [n = 0] '
23: 'RNG used: FALSE'
24: 'duration: 0.01559997 secs (started 2023-02-07 06:03:46)'
25: 'version: 1.8'
26: 'sequential:'
27: '- args: function (..., envir = parent.frame())'
28: '- tweaked: FALSE'
29: '- call: plan(sequential)'
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[49]][[2]]
TestResult:
- Test:
- Title: 'future() - standard output'
- Tags: 'future', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: f <- future({
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: }, stdout = stdout)
19: r <- result(f)
20: str(r)
21: stopifnot(value(f) == 42L)
22: if (stdout) {
23: print(r)
24: message(sprintf("- stdout = %s", stdout))
25: stopifnot(identical(r$stdout, truth))
26: }
27: else {
28: print(r)
29: print(plan())
30: message(sprintf("- stdout = %s", stdout))
31: stopifnot(is.null(r$stdout) || r$stdout == "")
32: }
33: }
- Arguments tested:
1. stdout: TRUE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: 'List of 9'
3: ' $ value : int 42'
4: ' $ visible : logi TRUE'
5: ' $ stdout : chr " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 3"| __truncated__'
6: ' $ conditions: list()'
7: ' $ rng : logi FALSE'
8: ' $ started : POSIXct[1:1], format: "2023-02-07 06:03:46"'
9: ' $ finished : POSIXct[1:1], format: "2023-02-07 06:03:46"'
10: ' $ r_info :List of 4'
11: ' ..$ version :Classes 'R_system_version', 'package_version', 'numeric_version' hidden list of 1'
12: ' .. ..$ : int [1:3] 4 1 3'
13: ' ..$ os : chr "windows"'
14: ' ..$ os_name : chr "Windows"'
15: ' ..$ captures_utf8: logi FALSE'
16: ' $ version : chr "1.8"'
17: ' - attr(*, "class")= chr "FutureResult"'
18: ' [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25'
19: '[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50'
20: ' int [1:50] 1 2 3 4 5 6 7 8 9 10 ...'
21: 'a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 '
22: '"Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"'
23: '"1" 5.1 3.5 1.4 0.2 "setosa"'
24: '"2" 4.9 3 1.4 0.2 "setosa"'
25: '"3" 4.7 3.2 1.3 0.2 "setosa"'
26: '"4" 4.6 3.1 1.5 0.2 "setosa"'
27: '"5" 5 3.6 1.4 0.2 "setosa"'
28: '"6" 5.4 3.9 1.7 0.4 "setosa"'
29: '"7" 4.6 3.4 1.4 0.3 "setosa"'
30: '"8" 5 3.4 1.5 0.2 "setosa"'
31: '"9" 4.4 2.9 1.4 0.2 "setosa"'
32: '"10" 4.9 3.1 1.5 0.1 "setosa"'
33: 'FutureResult:'
34: 'value: 'integer''
35: 'visible: TRUE'
36: 'stdout: character'
37: 'conditions: [n = 0] '
38: 'RNG used: FALSE'
39: 'duration: 0.01559997 secs (started 2023-02-07 06:03:46)'
40: 'version: 1.8'
- Success: TRUE
- Processing time: 0.047 secs
[[1]][[50]]
[[1]][[50]][[1]]
TestResult:
- Test:
- Title: '%<-% - standard output'
- Tags: '%<-%', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: v %<-% {
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: } %stdout% stdout
19: out <- utils::capture.output(y <- v)
20: stopifnot(y == 42L)
21: if (!stdout) {
22: stopifnot(out == "")
23: }
24: else {
25: print(out)
26: stopifnot(identical(out, truth_rows))
27: }
28: }
- Arguments tested:
1. stdout: FALSE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
- Success: TRUE
- Processing time: 0.109 secs
[[1]][[50]][[2]]
TestResult:
- Test:
- Title: '%<-% - standard output'
- Tags: '%<-%', 'stdout'
- Reset workers: FALSE
- Arguments:
1. stdout: [n = 2] c(FALSE, TRUE)
=> Test combinations: 2
- Expression:
1: {
2: truth_rows <- utils::capture.output({
3: print(1:50)
4: str(1:50)
5: cat(letters, sep = "-")
6: cat(1:6, collapse = "\n")
7: write.table(datasets::iris[1:10, ], sep = "\t")
8: })
9: truth <- paste0(paste(truth_rows, collapse = "\n"), "\n")
10: print(truth)
11: v %<-% {
12: print(1:50)
13: str(1:50)
14: cat(letters, sep = "-")
15: cat(1:6, collapse = "\n")
16: write.table(datasets::iris[1:10, ], sep = "\t")
17: 42L
18: } %stdout% stdout
19: out <- utils::capture.output(y <- v)
20: stopifnot(y == 42L)
21: if (!stdout) {
22: stopifnot(out == "")
23: }
24: else {
25: print(out)
26: stopifnot(identical(out, truth_rows))
27: }
28: }
- Arguments tested:
1. stdout: TRUE
2. lazy: FALSE
3. globals: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: '[1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n int [1:50] 1 2 3 4 5 6 7 8 9 10 ...\na-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 \n\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"\n\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"\n\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"\n\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"\n\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"\n\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"\n\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"\n\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"\n\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"\n\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"\n\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"\n"'
2: ' [1] " [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25"'
3: ' [2] "[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50"'
4: ' [3] " int [1:50] 1 2 3 4 5 6 7 8 9 10 ..." '
5: ' [4] "a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z1 2 3 4 5 6 " '
6: ' [5] "\"Sepal.Length\"\t\"Sepal.Width\"\t\"Petal.Length\"\t\"Petal.Width\"\t\"Species\"" '
7: ' [6] "\"1\"\t5.1\t3.5\t1.4\t0.2\t\"setosa\"" '
8: ' [7] "\"2\"\t4.9\t3\t1.4\t0.2\t\"setosa\"" '
9: ' [8] "\"3\"\t4.7\t3.2\t1.3\t0.2\t\"setosa\"" '
10: ' [9] "\"4\"\t4.6\t3.1\t1.5\t0.2\t\"setosa\"" '
11: '[10] "\"5\"\t5\t3.6\t1.4\t0.2\t\"setosa\"" '
12: '[11] "\"6\"\t5.4\t3.9\t1.7\t0.4\t\"setosa\"" '
13: '[12] "\"7\"\t4.6\t3.4\t1.4\t0.3\t\"setosa\"" '
14: '[13] "\"8\"\t5\t3.4\t1.5\t0.2\t\"setosa\"" '
15: '[14] "\"9\"\t4.4\t2.9\t1.4\t0.2\t\"setosa\"" '
16: '[15] "\"10\"\t4.9\t3.1\t1.5\t0.1\t\"setosa\"" '
- Success: TRUE
- Processing time: 0.031 secs
[[1]][[51]]
[[1]][[51]][[1]]
TestResult:
- Test:
- Title: 'value() - visibility'
- Tags: 'value', 'visibility'
- Reset workers: FALSE
- Arguments:
<none>
=> Test combinations: 1
- Expression:
1: {
2: f <- future(42)
3: res <- withVisible({
4: value(f)
5: })
6: v <- res$value
7: stopifnot(identical(v, 42))
8: stopifnot(res$visible)
9: f <- future(invisible(42))
10: res <- withVisible({
11: value(f)
12: })
13: v <- res$value
14: stopifnot(identical(v, 42))
15: stopifnot(!res$visible)
16: }
- Arguments tested:
1. lazy: FALSE
2. globals: TRUE
3. stdout: TRUE
- Local evaluation: TRUE
- Result:
- Value: NULL
- Visible: FALSE
- Captured output:
1: ''
- Success: TRUE
- Processing time: 0.016 secs
attr(,"plan")
sequential:
- args: function (..., envir = parent.frame())
- tweaked: FALSE
- call: plan(sequential)
attr(,"exit_code")
[1] 1
Total number of errors: 1
> proc.time()
user system elapsed
8.22 0.31 18.04
Flavor: r-oldrel-windows-ix86+x86_64