Created
March 27, 2020 07:10
-
-
Save houmanka/6b589b98546f7513aef94da0ec34d6c4 to your computer and use it in GitHub Desktop.
russian_peasant_multiplication_increment_test
This file contains hidden or 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 RussianPeasantMultiplication.IncrementTest do | |
use ExUnit.Case | |
doctest RussianPeasantMultiplication.Increment | |
import Monad.Result | |
alias RussianPeasantMultiplication.Increment, as: RPM_Inc | |
test "max number must be a number" do | |
items = [ %{requested: "238", max_round: "4"}, | |
%{requested: 238, max_round: "4"}, | |
%{requested: "238", max_round: 4} | |
] | |
Enum.filter(items, fn(item) -> | |
res = RPM_Inc.increment(item.requested, item.max_round) | |
assert res.error == "Requested number and Max round must be numbers" | |
end) | |
end | |
test "max number must be a number greater than zero" do | |
res = RPM_Inc.increment(238, 0) | |
assert res.error == "Must be greater than zero" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment