test_that("phenthau", { x <- load_test("day") fr_day <- phenthau(x) expect_equal(fr_day$day[fr_day$model == "L2"], "2020-04-18") expect_equal(fr_day$day[fr_day$model == "L3"], "2020-04-27") expect_equal(fr_day$day[fr_day$model == "L4"], "2020-05-10") expect_equal(fr_day$day[fr_day$model == "L5"], "2020-05-25") expect_equal(fr_day$day[fr_day$model == "L6"], "2020-06-11") expect_equal(fr_day$day[fr_day$model == "Pp"], "2020-07-05") expect_equal(fr_day$day[fr_day$model == "Ad"], "2020-08-11") # should be 2020-08-12, but we can explain the difference with slightly different input than in Dr. Halbigs study expect_equal(fr_day$day[fr_day$model == "custers"], "2020-03-20") expect_equal(fr_day$day[fr_day$model == "wagenhoff"], "2020-03-18") expect_equal(fr_day$day[fr_day$model == "meurisse"], "2020-03-11") }) test_that("calc_baskerville", { expect_equal(PHENTHAUproc:::calc_baskerville(34, 60, 50), 2.75) }) test_that("convert_hour_to_meanminmax",{ x <- load_test("hour")[1:48, c("date", "tmean")] x <- convert_df_to_srl(x) x <- convert_hour_to_meanminmax(x) x <- round(as.data.frame(x), 1) expect_equal(x[[1]], 21.4) expect_equal(x[[2]], 17.5) expect_equal(x[[3]], 18.8) expect_equal(x[[4]], 11.6) expect_equal(x[[5]], 24) expect_equal(x[[6]], 22) })