Skip to content

Commit

Permalink
(feat) Add UT for digit_calculator mod function
Browse files Browse the repository at this point in the history
  • Loading branch information
log4b committed Mar 1, 2021
1 parent 06046c7 commit 74998ba
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/digit_calculator_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
defmodule BRAN.DigitCalculatorTest do
use ExUnit.Case
use ExUnit.Parameterized

alias BRAN.DigitCalculatorTest

@itau_weight [2, 1, 2, 1, 2, 1, 2, 1, 2]
@itau_mod_factor 10

test_with_params "returns mod to consider on Itau validation",
fn account_number, mod_factor, weights, sum_result, expected ->
assert DigitCalculator.mod(
account_number,
mod_factor,
weights,
sum_result
) == expected
end do
[
# Valid Accounts
{[4, 3, 1, 3, 4, 3, 1, 2, 9, 0], @itau_mod_factor, @itau_weight, true, 10},
{
[7, 0, 6, 8, 6, 0, 5, 2, 8, 8],
@itau_mod_factor,
@itau_weight,
true,
1
}
]
end
end

0 comments on commit 74998ba

Please sign in to comment.