Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hillarymarler committed Aug 29, 2024
1 parent c59e4bb commit 98fdaf5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
16 changes: 10 additions & 6 deletions R/CriteriaComparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,23 @@ TADA_CreatePairRef <- function(.data, ph = TRUE, hardness = TRUE, temp = TRUE,

#' Pair Results for Numeric Criteria Calculation
#'
#' This function pairs TADA results with hardness, pH, and temperature results from the same
#' MonitoringLocation within an user-specified time window to facilitate the calculation of numeric
#' criteria The columns created by TADA_AutoClean are required to run this function. If they are not
#' present in. the data frame, the function will stop and print an error message.
#' This function pairs TADA results with results from specified characteristics from the same
#' MonitoringLocation within a user-specified time window to facilitate the calculation of numeric
#' criteria. The columns created by TADA_AutoClean are required to run this function. If they are not
#' present in the data frame, the function will stop and print an error message.
#'
#' Users can provide a pairing reference file (can be created using TADA_CreatePairRef) to specify
#' which combinations of TADA.CharacteristicName, TADA.ResultMeasure.MeasureUnit,
#' TADA.MethodSpeciatioName, and TADA.ResultSampleFraction should be used for hardness, pH, and temperature.
#' If no ref is specified, all possible combinations for hardness, pH, or temperature will be used.
#' TADA.MethodSpeciatioName, and TADA.ResultSampleFraction should be used for hardness, pH,
#' temperature, salinity, chloride or other user-defined groups. If no ref is specified, all possible
#' combinations for hardness, pH, temperature, salinity and chloride will be used.
#'
#' @param .data TADA dataframe
#'
#' @param ref Write description of what columns need to be in this ref or null option
#'
#' @param hours_range Numeric argument. The time difference allowed between the paired characteristic
#' and the result.
#
#' @return A TADA data frame with six additional columns added for each pairing group specified
#' in the pairing ref.
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-CriteriaComparison.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test_that("TADA_PairForCriteriaCalc function does not grow dataset", {
testdat1 <- TADA_RandomTestingData(
choose_random_state = FALSE,
number_of_days = 1,
autoclean =
)
testdat2 <- TADA_PairForCriteriaCalc(testdat1)
expect_true(dim(testdat1)[1] == dim(testdat2)[1])
})

0 comments on commit 98fdaf5

Please sign in to comment.