Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

update tests for classification functions #24

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/testthat/test-muac-classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,29 @@ testthat::expect_type(dps_class, "character")
testthat::expect_vector(dps_class)


## Standard deviation
## Standard deviation ----
sd_results <- sd(muac_data$muac)
sd_class <- classify_sd(sd_results)

testthat::expect_type(sd_class, "character")
testthat::expect_vector(sd_class)


## Data Quality
## Data Quality ----
q_results <- classify_quality(age_ratio_class, sex_ratio_class, dps_class, sd_class)

testthat::expect_type(q_results, "list")
testthat::expect_vector(q_results)
testthat::expect_named(q_results, c("q_score", "q_class"))


## Classifying malnutrition ----
wasting_class <- classify_acute_malnutrition(
muac_data$muac, muac_units = "cm",
oedema = muac_data$oedema,
oedema_recode = c(1, 2)
)

testthat::expect_type(wasting_class, "character")
testthat::expect_vector(wasting_class)