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

is_less_than(expected, label = NULL, ...)

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

is_more_than(expected, label = NULL, ...)

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

Arguments

expected

Expected value

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.

...

other values passed to all.equal

object

object to test

info

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

expected.label

Equivalent of label for shortcut form.

See Also

Other expectations: equals_reference, expect_equal_to_reference; equals, expect_equal; expect_equivalent, is_equivalent_to; expect_error, throws_error; expect_false, expect_true, is_false, is_true; expect_identical, is_identical_to; expect_is, is_a; expect_match, matches; expect_message, shows_message; expect_named, has_names; expect_null, is_null; expect_output, prints_text; expect_warning, gives_warning; 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.9.1 Index]