From 6190ff0c38d727c0017a86f5a5fce6ecc193c35b Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Tue, 8 Oct 2024 11:25:51 -0300 Subject: [PATCH] test range polarization --- tests/testthat/test-direction-polarization.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-direction-polarization.R b/tests/testthat/test-direction-polarization.R index e99cc296..fd74de23 100644 --- a/tests/testthat/test-direction-polarization.R +++ b/tests/testthat/test-direction-polarization.R @@ -71,8 +71,10 @@ test_that('one column added to the result DT', { ncol(direction_polarization(DT))) }) -test_that('column added to the result DT is numeric', { +test_that('column added to the result DT is numeric, between 0-1', { expect_type(direction_polarization(DT)$polarization, 'double') + expect_gte(min(direction_polarization(DT)$polarization, na.rm = TRUE), 0) + expect_lte(max(direction_polarization(DT)$polarization, na.rm = TRUE), 1) }) test_that('returns a data.table', {