From e1d0e49421f1a809ad9947e0f3aeeaf39e3bd27c Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Mon, 7 Oct 2024 13:53:16 +0200 Subject: [PATCH] add test --- tests/testthat/test-label-lut.R | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/testthat/test-label-lut.R diff --git a/tests/testthat/test-label-lut.R b/tests/testthat/test-label-lut.R new file mode 100644 index 00000000..36df0670 --- /dev/null +++ b/tests/testthat/test-label-lut.R @@ -0,0 +1,11 @@ +test_that("label_lut gives correct answers", { + + short <- c("A", "B", "C") + lut <- c("A" = "Apple", "C" = "Cherry", "D" = "Date") + + expect_equal(label_lut(lut)(short), c("Apple", "B", "Cherry")) + expect_equal( + label_lut(lut, nomatch = "Banana")(short), + c("Apple", "Banana", "Cherry") + ) +})