Skip to content

Commit

Permalink
wip - expand test coverage for fit carbon regression
Browse files Browse the repository at this point in the history
  • Loading branch information
rfiorella committed Sep 29, 2023
1 parent 948828e commit ceb7cb7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-data_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ test_that("calibration data frames have 14 columns", {
expect_equal(ncol(calDf_LR), 14)
})

test_that("carbon calibration data frames correct even when no input data", {
skip_on_cran()
# empty ref data frame:
empty_df <- data.frame(matrix(nrow = 0, ncol = ncol(co2data)))
names(empty_df) <- names(co2data)
expect_no_error(fit_carbon_regression(empty_df,
method = "Bowling_2003"))
expect_no_error(fit_carbon_regression(empty_df,
method = "linreg"))
expect_equal(ncol(fit_carbon_regression(empty_df,
method = "Bowling_2003")), 14)
expect_equal(ncol(fit_carbon_regression(empty_df,
method = "linreg",
calibration_half_width = 2)), 14)
})


# work through ambient calibrations

Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/test-output_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ test_that("calibrated ambient co2 mixing ratios linreg are within a plausible ra
expect_gt(min(ciso_subset_cal$`000_010_09m`$rtioMoleDryCo2$mean_cal, na.rm = TRUE), 300)
})


#---------------------------------------
# test some of the output data functions

fout <- tempfile()

test_that("setup_output_file returns no errors", {
expect_no_error(setup_output_file(fin,
fout,
site = "YELL",
analyte = "H2o"))
expect_no_error(setup_output_file(fin,
fout,
site = "YELL",
analyte = "Co2"))
})

0 comments on commit ceb7cb7

Please sign in to comment.