RECETOX / MFAssignR

The MFAssignR package was designed for multi-element molecular formula (MF) assignment of ultrahigh resolution mass spectrometry measurements. A number of tools for internal mass recalibration, MF assignment, signal-to-noise evaluation, and unambiguous formula selections are provided.
GNU General Public License v3.0
0 stars 2 forks source link

findRecalSeries: add a parametrized test for the find_final_series() function #49

Closed KristinaGomoryova closed 2 weeks ago

KristinaGomoryova commented 2 weeks ago

Currently only the test for the mode = TRUE is implemented, we need also a parametrized test for mode = FALSE.

Corresponding lines of code:

Actual test:

test_that("Positive final series work", {
  df <- readRDS("test-data/scores_df_full.rds")
  expected <- readRDS("test-data/final_seriesTRUE.rds")
  actual <- find_final_series(df, 3, TRUE)
  expect_equal(actual, expected)
})

Needed test:

patrick::with_parameters_test_that("Selection of the final series works",
  {
    df <- readRDS("test-data/scores_df_full.rds")
    expected <- readRDS(file.path("test-data", paste0("final_series", mode, ".rds")))
    n <- 3

    actual <- find_final_series(df, n, mode)
    if (mode == TRUE) {
      expect_equal(nrow(actual), 10)
   } else {
      expect_true(nrow(actual), n)
  }
  expect_equal(actual, expected)
  },
  mode = c(TRUE, FALSE)
)