File: checkCount.R

package info (click to toggle)
r-cran-checkmate 2.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,512 kB
  • sloc: ansic: 2,211; sh: 9; makefile: 8
file content (55 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#' Check if an argument is a count
#'
#' @description
#' A count is defined as non-negative integerish value.
#'
#' @templateVar fn Count
#' @template x
#' @template na-handling
#' @template na.ok
#' @param positive [\code{logical(1)}]\cr
#'  Must \code{x} be positive (>= 1)?
#'  Default is \code{FALSE}, allowing 0.
#' @template tol
#' @template coerce
#' @template null.ok
#' @template checker
#' @template note-convert
#' @family scalars
#' @useDynLib checkmate c_check_count
#' @export
#' @examples
#' testCount(1)
#' testCount(-1)
checkCount = function(x, na.ok = FALSE, positive = FALSE, tol = sqrt(.Machine$double.eps), null.ok = FALSE) {
  .Call(c_check_count, x, na.ok, positive, tol, null.ok)
}

#' @export
#' @rdname checkCount
check_count = checkCount

#' @export
#' @include makeAssertion.R
#' @template assert
#' @rdname checkCount
assertCount = makeAssertionFunction(checkCount, c.fun = "c_check_count", coerce = TRUE, use.namespace = FALSE)

#' @export
#' @rdname checkCount
assert_count = assertCount

#' @export
#' @include makeTest.R
#' @rdname checkCount
testCount = makeTestFunction(checkCount, c.fun = "c_check_count")

#' @export
#' @rdname checkCount
test_count = testCount

#' @export
#' @include makeExpectation.R
#' @template expect
#' @rdname checkCount
expect_count = makeExpectationFunction(checkCount, c.fun = "c_check_count", use.namespace = FALSE)