Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 19, 2023
1 parent 4f6bcbe commit 4c70007
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ nanotestp(r)
nanotestz(daemons(0L))
nanotestz(status()[["connections"]])
nanotestz(status()[["daemons"]])
Sys.sleep(1L)
Sys.sleep(0.5)
n <- 3L
m <- mirai({
Sys.sleep(0.1)
Expand All @@ -59,18 +59,18 @@ nanotest(!unresolved(b))
nanotest(!unresolved(b2$data))
nanotest(is.environment(b) && is.character(b$data))
nanotest(is.environment(b2) && is.character(b2$data))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotestp(m)
nanotestp(b)
`lang obj` <- quote(m + n + 2L)
args <- list(m = 2L, n = 4L)
m <- mirai(.expr = `lang obj`, .args = args, .timeout = 2000L)
nanotest(call_mirai(m)$data == 8L || is_error_value(m$data))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotest(daemons(url = value <- mirai:::auto_tokenized_url(), dispatcher = FALSE) == value)
nanotest(grepl("://", launch_remote(status()$daemons), fixed = TRUE))
nanotestz(daemons(0L))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotesto(daemons(1L, dispatcher = FALSE, idletime = 500L, timerstart = 1L, cleanup = 0L, seed = 1546, .compute = "new"))
nanotest(is.character(nextget("urls", .compute = "new")))
nanotest(is.integer(nextstream(.compute = "new")))
Expand All @@ -83,22 +83,22 @@ nanotest(mp$data == "test2" || unresolved(mp$data))
Sys.sleep(1L)
nanotestz(status(.compute = "new")[["connections"]])
nanotestz(daemons(0L, .compute = "new"))
Sys.sleep(1L)
Sys.sleep(0.5)
if (.Platform[["OS.type"]] != "windows") {
nanotest(is_mirai(m <- mirai(TRUE)))
nanotest(is.character(launch_remote("ws://[::1]:5555", rscript = "/usr/lib/R/bin/Rscript", command = "echo", args = c("Test out:", ., ">/dev/null"))))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotestn(launch_local(mirai:::auto_tokenized_url(), .compute = "test"))
Sys.sleep(1L)
nanotest(daemons(n = 2L, url = value <- "ws://:0", dispatcher = FALSE) != value)
nanotestz(daemons(0L))
Sys.sleep(0.5)
nanotesto(daemons(url = "ws://:0", token = TRUE))
nanotestz(daemons(0L))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotesto(daemons(url = "tcp://:0", token = TRUE))
nanotestz(daemons(0L))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotest(daemons(n = 2, "ws://:0", lock = TRUE) == 2L)
nanotest(is.integer(nextget("pid")))
nanotest(length(nextget("urls")) == 2L)
Expand All @@ -124,7 +124,7 @@ if (.Platform[["OS.type"]] != "windows") {
nanotestn(saisei(i = 10L))
Sys.sleep(0.5)
nanotestz(daemons(0))
Sys.sleep(1L)
Sys.sleep(0.5)
nanotest(daemons(n = 2, "tcp://:0") == 2L)
Sys.sleep(1L)
nanotestn(launch_local(mirai:::..[["default"]][["urls"]][1L], maxtasks = 1L))
Expand All @@ -143,17 +143,22 @@ if (.Platform[["OS.type"]] != "windows") {
nanotestz(sum(tstatus[, "complete"]))
}
nanotestz(daemons(0))
Sys.sleep(1L)
Sys.sleep(0.5)
}
if (Sys.getenv("NOT_CRAN") == "true" && .Platform[["OS.type"]] != "windows") {
nanotesto(daemons(url = "wss://:0", token = TRUE, pass = "test"))
nanotesto(daemons(url = "wss://127.0.0.1:0", token = TRUE, pass = "test"))
nanotestn(launch_local(1L))
Sys.sleep(1L)
nanotest(grepl("CERTIFICATE", launch_remote(1L), fixed = TRUE))
nanotest(is.character(saisei(i = 1L, force = TRUE)))
file <- tempfile()
on.exit(unlink(file))
cat(nextget("tls"), file = file)
nanotestn(launch_local(1L, tls = file))
nanotesterr(launch_local(0:1), "out of bounds")
nanotesterr(launch_remote(1:2), "out of bounds")
nanotest(is.character(nextget("tls")))
nanotestz(daemons(0L))
Sys.sleep(1L)
Sys.sleep(0.5)
option <- 15L
nanotesto(daemons(1, dispatcher = TRUE, maxtasks = 10L, timerstart = 1L, walltime = 2000L, seed = 1546, token = TRUE, lock = TRUE, cleanup = option))
Sys.sleep(1L)
Expand All @@ -167,6 +172,6 @@ if (Sys.getenv("NOT_CRAN") == "true" && .Platform[["OS.type"]] != "windows") {
}
nanotestn(saisei(i = 1L))
nanotestz(daemons(0))
Sys.sleep(1L)
Sys.sleep(0.5)
}
Sys.sleep(1L)

0 comments on commit 4c70007

Please sign in to comment.