Skip to content

Commit

Permalink
update some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 30, 2024
1 parent 4002590 commit f68942f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ connection && {
test_print(d)
me <- mirai(mirai::mirai(), .timeout = 2000L)
test_true(is_mirai_error(call_mirai(me)$data) || is_error_value(me$data))
if (is_mirai_error(me$data)) test_true(is.list(me$data$stack.trace))
if (is_mirai_error(me$data)) test_type("list", me$data$stack.trace)
test_true(!is_mirai_interrupt(me$data))
test_true(is_error_value(me[["data"]]))
test_class("errorValue", me[["data"]])
test_print(me)
test_print(me$data)
df <- data.frame(a = 1, b = 2)
Expand Down Expand Up @@ -123,11 +123,11 @@ connection && .Platform[["OS.type"]] != "windows" && {
mirai_map(1:3, rnorm, .args = list(mean = 20, 2), .compute = "ml")[.progress]
})
test_true(!is_mirai_map(m))
test_true(is.list(m))
test_type("list", m)
test_equal(length(m), 3L)
test_true(all(as.logical(lapply(m, is.numeric))))
Sys.sleep(1L)
test_print(mp <- mirai_map(list(x = "a"), function(...) do(...), do = function(x, y) sprintf("%s%s", x, y), .args = list("b")))
test_print(suppressWarnings(mp <- mirai_map(list(x = "a"), function(...) do(...), do = function(x, y) sprintf("%s%s", x, y), .args = list("b"))))
test_identical(collect_mirai(mp)[["x"]], "ab")
test_identical(call_mirai(mp)[["x"]][["data"]], "ab")
test_true(all(mirai_map(data.frame(1:3, 3:1), sum, .args = list(3L))[.flat] == 7L))
Expand Down Expand Up @@ -227,7 +227,7 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "
test_equal(length(nextget("urls")), 2L)
Sys.sleep(1L)
status <- status()[["daemons"]]
test_true(is.matrix(status))
test_class("matrix", status)
test_type("character", dn1 <- dimnames(status)[[1L]])
test_type("character", parse1 <- nanonext::parse_url(dn1[1L]))
test_type("character", parse2 <- nanonext::parse_url(dn1[2L]))
Expand All @@ -250,7 +250,7 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "
test_null(launch_local(2, maxtasks = 1L))
Sys.sleep(2L)
tstatus <- status()[["daemons"]]
test_true(is.matrix(tstatus))
test_class("matrix", tstatus)
test_type("character", tdn1 <- dimnames(tstatus)[[1L]])
test_type("character", tparse1 <- nanonext::parse_url(tdn1[1L]))
test_type("character", tparse2 <- nanonext::parse_url(tdn1[2L]))
Expand Down Expand Up @@ -284,7 +284,7 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "
mq <- mirai(runif(1L), .timeout = 1000)
test_true(is.numeric(mq[]))
mq <- mirai(Sys.sleep(1.5), .timeout = 500)
test_true(is.matrix(status()[["daemons"]]))
test_class("matrix", status()[["daemons"]])
Sys.sleep(2L)
test_zero(daemons(0))
Sys.sleep(1L)
Expand Down

0 comments on commit f68942f

Please sign in to comment.