tests/testthat/test-number-conditions.R

# multiple_conditions_fun1
test_that("multiple_conditions_fun1 has expected output when one or more values
           is out of range", {
            expect_equal(multiple_conditions_fun1(-1, 2, 2, 2, 1, 2), 1)
          })

test_that("multiple_conditions_fun1 has expected output when all values
           are out of range", {
             expect_equal(multiple_conditions_fun1(-1, -2, -2, -2, -1, -2),
                          0)
           })

test_that("multiple_conditions_fun has expected output when all values
           are in range", {
             expect_equal(multiple_conditions_fun1(1, 2, 2, 2, 1, 2), 2)
           })

# multiple_conditions_fun2
test_that("multiple_conditions_fun2 has expected output when one or more values
          is out of range", {
            expect_equal(multiple_conditions_fun2(-1, 2, 2, 2, 2, 1, 2), 1)
            })

test_that("multiple_conditions_fun2 has expected output when all values
          are out of range", {
            expect_equal(multiple_conditions_fun2(-1, -2, -2, -2, -2, -1, -2),
                         0)
            })

test_that("multiple_conditions_fun2 has expected output when all values
          are in range", {
            expect_equal(multiple_conditions_fun2(1, 2, 2, 2, 2, 1, 2), 2)
          })

Try the cchsflow package in your browser

Any scripts or data that you put into this service are public.

cchsflow documentation built on May 28, 2022, 1:09 a.m.