expect-compare {testthat}R Documentation

Expectation: is returned value less or greater than specified value?

Description

This is useful for ensuring returned value is below a ceiling or above a floor.

Usage

expect_less_than(object, expected, ..., info = NULL, label = NULL,
  expected.label = NULL)

expect_lt(object, expected)

expect_lte(object, expected)

expect_more_than(object, expected, ..., info = NULL, label = NULL,
  expected.label = NULL)

expect_gt(object, expected)

expect_gte(object, expected)

Arguments

object

object to test

expected

Expected value

...

other values passed to all.equal

info

extra information to be included in the message (useful when writing tests in loops).

label

For full form, label of expected object used in error messages. Useful to override default (deparsed expected expression) when doing tests in a loop. For short cut form, object label. When NULL, computed from deparsed object.

expected.label

Equivalent of label for shortcut form.

See Also

Other expectations: equivalence, expect_equal, expect_equivalent, expect_identical; expect_equal_to_reference; expect_error, expect_match, expect_message, expect_output, expect_warning, matching-expectations; expect_false, expect_true; expect_is; expect_named; expect_null; expect_silent; takes_less_than

Examples

a <- 9
expect_less_than(a, 10)

## Not run: 
expect_less_than(11, 10)

## End(Not run)

a <- 11
expect_more_than(a, 10)
## Not run: 
expect_more_than(9, 10)

## End(Not run)

[Package testthat version 0.11.0 Index]