diff --git a/exercises/practice/all-your-base/.meta/example.ex b/exercises/practice/all-your-base/.meta/example.ex index dad81d5946..072ed089e4 100644 --- a/exercises/practice/all-your-base/.meta/example.ex +++ b/exercises/practice/all-your-base/.meta/example.ex @@ -5,14 +5,14 @@ defmodule AllYourBase do """ @spec convert(list, integer, integer) :: {:ok, list} | {:error, String.t()} - def convert(_, _, output_base) when output_base < 2 do - {:error, "output base must be >= 2"} - end - def convert(_, input_base, _) when input_base < 2 do {:error, "input base must be >= 2"} end + def convert(_, _, output_base) when output_base < 2 do + {:error, "output base must be >= 2"} + end + def convert(digits, input_base, output_base) do if Enum.all?(digits, &(0 <= &1 && &1 < input_base)) do {:ok, do_convert(digits, input_base, output_base)} diff --git a/exercises/practice/all-your-base/test/all_your_base_test.exs b/exercises/practice/all-your-base/test/all_your_base_test.exs index 3ee560c572..b3a22d7c77 100644 --- a/exercises/practice/all-your-base/test/all_your_base_test.exs +++ b/exercises/practice/all-your-base/test/all_your_base_test.exs @@ -104,6 +104,6 @@ defmodule AllYourBaseTest do @tag :pending test "convert both bases are negative" do - assert AllYourBase.convert([1], -2, -7) == {:error, "output base must be >= 2"} + assert AllYourBase.convert([1], -2, -7) == {:error, "input base must be >= 2"} end end