Skip to content

Instantly share code, notes, and snippets.

@ramalho
Forked from damonkelley/parameterized_test.exs
Created May 14, 2019 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramalho/1fa98648737e6bb2d4d4b77a938388f7 to your computer and use it in GitHub Desktop.
Save ramalho/1fa98648737e6bb2d4d4b77a938388f7 to your computer and use it in GitHub Desktop.
Parameterized Tests in Elixir
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