Created
May 13, 2019 23:19
-
-
Save damonkelley/96757a114743d9867a97fa7c00dd4754 to your computer and use it in GitHub Desktop.
Parameterized Tests in Elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ParamerizedTest do | |
use ExUnit.Case | |
@parameters [ | |
{0, 0}, | |
{1, 1}, | |
{2, 4}, | |
{3, 9}, | |
] | |
for {input, expected} <- @parameters do | |
test "#{input} * #{input} == #{expected}" do | |
assert unquote(input) * unquote(input) == unquote(expected) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment