I have a function in Elixir that produces three random RGB tuples in a list.
defmodule Color do
@doc """
Create three random r,g,b colors as a list of three tuples
## Examples
iex> colors = Color.pick_color()
iex> colors
[{207, 127, 117}, {219, 121, 237}, {109, 101, 206}]
"""
def pick_color() do
color = Enum.map((0..2), fn(x)->
r = Enum.random(0..255)
g = Enum.random(0..255)
b = Enum.random(0..255)
{r, g, b}
end)
end
When I run my tests, my doctests fail. The resulting list of tuples are different than what is defined in my doctest. How can I write a doctest for a function that returns a random value?