# View Source Machete.IntegerMatcher(Machete v0.2.3)

Defines a matcher that matches integer values

# Link to this section Summary

## Types

Describes the arguments that can be passed to this matcher

Describes an instance of this matcher

## Functions

Matches against integer values

# opts()

View Source
```@type opts() :: [
positive: boolean(),
negative: boolean(),
nonzero: boolean(),
min: integer(),
max: integer()
]```

Describes the arguments that can be passed to this matcher

# t()

View Source (opaque)
`@opaque t()`

Describes an instance of this matcher

# integer(opts \\ [])

View Source
`@spec integer(opts()) :: t()`

Matches against integer values

Takes the following arguments:

• `positive`: When `true`, requires the matched integer be positive or zero
• `negative`: When `true`, requires the matched integer be negative or zero
• `nonzero`: When `true`, requires the matched integer be nonzero
• `min`: Requires the matched integer be greater than or equal to the specified value
• `max`: Requires the matched integer be less than or equal to the specified value

Examples:

``````iex> assert 1 ~> integer()
true

iex> assert 1 ~> integer(positive: true)
true

iex> assert 0 ~> integer(positive: true)
true

iex> assert -1 ~> integer(positive: false)
true

iex> refute 0 ~> integer(positive: false)
false

iex> assert -1 ~> integer(negative: true)
true

iex> assert 0 ~> integer(negative: true)
true

iex> assert 1 ~> integer(negative: false)
true

iex> refute 0 ~> integer(negative: false)
false

iex> assert 1 ~> integer(nonzero: true)
true

iex> assert 0 ~> integer(nonzero: false)
true

iex> assert 2 ~> integer(min: 2)
true

iex> assert 2 ~> integer(max: 2)
true``````