EDRPOU parser fixes

This commit is contained in:
2024-12-12 12:05:18 -05:00
parent f9a45fb29d
commit 0edc3c3139
4 changed files with 52 additions and 30 deletions

View File

@@ -1,6 +1,29 @@
defmodule UkraineTaxidEx.Edrpou.CheckSumTest do
use ExUnit.Case
alias UkraineTaxidEx.Edrpou.CheckSum
doctest UkraineTaxidEx.Edrpou.Parser
describe "weights/2" do
test "returns base weights by default" do
assert CheckSum.weights() == [1, 2, 3, 4, 5, 6, 7]
end
test "returns base weights when not added 2" do
assert CheckSum.weights(:base, false) == [1, 2, 3, 4, 5, 6, 7]
end
test "returns alternative weights when added 2" do
assert CheckSum.weights(:alternative, false) == [7, 1, 2, 3, 4, 5, 6]
end
test "returns base weights + 2" do
assert CheckSum.weights(:base, true) == [3, 4, 5, 6, 7, 8, 9]
end
test "returns alternative weights + 2 " do
assert CheckSum.weights(:alternative, true) == [9, 3, 4, 5, 6, 7, 8]
end
end
describe "check_sum/1" do
test "calculates correct checksum for EDRPOU with base weights (< 30M) short EDRPOU with leading zeros" do

View File

@@ -1,26 +1,3 @@
defmodule UkraineTaxidEx.EdrpouTest do
use ExUnit.Case
# alias UkraineTaxidEx.Edrpou
# describe "weights/2" do
# test "returns base weights by default" do
# assert Edrpou.weights() == [1, 2, 3, 4, 5, 6, 7]
# end
# test "returns base weights when not doubled" do
# assert Edrpou.weights(:base, false) == [1, 2, 3, 4, 5, 6, 7]
# end
# test "returns alternative weights when not doubled" do
# assert Edrpou.weights(:alternative, false) == [7, 1, 2, 3, 4, 5, 6]
# end
# test "returns doubled base weights" do
# assert Edrpou.weights(:base, true) == [2, 4, 6, 8, 10, 12, 14]
# end
# test "returns doubled alternative weights" do
# assert Edrpou.weights(:alternative, true) == [14, 2, 4, 6, 8, 10, 12]
# end
# end
end