tests/testthat/test_examples.R

# ---- Level 1: expectations; individual checks  ------
# Are the values equal, equivalent or identical?
#  expect_equal(x, y)
#  expect_equivalent(x, y)
#  expect_identical(x, y)
# Does the code produce any output/message/warning/error?
#  expect_output(x, y)
#  expect_message(x, y)
#  expect_warning(x, y)
#  expect_error(x, y)
# How does the returned value compare to a specified value?
#  expect_lt(x, y)
#  expect_lte(x, y)
#  expect_gt(x, y)
#  expect_gte(x, y)
# Many more expect_SOMETHING(...) function exist



# --- Level 2: test block of related behaviour -----
test_that("dummy examples of a test block", {
  expect_equal(1, 2/2)
  expect_equal(2, sqrt(2)^2,ignore_attr = TRUE)
})
# as many test_that("message", {expect_functions(...)}) as desired in 1+ files


# --- Level 3: testing the package ----
# in R-studio: Tab "Build" ->  Button "Test"
# otherwise, call devtools::test()

Try the DistributionalDDA package in your browser

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

DistributionalDDA documentation built on Oct. 20, 2026, 5:06 p.m.