File tree Expand file tree Collapse file tree 6 files changed +8
-65
lines changed
Expand file tree Collapse file tree 6 files changed +8
-65
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ defmodule PolishValidators.Iban do
1414 iex> PolishValidators.Iban.validate("PL61109010140000071219812874")
1515 { :ok, "Valid" }
1616
17+ iex> PolishValidators.Iban.validate("61109010140000071219812874")
18+ { :ok, "Valid" }
19+
1720 iex> PolishValidators.Iban.validate("PL61109010140000071219812871")
1821 { :error, "Wrong checksum" }
1922
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ defmodule PolishValidators.Regon do
1212 """
1313
1414 @ doc """
15- Validate regon number.
15+ Validate Regon number.
1616
1717 ## Examples
1818
Original file line number Diff line number Diff line change 11defmodule PolishValidatorsIbanTest do
22 use ExUnit.Case
3- doctest PolishValidators
4-
5- test "valid iban with PL prefix" do
6- assert PolishValidators.Iban . validate ( "PL61109010140000071219812874" ) == { :ok , "Valid" }
7- end
8-
9- test "valid iban without PL prefix" do
10- assert PolishValidators.Iban . validate ( "61109010140000071219812874" ) == { :ok , "Valid" }
11- end
12-
13- test "iban with invalid checksum" do
14- assert PolishValidators.Iban . validate ( "PL61109010140000071219812871" ) == { :error , "Wrong checksum" }
15- end
16-
17- test "iban with wrong length" do
18- assert PolishValidators.Iban . validate ( "PL611090101400000712198128" ) == { :error , "Invalid length" }
19- end
3+ doctest PolishValidators.Iban
204end
215
Original file line number Diff line number Diff line change 11defmodule PolishValidatorsNipTest do
22 use ExUnit.Case
3- doctest PolishValidators
4-
5- test "valid nip" do
6- assert PolishValidators.Nip . validate ( "6597068174" ) == { :ok , "Valid" }
7- end
8-
9- test "nip with invalid checksum" do
10- assert PolishValidators.Nip . validate ( "6597068172" ) == { :error , "Wrong checksum" }
11- end
12-
13- test "nip with wrong length" do
14- assert PolishValidators.Nip . validate ( "2" ) == { :error , "Invalid length" }
15- end
3+ doctest PolishValidators.Nip
164end
Original file line number Diff line number Diff line change 11defmodule PolishValidatorsPeselTest do
22 use ExUnit.Case
3- doctest PolishValidators
4-
5- test "valid pesel" do
6- assert PolishValidators.Pesel . validate ( "44051401359" ) == { :ok , "Valid" }
7- end
8-
9- test "pesel with invalid checksum" do
10- assert PolishValidators.Pesel . validate ( "44051401354" ) == { :error , "Wrong checksum" }
11- end
12-
13- test "pesel with wrong length" do
14- assert PolishValidators.Pesel . validate ( "2" ) == { :error , "Invalid length" }
15- end
3+ doctest PolishValidators.Pesel
164end
Original file line number Diff line number Diff line change 11defmodule PolishValidatorsRegonTest do
22 use ExUnit.Case
3- doctest PolishValidators
4-
5- test "valid regon (9 digits)" do
6- assert PolishValidators.Regon . validate ( "517001918" ) == { :ok , "Valid" }
7- end
8-
9- test "valid regon (14 digits)" do
10- assert PolishValidators.Regon . validate ( "87515234723651" ) == { :ok , "Valid" }
11- end
12-
13- test "regon (9 digits) with invalid checksum" do
14- assert PolishValidators.Regon . validate ( "517001912" ) == { :error , "Wrong checksum" }
15- end
16-
17- test "regon (14 digits) with invalid checksum" do
18- assert PolishValidators.Regon . validate ( "87515234723652" ) == { :error , "Wrong checksum" }
19- end
20-
21- test "regon with wrong length" do
22- assert PolishValidators.Regon . validate ( "51700191" ) == { :error , "Invalid length" }
23- end
3+ doctest PolishValidators.Regon
244end
255
You can’t perform that action at this time.
0 commit comments