diff --git a/tests/testthat/_snaps/fit_OSLLifeTimes.md b/tests/testthat/_snaps/fit_OSLLifeTimes.md new file mode 100644 index 000000000..5f3abe285 --- /dev/null +++ b/tests/testthat/_snaps/fit_OSLLifeTimes.md @@ -0,0 +1,424 @@ +# check functionality + + { + "type": "S4", + "attributes": { + "data": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": ["data", "start_matrix", "total_counts"] + } + }, + "value": [ + { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "double", + "attributes": {}, + "value": [21187374624.91338] + }, + { + "type": "double", + "attributes": {}, + "value": [87.91459512] + }, + { + "type": "double", + "attributes": {}, + "value": [97105538.01901485] + }, + { + "type": "double", + "attributes": {}, + "value": [3.1679345] + }, + { + "type": "double", + "attributes": {}, + "value": [218.18914819] + }, + { + "type": "double", + "attributes": {}, + "value": [27.75139291] + }, + { + "type": "double", + "attributes": {}, + "value": [0] + }, + { + "type": "double", + "attributes": {}, + "value": [1.19644063e-143] + } + ] + }, + { + "type": "double", + "attributes": { + "dim": { + "type": "integer", + "attributes": {}, + "value": [1, 2] + }, + "dimnames": { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "character", + "attributes": {}, + "value": ["Comp.1"] + }, + { + "type": "character", + "attributes": {}, + "value": ["A", "tau"] + } + ] + } + }, + "value": [1891061285548.3481, 1192.89302733] + }, + { + "type": "double", + "attributes": {}, + "value": [38310000000000] + } + ] + }, + "originator": { + "type": "character", + "attributes": {}, + "value": ["fit_OSLLifeTimes"] + }, + "info": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": [] + } + }, + "value": [] + }, + ".uid": { + "type": "character", + "attributes": {}, + "value": [null] + }, + ".pid": { + "type": "character", + "attributes": {}, + "value": [null] + } + }, + "value": { + "class": "RLum.Results", + "package": "Luminescence" + } + } + +--- + + { + "type": "S4", + "attributes": { + "data": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": ["data", "start_matrix", "total_counts"] + } + }, + "value": [ + { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "double", + "attributes": {}, + "value": [21187380528.417492] + }, + { + "type": "double", + "attributes": {}, + "value": [87.91437058] + }, + { + "type": "double", + "attributes": {}, + "value": [21187374615.080013] + }, + { + "type": "double", + "attributes": {}, + "value": [87.91459548] + }, + { + "type": "double", + "attributes": {}, + "value": [97105552.15831606] + }, + { + "type": "double", + "attributes": {}, + "value": [3.16791835] + }, + { + "type": "double", + "attributes": {}, + "value": [97105537.39146955] + }, + { + "type": "double", + "attributes": {}, + "value": [3.1679345] + }, + { + "type": "double", + "attributes": {}, + "value": [218.18917721] + }, + { + "type": "double", + "attributes": {}, + "value": [27.75146355] + }, + { + "type": "double", + "attributes": {}, + "value": [218.1891495] + }, + { + "type": "double", + "attributes": {}, + "value": [27.75139309] + }, + { + "type": "double", + "attributes": {}, + "value": [0] + }, + { + "type": "double", + "attributes": {}, + "value": [1.19474683e-143] + }, + { + "type": "double", + "attributes": {}, + "value": [0] + }, + { + "type": "double", + "attributes": {}, + "value": [1.19643624e-143] + } + ] + }, + { + "type": "double", + "attributes": { + "dim": { + "type": "integer", + "attributes": {}, + "value": [2, 2] + }, + "dimnames": { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "character", + "attributes": {}, + "value": ["Comp.1", "Comp.1"] + }, + { + "type": "character", + "attributes": {}, + "value": ["A", "tau"] + } + ] + } + }, + "value": [2032205010479.8926, 2032643529227.3938, 110.38004153, 114.5974491] + }, + { + "type": "double", + "attributes": {}, + "value": [38310000000000, 38310000000000] + } + ] + }, + "originator": { + "type": "character", + "attributes": {}, + "value": ["fit_OSLLifeTimes"] + }, + "info": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": [] + } + }, + "value": [] + }, + ".uid": { + "type": "character", + "attributes": {}, + "value": [null] + }, + ".pid": { + "type": "character", + "attributes": {}, + "value": [null] + } + }, + "value": { + "class": "RLum.Results", + "package": "Luminescence" + } + } + +--- + + { + "type": "S4", + "attributes": { + "data": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": ["data", "start_matrix", "total_counts"] + } + }, + "value": [ + { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "double", + "attributes": {}, + "value": [31649193808.64809] + }, + { + "type": "double", + "attributes": {}, + "value": [3.19735974] + }, + { + "type": "double", + "attributes": {}, + "value": [733990387.37895739] + }, + { + "type": "double", + "attributes": {}, + "value": [0.24304722] + }, + { + "type": "double", + "attributes": {}, + "value": [43.11935736] + }, + { + "type": "double", + "attributes": {}, + "value": [13.15530275] + }, + { + "type": "double", + "attributes": {}, + "value": [1.34471628e-102] + }, + { + "type": "double", + "attributes": {}, + "value": [8.14487851e-29] + } + ] + }, + { + "type": "double", + "attributes": { + "dim": { + "type": "integer", + "attributes": {}, + "value": [1, 2] + }, + "dimnames": { + "type": "list", + "attributes": {}, + "value": [ + { + "type": "character", + "attributes": {}, + "value": ["Comp.1"] + }, + { + "type": "character", + "attributes": {}, + "value": ["A", "tau"] + } + ] + } + }, + "value": [3163386906904.6982, 3.20602699] + }, + { + "type": "double", + "attributes": {}, + "value": [4707500000000] + } + ] + }, + "originator": { + "type": "character", + "attributes": {}, + "value": ["fit_OSLLifeTimes"] + }, + "info": { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": [] + } + }, + "value": [] + }, + ".uid": { + "type": "character", + "attributes": {}, + "value": [null] + }, + ".pid": { + "type": "character", + "attributes": {}, + "value": [null] + } + }, + "value": { + "class": "RLum.Results", + "package": "Luminescence" + } + } + diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 55bcf0e0e..2f3123292 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -52,6 +52,11 @@ expect_snapshot_RLum <- function(object, ...) { } } + if ("info" %in% slotNames(object)) { + if ("call" %in% names(object@info)) { + object@info$call <- NULL + } + } if ("records" %in% slotNames(object)) { for (idx in seq_along(object@records)) { object@records[[idx]]@info$args <- NULL diff --git a/tests/testthat/test_fit_OSLLifeTimes.R b/tests/testthat/test_fit_OSLLifeTimes.R index 7da56cf04..f100af948 100644 --- a/tests/testthat/test_fit_OSLLifeTimes.R +++ b/tests/testthat/test_fit_OSLLifeTimes.R @@ -73,19 +73,19 @@ test_that("check functionality", { ##simple run set.seed(1) SW({ - expect_s4_class(object = fit_OSLLifeTimes( + expect_snapshot_RLum(fit_OSLLifeTimes( object = ExampleData.TR_OSL, plot = FALSE, method_control = list(DEoptim.itermax = 15), - n.components = 1), class = "RLum.Results") + n.components = 1)) ##simple list temp_list <- list(ExampleData.TR_OSL, ExampleData.TR_OSL) - expect_s4_class(object = fit_OSLLifeTimes( + expect_snapshot_RLum(fit_OSLLifeTimes( object = temp_list, log = "x", method_control = list(DEoptim.itermax = 25), - n.components = 1), class = "RLum.Results") + n.components = 1)) }) ## RLum.Analysis @@ -103,14 +103,14 @@ test_that("check functionality", { ## simple data.frame SW({ - expect_s4_class(fit_OSLLifeTimes( + expect_snapshot_RLum(fit_OSLLifeTimes( object = as.data.frame(temp_mat), method_control = list(seed = 1, weights = FALSE, DEoptim.itermax = 50), signal.range = 3, verbose = TRUE, plot = FALSE, - n.components = NULL), class = "RLum.Results") + n.components = NULL)) }) ##test arguments