Skip to content

Commit

Permalink
test: add missing test for FileSize.Units.Info.new/1
Browse files Browse the repository at this point in the history
  • Loading branch information
tlux committed Apr 23, 2020
1 parent 2c6d406 commit 8903280
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/file_size/units/info_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ defmodule FileSize.Units.InfoTest do
alias FileSize.Units
alias FileSize.Units.Info

describe "new/1" do
test "build info" do
assert Info.new(
exp: 3,
mod: FileSize.Byte,
name: :gb,
symbol: "GB",
system: :si
) == %Info{
coeff: 1_000_000_000,
exp: 3,
max_value: 999_999_999_999,
min_value: 1_000_000_000,
mod: FileSize.Byte,
name: :gb,
symbol: "GB",
system: :si
}

assert Info.new(
exp: 2,
mod: FileSize.Bit,
name: :mibit,
symbol: "Mibit",
system: :iec
) == %Info{
coeff: 1_048_576,
exp: 2,
max_value: 1_073_741_823,
min_value: 1_048_576,
mod: FileSize.Bit,
name: :mibit,
symbol: "Mibit",
system: :iec
}
end
end

describe "normalize_value/2" do
test "success" do
Enum.each(Units.list(), fn info ->
Expand Down

0 comments on commit 8903280

Please sign in to comment.