* using log directory 'd:/Rcompile/CRANpkg/local/4.4/gadget3.Rcheck' * using R version 4.4.3 (2025-02-28 ucrt) * using platform: x86_64-w64-mingw32 * R was compiled by gcc.exe (GCC) 13.3.0 GNU Fortran (GCC) 13.3.0 * running under: Windows Server 2022 x64 (build 20348) * using session charset: UTF-8 * checking for file 'gadget3/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'gadget3' version '0.13-0' * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'gadget3' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... [0s] OK * checking whether the package can be loaded with stated dependencies ... [0s] OK * checking whether the package can be unloaded cleanly ... [0s] OK * checking whether the namespace can be loaded with stated dependencies ... [0s] OK * checking whether the namespace can be unloaded cleanly ... [1s] OK * checking loading without being on the library search path ... [0s] OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [23s] OK * checking Rd files ... [2s] OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... [36s] OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... [220s] ERROR Running 'test-aab_env.R' [1s] Running 'test-action_age.R' [4s] Running 'test-action_grow-methods.R' [6s] Running 'test-action_grow.R' [3s] Running 'test-action_mature.R' [3s] Running 'test-action_migrate.R' [3s] Running 'test-action_naturalmortality.R' [1s] Running 'test-action_predate-catchability.R' [6s] Running 'test-action_predate-numberfleet.R' [3s] Running 'test-action_predate-predator.R' [19s] Running 'test-action_predate-timebasedsuitability.R' [4s] Running 'test-action_predate.R' [8s] Running 'test-action_renewal-otherfood.R' [10s] Running 'test-action_renewal.R' [6s] Running 'test-action_report.R' [2s] Running 'test-action_spawn-multipleoutputs.R' [6s] Running 'test-action_spawn.R' [6s] Running 'test-action_spmodel.R' [2s] Running 'test-action_tagging.R' [3s] Running 'test-action_time.R' [2s] Running 'test-action_weightloss.R' [3s] Running 'test-array_utils.R' [4s] Running 'test-env_dif.R' [2s] Running 'test-eval.R' [1s] Running 'test-formula_utils.R' [1s] Running 'test-init_val.R' [2s] Running 'test-likelihood_bounds.R' [3s] Running 'test-likelihood_data.R' [5s] Running 'test-likelihood_distribution-surveyindices.R' [3s] Running 'test-likelihood_distribution.R' [18s] Running 'test-likelihood_random.R' [1s] Running 'test-likelihood_sparsesample.R' [5s] Running 'test-likelihood_tagging_ckmr.R' [5s] Running 'test-likelihood_understocking.R' [0s] Running 'test-param_project-ar1.R' [5s] Running 'test-param_project-logar1.R' [4s] Running 'test-param_project.R' [2s] Running 'test-params.R' [3s] Running 'test-quota-assess.R' [7s] Running 'test-quota-hockeyfleet.R' [5s] Running 'test-quota.R' [2s] Running 'test-regression.R' [1s] Running 'test-run.R' [1s] Running 'test-run_r.R' [3s] Running 'test-run_tmb-reporting_enabled.R' [1s] Running 'test-run_tmb.R' [5s] Running 'test-step.R' [3s] Running 'test-stock.R' [1s] Running 'test-stock_age.R' [2s] Running 'test-stock_areas.R' [3s] Running 'test-stock_product.R' [0s] Running 'test-stock_tag.R' [2s] Running 'test-stock_time-fishingyear.R' [2s] Running 'test-stock_time.R' [1s] Running 'test-suitability-report.R' [9s] Running 'test-suitability.R' [3s] Running 'test-timedata.R' [2s] Running 'test-timevariable.R' [1s] Running the tests in 'tests/test-env_dif.R' failed. Complete output: > library(unittest) > > library(gadget3) > > params <- list() > actions <- list() > > # NB: Should test under both CppAD and TMBAD > # options(gadget3.tmb.framework = "CppAD") > > ############################################################################### > > dif_pmax_scl_dbl_in <- runif(1, 0, 100) > dif_pmax_vec_in <- runif(10, 0, 100) > dif_pmax_vec_vec_max <- runif(10, 0, 10) * 10 > actions[['dif_pmax_vec']] <- g3_formula( + { + expect_dif_pmax_scl_dbl <- dif_pmax(dif_pmax_scl_dbl_in, 40.0, 1e5) + expect_dif_pmax_vec_typ <- dif_pmax(dif_pmax_vec_in, dif_pmax_vec_typ_max, 1e5) + expect_dif_pmax_dervec_typ <- dif_pmax(dif_pmax_vec_in * 2, dif_pmax_vec_typ_max, 1e5) + expect_dif_pmax_vec_dbl <- dif_pmax(dif_pmax_vec_in, 30.0, 1e5) + expect_dif_pmax_vec_int <- dif_pmax(dif_pmax_vec_in, dif_pmax_vec_int_max, 1e5) + expect_dif_pmax_vec_vec <- dif_pmax(dif_pmax_vec_in, dif_pmax_vec_vec_max, 1e5) + }, + dif_pmax_scl_dbl_in = dif_pmax_scl_dbl_in, + dif_pmax_vec_in = dif_pmax_vec_in, + dif_pmax_vec_typ_max = 40.0, + dif_pmax_vec_int_max = 60L, + dif_pmax_vec_vec_max = dif_pmax_vec_vec_max, + expect_dif_pmax_scl_dbl = pmax(dif_pmax_scl_dbl_in, 40), + expect_dif_pmax_vec_typ = pmax(dif_pmax_vec_in, 40.0), + expect_dif_pmax_dervec_typ = pmax(dif_pmax_vec_in * 2, 40.0), + expect_dif_pmax_vec_dbl = pmax(dif_pmax_vec_in, 30.0), + expect_dif_pmax_vec_int = pmax(dif_pmax_vec_in, 60L), + expect_dif_pmax_vec_vec = pmax(dif_pmax_vec_in, dif_pmax_vec_vec_max), + end = NULL ) > > dif_pmax_arr_in <- array(runif(10, 0, 9), dim = c(3, 3)) > dif_pmax_arr_vec_max <- runif(3, 0, 10) * 10 > actions[['dif_pmax_arr']] <- g3_formula( + { + expect_dif_pmax_arr_typ <- dif_pmax(dif_pmax_arr_in, dif_pmax_arr_typ_max, 1e5) + expect_dif_pmax_dearr_typ <- dif_pmax(dif_pmax_arr_in * 2, dif_pmax_arr_typ_max, 1e5) + expect_dif_pmax_arr_dbl <- dif_pmax(dif_pmax_arr_in, 30.0, 1e5) + expect_dif_pmax_arr_int <- dif_pmax(dif_pmax_arr_in, dif_pmax_arr_int_max, 1e5) + expect_dif_pmax_arr_vec <- dif_pmax(dif_pmax_arr_in, dif_pmax_arr_vec_max, 1e5) + }, + dif_pmax_arr_in = dif_pmax_arr_in, + dif_pmax_arr_typ_max = 40.0, + dif_pmax_arr_int_max = 60L, + dif_pmax_arr_vec_max = dif_pmax_arr_vec_max, + expect_dif_pmax_arr_typ = pmax(dif_pmax_arr_in, 40.0), + expect_dif_pmax_dearr_typ = pmax(dif_pmax_arr_in * 2, 40.0), + expect_dif_pmax_arr_dbl = pmax(dif_pmax_arr_in, 30.0), + expect_dif_pmax_arr_int = pmax(dif_pmax_arr_in, 60L), + expect_dif_pmax_arr_vec = pmax(dif_pmax_arr_in, dif_pmax_arr_vec_max), + end = NULL ) > > dif_pmin_vec_in <- runif(10, 0, 100) > dif_pmin_vec_vec_max <- runif(10, 0, 10) * 10 > actions[['dif_pmin_vec']] <- g3_formula( + { + expect_dif_pmin_vec_typ <- dif_pmin(dif_pmin_vec_in, dif_pmin_vec_typ_max, 1e5) + expect_dif_pmin_vec_dbl <- dif_pmin(dif_pmin_vec_in, 30.0, 1e5) + expect_dif_pmin_vec_int <- dif_pmin(dif_pmin_vec_in, dif_pmin_vec_int_max, 1e5) + expect_dif_pmin_vec_vec <- dif_pmin(dif_pmin_vec_in, dif_pmin_vec_vec_max, 1e5) + }, + dif_pmin_vec_in = dif_pmin_vec_in, + dif_pmin_vec_typ_max = 40.0, + dif_pmin_vec_int_max = 60L, + dif_pmin_vec_vec_max = dif_pmin_vec_vec_max, + expect_dif_pmin_vec_typ = pmin(dif_pmin_vec_in, 40.0), + expect_dif_pmin_vec_dbl = pmin(dif_pmin_vec_in, 30.0), + expect_dif_pmin_vec_int = pmin(dif_pmin_vec_in, 60L), + expect_dif_pmin_vec_vec = pmin(dif_pmin_vec_in, dif_pmin_vec_vec_max), + end = NULL ) > > dif_pmin_arr_in <- array(runif(10, 0, 9), dim = c(3, 3)) > dif_pmin_arr_vec_max <- runif(3, 0, 10) * 10 > actions[['dif_pmin_arr']] <- g3_formula( + { + expect_dif_pmin_arr_typ <- dif_pmin(dif_pmin_arr_in, dif_pmin_arr_typ_max, 1e5) + expect_dif_pmin_arr_dbl <- dif_pmin(dif_pmin_arr_in, 30.0, 1e5) + expect_dif_pmin_arr_int <- dif_pmin(dif_pmin_arr_in, dif_pmin_arr_int_max, 1e5) + expect_dif_pmin_arr_vec <- dif_pmin(dif_pmin_arr_in, dif_pmin_arr_vec_max, 1e5) + }, + dif_pmin_arr_in = dif_pmin_arr_in, + dif_pmin_arr_typ_max = 40.0, + dif_pmin_arr_int_max = 60L, + dif_pmin_arr_vec_max = dif_pmin_arr_vec_max, + expect_dif_pmin_arr_typ = pmin(dif_pmin_arr_in, 40.0), + expect_dif_pmin_arr_dbl = pmin(dif_pmin_arr_in, 30.0), + expect_dif_pmin_arr_int = pmin(dif_pmin_arr_in, 60L), + expect_dif_pmin_arr_vec = pmin(dif_pmin_arr_in, dif_pmin_arr_vec_max), + end = NULL ) > > dif_pminmax_vec_in <- runif(10, 0, 100) > dif_pminmax_vec_vec_l <- runif(10, 0, 50) > dif_pminmax_vec_vec_u <- 50 + runif(10, 0, 50) > actions[['dif_pminmax_vec']] <- g3_formula( + { + expect_dif_pminmax_vec_dbl <- dif_pminmax(dif_pminmax_vec_in, 30.0, 60.0, 1e5) + expect_dif_pminmax_vec_vec <- dif_pminmax(dif_pminmax_vec_in, dif_pminmax_vec_vec_l, dif_pminmax_vec_vec_u, 1e5) + }, + dif_pminmax_vec_in = dif_pminmax_vec_in, + dif_pminmax_vec_vec_l = dif_pminmax_vec_vec_l, + dif_pminmax_vec_vec_u = dif_pminmax_vec_vec_u, + expect_dif_pminmax_vec_dbl = pmin(pmax(dif_pminmax_vec_in, 30.0), 60.0), + expect_dif_pminmax_vec_vec = pmin(pmax(dif_pminmax_vec_in, dif_pminmax_vec_vec_l), dif_pminmax_vec_vec_u), + end = NULL ) > > ############################################################################### > > expecteds <- new.env(parent = emptyenv()) > > for (i in seq_along(actions)) { + exp_names <- grep("^expect_", names(environment(actions[[i]])), value = TRUE) + + # For each expect_ variable, move to expecteds + for (exp_name in exp_names) { + expecteds[[exp_name]] <- environment(actions[[i]])[[exp_name]] + environment(actions[[i]])[[exp_name]][] <- 0 + } + + # REPORT every expect_ + reports <- lapply(exp_names, function (exp_name) { + substitute(REPORT(sym), list(sym = as.symbol(exp_name))) + }) + # Convert list to { REPORT(x) ; REPORT(y); ... } + reports <- as.call(c(as.symbol("{"), reports)) + + # Top/tail actions with a comment of their name & reports + actions[[i]] <- gadget3:::f_substitute(quote({ + comment(act_name) + act_f + reports + }), list( + act_name = names(actions)[[i]], + act_f = actions[[i]], + reports = reports)) + } > > actions[['z']] <- g3_formula({ + comment('done') + nll <- nll + g3_param('rv') + return(nll) + }, nll = 0.0) > params$rv <- 0.0 > > model_fn <- g3_to_r(actions) > model_cpp <- g3_to_tmb(actions) > result <- model_fn(params) > > # Compare everything we've been told to compare > for (n in ls(expecteds)) { + tol <- sqrt(.Machine$double.eps) + if (!is.null(attr(expecteds[[n]], "tol"))) { + tol <- attr(expecteds[[n]], "tol") + attr(expecteds[[n]], "tol") <- NULL + } + ok(ut_cmp_equal( + attr(result, n), + expecteds[[n]], + tolerance = tol ), n) + } ok - expect_dif_pmax_arr_dbl ok - expect_dif_pmax_arr_int ok - expect_dif_pmax_arr_typ ok - expect_dif_pmax_arr_vec ok - expect_dif_pmax_dearr_typ ok - expect_dif_pmax_dervec_typ ok - expect_dif_pmax_scl_dbl ok - expect_dif_pmax_vec_dbl ok - expect_dif_pmax_vec_int ok - expect_dif_pmax_vec_typ ok - expect_dif_pmax_vec_vec ok - expect_dif_pmin_arr_dbl ok - expect_dif_pmin_arr_int ok - expect_dif_pmin_arr_typ ok - expect_dif_pmin_arr_vec ok - expect_dif_pmin_vec_dbl ok - expect_dif_pmin_vec_int ok - expect_dif_pmin_vec_typ ok - expect_dif_pmin_vec_vec not ok - expect_dif_pminmax_vec_dbl # Test returned non-TRUE value: # Mean relative difference: 1.577177e-07 # --- attr(result, n) # +++ expecteds[[n]] # num [1:10] 41.95813669 [-30.00000473-]{+30+} 60 60 37.03350888 60 60 30 30 58.40689812 ok - expect_dif_pminmax_vec_vec > > gadget3:::ut_tmb_r_compare2(model_fn, model_cpp, params) # skip: not running TMB tests NULL > > proc.time() user system elapsed 0.93 0.10 1.59 1..21 # Looks like you failed 1 of 21 tests. # 20: expect_dif_pminmax_vec_dbl * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... [74s] OK * checking PDF version of manual ... [23s] OK * checking HTML version of manual ... [15s] OK * DONE Status: 1 ERROR