timings/fc21f113a48e14c5e37cb41e9f6cad3e59ff783d/grattan/tests/testthat/test_pmax_friends.R

context("Test pmaxC, pminC etc work as intended")

test_that("grattan functions and pmax pmin give identical results", {
  x <- rcauchy(100)
  y <- rcauchy(100)
  z <- rcauchy(100)
  a <- rcauchy(1)
  expect_equal(pmaxC(x, a), pmax(x, a))
  expect_equal(pminC(x, a), pmin(x, a))
  expect_equal(pmaxV(x, y), pmax(x, y))
  expect_equal(pminV(x, y), pmin(x, y))
  expect_equal(pmax3(x, y, z), pmax(x, pmax(y, z)))
  
  expect_error(pmax3(1, 2, 3:4))
  expect_error(pmaxV(1, 1:2))
})
HughParsonage/grattan documentation built on April 1, 2024, 4:10 a.m.