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 5cb62e4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/digit_calculator_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
defmodule BRAN.DigitCalculatorTest do
use ExUnit.Case
use ExUnit.Parameterized

alias BRAN.DigitCalculator

@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
},
{[4, 3, 1, 3, 4, 3, 1, 2, 9, 0], @itau_mod_factor, @itau_weight, false, 1}
]
end
end

0 comments on commit 5cb62e4

Please sign in to comment.