Skip to content

Instantly share code, notes, and snippets.

@maxx-coffee
Last active March 23, 2020 20:22
Show Gist options
  • Save maxx-coffee/52424b5a64db31c545ea2acbc461fb76 to your computer and use it in GitHub Desktop.
Save maxx-coffee/52424b5a64db31c545ea2acbc461fb76 to your computer and use it in GitHub Desktop.
defmodule Dargons.DiceTest do
use ExUnit.Case
alias Dargons.Dice
describe "rolling dice" do
test "rolling a single D20" do
[first_dice | _] = dice = Dice.roll(20)
assert length(dice) == 1
assert first_dice <= 20
end
test "rolling multiple D20's" do
dice = Dice.roll(20, 3)
dice
|> Enum.each(&assert &1 <= 20)
assert length(dice) == 3
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment