scrabble-score

This commit is contained in:
2024-06-29 02:40:08 -04:00
parent dad68cb89f
commit 8fbd81ed9d
10 changed files with 302 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
defmodule ScrabbleTest do
use ExUnit.Case
test "empty word scores zero" do
assert Scrabble.score("") == 0
end
test "whitespace scores zero" do
assert Scrabble.score(" \t\n") == 0
end
test "uppercase letter" do
assert Scrabble.score("A") == 1
end
test "valuable letter" do
assert Scrabble.score("f") == 4
end
test "short word" do
assert Scrabble.score("at") == 2
end
test "short, valuable word" do
assert Scrabble.score("zoo") == 12
end
test "medium word" do
assert Scrabble.score("street") == 6
end
test "medium, valuable word" do
assert Scrabble.score("quirky") == 22
end
test "long, mixed-case word" do
assert Scrabble.score("OxyphenButazone") == 41
end
test "english-like word" do
assert Scrabble.score("pinata") == 8
end
test "entire alphabet available" do
assert Scrabble.score("abcdefghijklmnopqrstuvwxyz") == 87
end
end

View File

@@ -0,0 +1,2 @@
ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)