-
-
Save ramalho/1fa98648737e6bb2d4d4b77a938388f7 to your computer and use it in GitHub Desktop.
Parameterized Tests in Elixir
This file contains 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