Package: collapse Check: tests New result: ERROR Running ‘testthat.R’ [172s/173s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > # rm(list = ls()) > # Sys.setenv(R_TESTS = "") > library(testthat) > options(collapse_export_F = TRUE) > # library(collapse) > > test_check("collapse") Loading required package: collapse collapse 2.1.5, see ?`collapse-package` or ?`collapse-documentation` Attaching package: 'collapse' The following object is masked from 'package:stats': D [ FAIL 1 | WARN 0 | SKIP 2 | PASS 17726 ] ══ Skipped tests (2) ═══════════════════════════════════════════════════════════ • Sys.getenv("OMP") == "TRUE" is not TRUE (1): 'test-miscellaneous-issues.R:434:3' • empty test (1): ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-data.table.R:216:3'): creating columns and printing works after passing a data.table through collapse functions ── Error in ``[.data.table`(dt, , `:=`(new, 1))`: Internal error in assign: selfrefnames is ok but maxLength(names) [12] != maxLength(dt) [1036]. Please report to the data.table issues tracker. Backtrace: ▆ 1. ├─testthat::expect_silent(dt[, `:=`(new, 1)]) at test-data.table.R:216:3 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise) 3. │ ├─testthat (local) .capture(...) 4. │ │ ├─withr::with_output_sink(...) 5. │ │ │ └─base::force(code) 6. │ │ ├─base::withCallingHandlers(...) 7. │ │ └─base::withVisible(code) 8. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) 9. ├─dt[, `:=`(new, 1)] 10. └─data.table:::`[.data.table`(dt, , `:=`(new, 1)) [ FAIL 1 | WARN 0 | SKIP 2 | PASS 17726 ] Error: ! Test failures. Execution halted Package: cusum Check: whether package can be installed New result: NOTE Found the following notes/warnings: SystemRequirements specified C++11: support will be removed soon See ‘/home/hornik/tmp/CRAN_recheck/cusum.Rcheck/00install.out’ for details. Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: fastText Check: C++ specification New result: NOTE Specified C++11: support will be removed soon Package: fastText Check: whether package can be installed New result: NOTE Found the following notes/warnings: SystemRequirements specified C++11: support will be removed soon See ‘/home/hornik/tmp/CRAN_recheck/fastText.Rcheck/00install.out’ for details. Used C compiler: ‘gcc-15 (Debian 15.2.0-11) 15.2.0’ Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: gbp Check: whether package can be installed New result: NOTE Found the following notes/warnings: SystemRequirements specified C++11: support will be removed soon See ‘/home/hornik/tmp/CRAN_recheck/gbp.Rcheck/00install.out’ for details. Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: gmwmx2 Check: examples New result: ERROR Running examples in ‘gmwmx2-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: download_all_stations_ngl > ### Title: Download all stations name and location from the Nevada Geodetic > ### Laboratory > ### Aliases: download_all_stations_ngl > > ### ** Examples > > df_all_stations <- download_all_stations_ngl() Error in `req_perform()`: ! Failed to perform HTTP request. Caused by error in `curl::curl_fetch_memory()`: ! Timeout was reached [geodesy.unr.edu]: Connection timed out after 60001 milliseconds Backtrace: ▆ 1. └─gmwmx2::download_all_stations_ngl() 2. └─httr2::req_perform(req) 3. └─httr2:::handle_resp(req, resp, error_call = error_call) 4. └─rlang::cnd_signal(resp) Execution halted Package: heatwaveR Check: examples New result: ERROR Running examples in ‘heatwaveR-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: ts2clm3 > ### Title: Make a climatology from a daily time series. > ### Aliases: ts2clm3 > > ### ** Examples > > data.table::setDTthreads(threads = 1) # optimise for your code and local computer > res <- ts2clm3(sst_WA, climatologyPeriod = c("1983-01-01", "2012-12-31")) > res[1:10, ] t temp seas thresh 1: 1982-01-01 20.94 21.6080 22.9605 2: 1982-01-02 21.25 21.6348 22.9987 3: 1982-01-03 21.38 21.6621 23.0376 4: 1982-01-04 21.16 21.6895 23.0771 5: 1982-01-05 21.26 21.7169 23.1130 6: 1982-01-06 21.61 21.7436 23.1460 7: 1982-01-07 21.74 21.7699 23.1775 8: 1982-01-08 21.50 21.7958 23.2080 9: 1982-01-09 21.40 21.8217 23.2366 10: 1982-01-10 21.36 21.8478 23.2649 > > # Or if one only wants the 366 day climatology > res_clim <- ts2clm3(sst_WA, climatologyPeriod = c("1983-01-01", "2012-12-31"), + clmOnly = TRUE) > res_clim[1:10, ] doy seas thresh 1: 1 21.6080 22.9605 2: 2 21.6348 22.9987 3: 3 21.6621 23.0376 4: 4 21.6895 23.0771 5: 5 21.7169 23.1130 6: 6 21.7436 23.1460 7: 7 21.7699 23.1775 8: 8 21.7958 23.2080 9: 9 21.8217 23.2366 10: 10 21.8478 23.2649 > > # Or if one wants the variance column included in the results > res_var <- ts2clm3(sst_WA, climatologyPeriod = c("1983-01-01", "2012-12-31"), + var = TRUE) Warning in data.table::frollapply(thresh, n = smoothPercentileWidth, var, : 'n' is deprecated in frollapply, use 'N' instead Error in data.table::frollapply(thresh, n = smoothPercentileWidth, var, : argument "FUN" is missing, with no default Calls: ts2clm3 ... [.data.table -> eval -> eval -> -> match.fun Execution halted Package: heatwaveR Check: tests New result: ERROR Running ‘testthat.R’ [135s/123s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > library(testthat) > library(heatwaveR) > > test_check("heatwaveR") Saving _problems/test-ts2clm3-101.R [ FAIL 1 | WARN 1 | SKIP 0 | PASS 390 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-ts2clm3.R:101:3'): var argument functions correctly ──────────── Error in `data.table::frollapply(thresh, n = smoothPercentileWidth, var, na.rm = FALSE, align = "center")`: argument "FUN" is missing, with no default Backtrace: ▆ 1. └─heatwaveR::ts2clm3(...) at test-ts2clm3.R:101:3 2. ├─...[] 3. └─data.table:::`[.data.table`(...) 4. └─base::eval(jsub, SDenv, parent.frame()) 5. └─base::eval(jsub, SDenv, parent.frame()) 6. └─data.table::frollapply(...) 7. └─base::match.fun(FUN) [ FAIL 1 | WARN 1 | SKIP 0 | PASS 390 ] Error: ! Test failures. Execution halted Package: heuristicsmineR Check: whether package can be installed New result: WARNING Found the following significant warnings: Warning: SystemRequirements: invalid C++ specification ‘C++’ See ‘/home/hornik/tmp/CRAN_recheck/heuristicsmineR.Rcheck/00install.out’ for details. Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: LOMAR Check: whether package can be installed New result: WARNING Found the following significant warnings: Warning: SystemRequirements: invalid C++ specification ‘C++’ See ‘/home/hornik/tmp/CRAN_recheck/LOMAR.Rcheck/00install.out’ for details. Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: maditr Check: for code/documentation mismatches New result: WARNING Codoc mismatches from Rd file 'coalesce.Rd': coalesce Code: function(..., nan = NA) Docs: function(...) Argument names in code not in docs: nan Package: myClim Check: tests New result: ERROR Running ‘testthat.R’ [250s/247s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/tests.html > # * https://testthat.r-lib.org/reference/test_package.html#special-files > > library(testthat) > library(myClim) > > test_check("myClim") Saving _problems/test-calc-137.R Saving _problems/test-prep-174.R [ FAIL 2 | WARN 74 | SKIP 0 | PASS 29420 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-calc.R:137:5'): mc_calc_cumsum ───────────────────────────────── Error in `map(.x, .f, ..., .progress = .progress)`: i In index: 2. i With name: A2E32. Caused by error in `map()`: i In index: 5. i With name: snow. Caused by error: ! Expected `length(.x$values)` to equal `datetime_length`. Differences: `actual`: 287 `expected`: 75 Backtrace: ▆ 1. ├─global test_agg_data_format(agg_data) at test-calc.R:137:5 2. │ └─purrr::walk(data$localities, test_agg_locality) 3. │ └─purrr::map(.x, .f, ..., .progress = .progress) 4. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress) 5. │ ├─purrr:::with_indexed_errors(...) 6. │ │ └─base::withCallingHandlers(...) 7. │ ├─purrr:::call_with_cleanup(...) 8. │ └─global .f(.x[[i]], ...) 9. │ └─global test_data_length(locality) 10. │ └─purrr::walk(...) 11. │ └─purrr::map(.x, .f, ..., .progress = .progress) 12. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress) 13. │ ├─purrr:::with_indexed_errors(...) 14. │ │ └─base::withCallingHandlers(...) 15. │ ├─purrr:::call_with_cleanup(...) 16. │ └─.f(.x[[i]], ...) 17. │ └─testthat::expect_equal(length(.x$values), datetime_length) 18. │ └─testthat:::expect_waldo_equal_(msg, act, exp, info, ..., tolerance = tolerance) 19. │ └─testthat::fail(msg, info = info, trace_env = trace_env) 20. │ └─testthat::expectation("failure", message, srcref = srcref, trace = trace) 21. │ └─testthat::exp_signal(exp) 22. │ ├─base::withRestarts(...) 23. │ │ └─base (local) withRestartList(expr, restarts) 24. │ │ ├─base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) 25. │ │ │ └─base (local) doWithOneRestart(return(expr), restart) 26. │ │ └─base (local) withRestartList(expr, restarts[-nr]) 27. │ │ └─base (local) withOneRestart(expr, restarts[[1L]]) 28. │ │ └─base (local) doWithOneRestart(return(expr), restart) 29. │ └─base::stop(exp) 30. ├─purrr (local) ``(``) 31. │ └─cli::cli_abort(...) 32. │ └─rlang::abort(...) 33. │ └─rlang:::signal_abort(cnd, .file) 34. │ └─base::signalCondition(cnd) 35. └─purrr (local) ``(``) 36. └─cli::cli_abort(...) 37. └─rlang::abort(...) ── Error ('test-prep.R:174:5'): mc_prep_crop ─────────────────────────────────── Error in `recycle_columns(x, .rows, lengths)`: Tibble columns must have compatible sizes. * Size 75: Columns `datetime`, `TMS_T1`, `TMS_T2`, `TMS_T3`, and `TMS_moist`. * Size 287: Column `snow`. i Only values of size one are recycled. Backtrace: ▆ 1. └─myClim::mc_prep_crop(...) at test-prep.R:174:5 2. ├─dplyr::group_map(all_table, agg_locality_function) 3. └─dplyr:::group_map.data.frame(all_table, agg_locality_function) 4. └─dplyr:::map2(chunks, group_keys, .f, ...) 5. └─base::mapply(.f, .x, .y, MoreArgs = list(...), SIMPLIFY = FALSE) 6. └─myClim (local) ``(dots[[1L]][[2L]], dots[[2L]][[2L]]) 7. └─myClim (local) sensors_item_function(locality, start, end) 8. └─myClim:::.prep_crop_data(item, start, end, end_included) 9. └─myClim:::.common_sensor_values_as_tibble(item) 10. ├─tibble::as_tibble(data) 11. └─tibble:::as_tibble.list(data) 12. └─tibble:::lst_to_tibble(x, .rows, .name_repair, col_lengths(x)) 13. └─tibble:::recycle_columns(x, .rows, lengths) 14. └─tibble:::abort_incompatible_size(.rows, names(x), lengths, "Requested with `.rows` argument") 15. └─tibble:::tibble_abort(...) 16. └─rlang::abort(x, class, ..., call = call, parent = parent, use_cli_format = TRUE) [ FAIL 2 | WARN 74 | SKIP 0 | PASS 29420 ] Error: ! Test failures. Execution halted Package: processmapR Check: whether package can be installed New result: WARNING Found the following significant warnings: Warning: SystemRequirements: invalid C++ specification ‘C++’ See ‘/home/hornik/tmp/CRAN_recheck/processmapR.Rcheck/00install.out’ for details. Used C++ compiler: ‘g++-15 (Debian 15.2.0-11) 15.2.0’ Package: qs Check: tests New result: ERROR Running ‘correctness_testing.R’ [135s/129s] Running ‘qattributes_testing.R’ [38s/34s] Running ‘qsavemload_testing.R’ [1s/1s] Running the tests in ‘tests/qattributes_testing.R’ failed. Complete output: > total_time <- Sys.time() > > suppressMessages(library(Rcpp)) > suppressMessages(library(dplyr)) > suppressMessages(library(data.table)) > suppressMessages(library(qs)) > suppressMessages(library(stringfish)) > options(warn = 1) > > do_gc <- function() { + if (utils::compareVersion(as.character(getRversion()), "3.5.0") != -1) { + gc(full = TRUE) + } else { + gc() + } + } > > # because sourceCpp uses setwd, we need absolute path to R_TESTS when run within R CMD check > R_TESTS <- Sys.getenv("R_TESTS") # startup.Rs > if (nzchar(R_TESTS)) { + R_TESTS_absolute <- normalizePath(R_TESTS) + Sys.setenv(R_TESTS = R_TESTS_absolute) + } > sourceCpp(code="#include + using namespace Rcpp; + // [[Rcpp::plugins(cpp11)]] + // [[Rcpp::export(rng=false)]] + CharacterVector splitstr(std::string x, std::vector cuts){ + CharacterVector ret(cuts.size() - 1); + for(uint64_t i=1; i list_elements){ + auto randchar = []() -> char + { + const char charset[] = + \"0123456789\" + \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\" + \"abcdefghijklmnopqrstuvwxyz\"; + const size_t max_index = (sizeof(charset) - 1); + return charset[ rand() % max_index ]; + }; + List ret(list_elements.size()); + std::string str(10,0); + for(size_t i=0; i(rand()); + break; + } + } + return ret; + }") > if (nzchar(R_TESTS)) Sys.setenv(R_TESTS = R_TESTS) > > args <- commandArgs(T) > if (nzchar(R_TESTS) || ((length(args) > 0) && args[1] == "check")) { # do fewer tests within R CMD check so it completes within a reasonable amount of time + reps <- 2 + test_points <- c(0, 1, 2, 4, 8, 2^5 - 1, 2^5 + 1, 2^5, 2^8 - 1, 2^8 + 1, 2^8, 2^16 - 1, 2^16 + 1, 2^16, 1e6) + test_points_slow <- c(0, 1, 2, 4, 8, 2^5 - 1, 2^5 + 1, 2^5, 2^8 - 1, 2^8 + 1, 2^8, 2^16 - 1, 2^16 + 1, 2^16) # for Character Vector, stringfish and list + max_size <- 1e6 + } else { + reps <- 3 + test_points <- c(0, 1, 2, 4, 8, 2^5 - 1, 2^5 + 1, 2^5, 2^8 - 1, 2^8 + 1, 2^8, 2^16 - 1, 2^16 + 1, 2^16, 1e6, 1e7) + test_points_slow <- test_points + max_size <- 1e7 + } > myfile <- tempfile() > > obj_size <- 0 > get_obj_size <- function() { + get("obj_size", envir = globalenv()) + } > set_obj_size <- function(x) { + assign("obj_size", get_obj_size() + as.numeric(object.size(x)), envir = globalenv()) + return(get_obj_size()); + } > random_object_generator <- function(N, with_envs = FALSE) { # additional input: global obj_size, max_size + if (sample(3, 1) == 1) { + ret <- as.list(1:N) + } else if (sample(2, 1) == 1) { + ret <- as.pairlist(1:N) + } else { + ret <- as.pairlist(1:N) + setlev(ret, sample(2L^12L, 1L) - 1L) + setobj(ret, 1L) + } + + for (i in 1:N) { + if (get_obj_size() > get("max_size", envir = globalenv())) break; + otype <- sample(12, size = 1) + z <- NULL + is_attribute <- ifelse(i == 1, F, sample(c(F, T), size = 1)) + if (otype == 1) {z <- rnorm(1e4); set_obj_size(z);} + else if (otype == 2) { z <- sample(1e4) - 5e2; set_obj_size(z); } + else if (otype == 3) { z <- sample(c(T, F, NA), size = 1e4, replace = T); set_obj_size(z); } + else if (otype == 4) { z <- (sample(256, size = 1e4, replace = T) - 1) %>% as.raw; set_obj_size(z); } + else if (otype == 5) { z <- replicate(sample(1e4, size = 1), {rep(letters, length.out = sample(10, size = 1)) %>% paste(collapse = "")}); set_obj_size(z); } + else if (otype == 6) { z <- rep(letters, length.out = sample(1e4, size = 1)) %>% paste(collapse = ""); set_obj_size(z); } + else if (otype == 7) { z <- as.formula("y ~ a + b + c : d", env = globalenv()); attr(z, "blah") <- sample(1e4) - 5e2; set_obj_size(z); } + else if (with_envs && otype %in% c(8, 9)) { z <- function(x) {x + runif(1)} } + # else if(with_envs && otype %in% c(10,11)) { z <- new.env(); z$x <- random_object_generator(N, with_envs); makeActiveBinding("y", function() runif(1), z) } + else { z <- random_object_generator(N, with_envs) } + if (is_attribute) { + attr(ret[[i - 1]], runif(1) %>% as.character()) <- z + } else { + ret[[i]] <- z + } + } + return(ret) + } > > rand_strings <- function(n) { + s <- sample(0:100, size = n, replace = T) + x <- lapply(unique(s), function(si) { + stringfish::random_strings(sum(s == si), si, vector_mode = "normal") + }) %>% unlist %>% sample + x[sample(n, size = n/10)] <- NA + return(x) + } > > nested_tibble <- function() { + sub_tibble <- function(nr = 600, nc = 4) { + z <- lapply(1:nc, function(i) rand_strings(nr)) %>% + setNames(make.unique(paste0(sample(letters, nc), rand_strings(nc)))) %>% + bind_cols %>% + as_tibble + } + tibble( + col1 = rand_strings(100), + col2 = rand_strings(100), + col3 = lapply(1:100, function(i) sub_tibble(nr = 600, nc = 4)), + col4 = lapply(1:100, function(i) sub_tibble(nr = 600, nc = 4)), + col5 = lapply(1:100, function(i) sub_tibble(nr = 600, nc = 4)) + ) %>% setNames(make.unique(paste0(sample(letters, 5), rand_strings(5)))) + } > > printCarriage <- function(x) { + cat(x, "\r") + } > > attributes_serialize_identical <- function(attributes, full_object) { + identical(serialize(attributes(full_object), NULL), serialize(attributes, NULL)) + } > > attributes_identical <- function(attributes, full_object) { + identical(attributes, attributes(full_object)) + } > > ################################################################################################ > > qsave_rand <- function(x, file) { + alg <- sample(c("lz4", "zstd", "lz4hc", "zstd_stream", "uncompressed"), 1) + # alg <- "zstd_stream" + nt <- sample(5,1) + sc <- sample(0:15,1) + cl <- sample(10,1) + ch <- sample(c(T,F),1) + qsave(x, file = file, preset = "custom", algorithm = alg, + compress_level = cl, shuffle_control = sc, nthreads = nt, check_hash = ch) + } > > qattributes_rand <- function(file) { + # ar <- sample(c(T,F),1) + # don't use altrep to avoid serialization differences + # attributes_serialize_identical won't pass with ALTREP + ar <- FALSE + nt <- sample(5,1) + qattributes(file, use_alt_rep = ar, nthreads = nt, strict = T) + } > > ################################################################################################ > > for (q in 1:reps) { + cat("Rep", q, "of", reps, "\n") + # String correctness + time <- vector("numeric", length = 3) + for (tp in test_points) { + for (i in 1:3) { + x1 <- rep(letters, length.out = tp) %>% paste(collapse = "") + x1 <- c(NA, "", x1) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("strings: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # Character vectors + time <- vector("numeric", length = 3) + for (tp in test_points_slow) { + for (i in 1:3) { + # qs_use_alt_rep(F) + x1 <- rep(as.raw(sample(255)), length.out = tp*10) %>% rawToChar + cuts <- sample(tp*10, tp + 1) %>% sort %>% as.numeric + x1 <- splitstr(x1, cuts) + x1 <- c(NA, "", x1) + qsave_rand(x1, file = myfile) + time[i] <- Sys.time() + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Character Vectors: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # stringfish character vectors -- require R > 3.5.0 + if (utils::compareVersion(as.character(getRversion()), "3.5.0") != -1) { + time <- vector("numeric", length = 3) + for (tp in test_points_slow) { + for (i in 1:3) { + x1 <- rep(as.raw(sample(255)), length.out = tp*10) %>% rawToChar + cuts <- sample(tp*10, tp + 1) %>% sort %>% as.numeric + x1 <- splitstr(x1, cuts) + x1 <- c(NA, "", x1) + x1 <- stringfish::convert_to_sf(x1) + qsave_rand(x1, file = myfile) + time[i] <- Sys.time() + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Stringfish: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + } + + # Integers + time <- vector("numeric", length = 3) + for (tp in test_points) { + for (i in 1:3) { + x1 <- sample(1:tp, replace = T) + x1 <- c(NA, x1) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Integers: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # Doubles + time <- vector("numeric", length = 3) + for (tp in test_points) { + for (i in 1:3) { + x1 <- rnorm(tp) + x1 <- c(NA, x1) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Numeric: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # Logical + time <- vector("numeric", length = 3) + for (tp in test_points) { + for (i in 1:3) { + + x1 <- sample(c(T, F, NA), replace = T, size = tp) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Logical: %s, %s s",tp, signif(mean(time),4))) + } + cat("\n") + + # List + time <- vector("numeric", length = 3) + for (tp in test_points_slow) { + for (i in 1:3) { + x1 <- generateList(sample(1:4, replace = T, size = tp)) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("List: %s, %s s",tp, signif(mean(time),4))) + } + cat("\n") + + for (i in 1:3) { + x1 <- rep( replicate(1000, { rep(letters, length.out = 2^7 + sample(10, size = 1)) %>% paste(collapse = "") }), length.out = 1e6 ) + x1 <- data.frame(str = x1,num = runif(1:1000), stringsAsFactors = F) + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + do_gc() + stopifnot(attributes_identical(z, x1)) + } + cat("Data.frame test") + cat("\n") + + for (i in 1:3) { + x1 <- rep( replicate(1000, { rep(letters, length.out = 2^7 + sample(10, size = 1)) %>% paste(collapse = "") }), length.out = 1e6 ) + x1 <- data.table(str = x1,num = runif(1:1e6)) + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + do_gc() + stopifnot(attributes_serialize_identical(z, x1)) + } + cat("Data.table test") + cat("\n") + + for (i in 1:3) { + x1 <- rep( replicate(1000, { rep(letters, length.out = 2^7 + sample(10, size = 1)) %>% paste(collapse = "") }), length.out = 1e6 ) + x1 <- tibble(str = x1,num = runif(1:1e6)) + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + do_gc() + stopifnot(attributes_identical(z, x1)) + } + cat("Tibble test") + cat("\n") + + # Encoding test + if (Sys.info()[['sysname']] != "Windows") { + for (i in 1:3) { + x1 <- "己所不欲,勿施于人" # utf 8 + x2 <- x1 + Encoding(x2) <- "latin1" + x3 <- x1 + Encoding(x3) <- "bytes" + x4 <- rep(x1, x2, length.out = 1e4) %>% paste(collapse = ";") + x1 <- c(x1, x2, x3, x4) + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage("Encoding test") + } else { + printCarriage("(Encoding test not run on windows)") + } + cat("\n") + + # complex vectors + time <- vector("numeric", length = 3) + for (tp in test_points) { + for (i in 1:3) { + re <- rnorm(tp) + im <- runif(tp) + x1 <- complex(real = re, imaginary = im) + x1 <- c(NA_complex_, x1) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Complex: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # factors + for (tp in test_points) { + time <- vector("numeric", length = 3) + for (i in 1:3) { + x1 <- factor(rep(letters, length.out = tp), levels = sample(letters), ordered = TRUE) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Factors: %s, %s s",tp, signif(mean(time), 4))) + } + cat("\n") + + # Random objects + time <- vector("numeric", length = 8) + for (i in 1:8) { + # qs_use_alt_rep(sample(c(T, F), size = 1)) + obj_size <- 0 + x1 <- random_object_generator(12) + printCarriage(sprintf("Random objects: %s bytes", object.size(x1) %>% as.numeric)) + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Random objects: %s s", signif(mean(time), 4))) + cat("\n") + + # nested attributes + time <- vector("numeric", length = 3) + for (i in 1:3) { + x1 <- as.list(1:26) + attr(x1[[26]], letters[26]) <- rnorm(100) + for (i in 25:1) { + attr(x1[[i]], letters[i]) <- x1[[i + 1]] + } + time[i] <- Sys.time() + for(j in 1:length(x1)) { + qsave_rand(x1[[j]], file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1[[j]])) + } + } + printCarriage(sprintf("Nested attributes: %s s", signif(mean(time), 4))) + cat("\n") + + # alt-rep -- should serialize the unpacked object + time <- vector("numeric", length = 3) + for (i in 1:3) { + x1 <- 1:max_size + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + time[i] <- Sys.time() - time[i] + do_gc() + stopifnot(attributes_identical(z, x1)) + } + printCarriage(sprintf("Alt rep integer: %s s", signif(mean(time), 4))) + cat("\n") + + + # Environment test + time <- vector("numeric", length = 3) + for (i in 1:3) { + x1 <- new.env() + x1[["a"]] <- 1:max_size + x1[["b"]] <- runif(max_size) + x1[["c"]] <- stringfish::random_strings(1e4, vector_mode = "normal") + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + stopifnot(attributes_identical(z[["a"]], x1[["a"]])) + stopifnot(attributes_identical(z[["b"]], x1[["b"]])) + stopifnot(attributes_identical(z[["c"]], x1[["c"]])) + time[i] <- Sys.time() - time[i] + do_gc() + } + printCarriage(sprintf("Environment test: %s s", signif(mean(time), 4))) + cat("\n") + + time <- vector("numeric", length = 3) + for (i in 1:3) { + x1 <- nested_tibble() + time[i] <- Sys.time() + qsave_rand(x1, file = myfile) + z <- qattributes_rand(file = myfile) + stopifnot(attributes_identical(z, x1)) + time[i] <- Sys.time() - time[i] + do_gc() + } + printCarriage(sprintf("nested tibble test: %s s", signif(mean(time), 4))) + cat("\n") + } Rep 1 of 2 strings: 0, 0.007794 s strings: 1, 0.002279 s strings: 2, 0.002927 s strings: 4, 0.003609 s strings: 8, 0.00206 s strings: 31, 0.0009991 s strings: 33, 0.001097 s strings: 32, 0.001351 s strings: 255, 0.001007 s strings: 257, 0.001074 s strings: 256, 0.001357 s strings: 65535, 0.003879 s strings: 65537, 0.001703 s strings: 65536, 0.2816 s strings: 1e+06, 0.002595 s Character Vectors: 0, 0.0005414 s Character Vectors: 1, 0.0001371 s Character Vectors: 2, 0.0001953 s Character Vectors: 4, 0.0001727 s Character Vectors: 8, 0.0004553 s Character Vectors: 31, 0.0002379 s Character Vectors: 33, 0.0004976 s Character Vectors: 32, 0.0003384 s Character Vectors: 255, 0.0005834 s Character Vectors: 257, 0.0003631 s Character Vectors: 256, 0.0004963 s Character Vectors: 65535, 0.001648 s Character Vectors: 65537, 0.002405 s Character Vectors: 65536, 0.001952 s Stringfish: 0, 6.954e-05 s Stringfish: 1, 0.0005516 s Stringfish: 2, 7.582e-05 s Stringfish: 4, 0.0004668 s Stringfish: 8, 0.0005732 s Stringfish: 31, 0.000345 s Stringfish: 33, 0.0001719 s Stringfish: 32, 0.0006313 s Stringfish: 255, 0.0007517 s Stringfish: 257, 0.0003122 s Stringfish: 256, 0.0007482 s Stringfish: 65535, 0.0021 s Stringfish: 65537, 0.00258 s Stringfish: 65536, 0.002334 s Integers: 0, 0.0008776 s Integers: 1, 0.001388 s Integers: 2, 0.0007843 s Integers: 4, 0.001356 s Integers: 8, 0.001358 s Integers: 31, 0.001192 s Integers: 33, 0.001016 s Integers: 32, 0.001485 s Integers: 255, 0.00855 s Integers: 257, 0.0007757 s Integers: 256, 0.0005549 s Integers: 65535, 0.005243 s Integers: 65537, 0.004048 s Integers: 65536, 0.002444 s Integers: 1e+06, 0.06594 s Numeric: 0, 0.0008531 s Numeric: 1, 0.001642 s Numeric: 2, 0.001156 s Numeric: 4, 0.000977 s Numeric: 8, 0.001453 s Numeric: 31, 0.00167 s Numeric: 33, 0.001106 s Numeric: 32, 0.01468 s Numeric: 255, 0.001535 s Numeric: 257, 0.001323 s Numeric: 256, 0.03149 s Numeric: 65535, 0.003448 s Numeric: 65537, 0.00323 s Numeric: 65536, 0.004063 s Numeric: 1e+06, 0.09183 s Logical: 0, 0.008088 s Logical: 1, 0.002168 s Logical: 2, 0.00657 s Logical: 4, 0.001313 s Logical: 8, 0.001828 s Logical: 31, 0.001103 s Logical: 33, 0.003028 s Logical: 32, 0.02839 s Logical: 255, 0.0006731 s Logical: 257, 0.002676 s Logical: 256, 0.00239 s Logical: 65535, 0.01568 s Logical: 65537, 0.005828 s Logical: 65536, 0.006617 s Logical: 1e+06, 0.1432 s List: 0, 0.00694 s List: 1, 0.001723 s List: 2, 0.002035 s List: 4, 0.001177 s List: 8, 0.001723 s List: 31, 0.007741 s List: 33, 0.0017 s List: 32, 0.002151 s List: 255, 0.01443 s List: 257, 0.001096 s List: 256, 0.001469 s List: 65535, 0.01489 s List: 65537, 0.01562 s List: 65536, 0.009854 s Data.frame test Error: attributes_serialize_identical(z, x1) is not TRUE Execution halted