From 18e35c5a5c71ff160603554b28a6c6cd6f9b735e Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 14 Jun 2022 21:23:01 +0200 Subject: [PATCH] add medal to farm output object --- NEWS.md | 1 + R/er_main.R | 3 +++ tests/testthat/test-er.R | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index ca88dbd..e6fe79d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ - internal table `bbwp_measures` with column bbwp_conflict - avoid additive scoring for conflicting measures in `bbwp_meas_score` and `bbp_meas_rank` - avoid additive scoring for conflicting measures in `er_meas_score` +- add `er_medal` as farm output for `ecoregeling` - tests are updated ## 0.5.0 diff --git a/R/er_main.R b/R/er_main.R index 296f55b..1633b32 100644 --- a/R/er_main.R +++ b/R/er_main.R @@ -112,6 +112,9 @@ ecoregeling <- function(B_SOILTYPE_AGR, B_LU_BRP, B_LU_BBWP,B_GWL_CLASS, B_SLOPE # Add field id setnames(dt.fields,'id','field_id') + # add fake medal for the moment + dt.farm$er_medal <- 'silver' + # set output object out <- list(farm = as.list(dt.farm),fields = dt.fields) diff --git a/tests/testthat/test-er.R b/tests/testthat/test-er.R index a1c607f..ae0e81c 100644 --- a/tests/testthat/test-er.R +++ b/tests/testthat/test-er.R @@ -57,8 +57,8 @@ test <- ecoregeling(B_SOILTYPE_AGR = c('dekzand', 'loess', 'rivierklei'), test_that("check ecoregeling", { expect_equal( - object = as.numeric(unlist(test$farm)), - expected = c(6,9,6,11,6,0,460), + object = as.character(unlist(test$farm)), + expected = c(6,9,6,11,6,0,460,'silver'), tolerance = 0.01) }) @@ -99,8 +99,8 @@ test <- ecoregeling(B_SOILTYPE_AGR = c('dekzand', 'loess', 'rivierklei'), test_that("check ecoregeling", { expect_equal( - object = as.numeric(unlist(test$farm)), - expected = c(23,23,27,51,16,15,802), + object = as.character(unlist(test$farm)), + expected = c(23,23,27,51,16,15,802,'silver'), tolerance = 0.01) })