Skip to content

Instantly share code, notes, and snippets.

@damonkelley
Created May 13, 2019 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save damonkelley/96757a114743d9867a97fa7c00dd4754 to your computer and use it in GitHub Desktop.
Save damonkelley/96757a114743d9867a97fa7c00dd4754 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