Last active
January 19, 2020 04:04
-
-
Save koga1020/9f79d5942153e853fb80cd63c5d0e24b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule AggregaterTest do | |
use ExUnit.Case | |
doctest Aggregater | |
describe "test for Aggregater.counter" do | |
test "シンプルなケース" do | |
assert Aggregater.counter(["A", "B", "C", "D"]) == %{"A" => 1, "B" => 1, "C" => 1, "D" => 1} | |
end | |
test "重複した値がうまくカウントされているか" do | |
assert Aggregater.counter(["A", "B", "A", "C"]) == %{"A" => 2, "B" => 1, "C" => 1} | |
end | |
test "リストが空の場合" do | |
assert Aggregater.counter([]) == %{} | |
end | |
test "複数の値が重複する場合" do | |
assert Aggregater.counter(["A", "B", "A", "C", "D", "C", "E", "F", "D", "F", "G"]) == %{ | |
"A" => 2, | |
"B" => 1, | |
"C" => 2, | |
"D" => 2, | |
"E" => 1, | |
"F" => 2, | |
"G" => 1 | |
} | |
end | |
test "重複の発生が3回以上" do | |
assert Aggregater.counter(["A", "A", "A"]) == %{"A" => 3} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment