defmodule MedicalTranscription.UtilitiesTest do | |
use ExUnit.Case, async: true | |
alias MedicalTranscription.Utilities | |
describe "tally/1" do | |
test "it counts elements in an enumerable of atoms" do | |
input = [:one, :two, :three, :two, :two, :one] | |
assert Utilities.tally(input) == %{ | |
one: 2, | |
two: 3, | |
three: 1 | |
} | |
end | |
end | |
describe "tally_to_string/1" do | |
test "it formats a string version of the output of `tally/1`" do | |
input = %{ | |
one: 2, | |
two: 3, | |
three: 1 | |
} | |
assert Utilities.tally_to_string(input) == "one (2), two (3), three (1)" | |
end | |
end | |
end | |