2020-01-01 20:25:50 +13:00
|
|
|
defmodule TestUtils do
|
|
|
|
@moduledoc false
|
|
|
|
|
2021-12-09 20:10:07 +13:00
|
|
|
@chars ~w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
|
|
|
|
|
2020-01-01 20:25:50 +13:00
|
|
|
def random_module_name do
|
2021-12-09 20:10:07 +13:00
|
|
|
name = random_string("", 16)
|
2020-01-01 20:25:50 +13:00
|
|
|
|
|
|
|
Module.concat(__MODULE__, name)
|
|
|
|
end
|
2021-12-09 20:10:07 +13:00
|
|
|
|
|
|
|
defp random_string(str, 0), do: str
|
|
|
|
|
|
|
|
defp random_string(str, count) do
|
|
|
|
"#{str}#{Enum.random(@chars)}"
|
|
|
|
|> random_string(count - 1)
|
|
|
|
end
|
2020-01-01 20:25:50 +13:00
|
|
|
end
|