Browse Source

Roman problem.

master
Julio Biason 4 years ago
parent
commit
4e1851b2b0
  1. 8
      elixir/roman-numerals/lib/roman_numerals.ex
  2. 28
      elixir/roman-numerals/mix.exs
  3. 93
      elixir/roman-numerals/test/roman_numerals_test.exs
  4. 2
      elixir/roman-numerals/test/test_helper.exs

8
elixir/roman-numerals/lib/roman_numerals.ex

@ -0,0 +1,8 @@
defmodule RomanNumerals do
@doc """
Convert the number to a roman number.
"""
@spec numeral(pos_integer) :: String.t()
def numeral(number) do
end
end

28
elixir/roman-numerals/mix.exs

@ -0,0 +1,28 @@
defmodule RomanNumerals.MixProject do
use Mix.Project
def project do
[
app: :roman_numerals,
version: "0.1.0",
# elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end

93
elixir/roman-numerals/test/roman_numerals_test.exs

@ -0,0 +1,93 @@
defmodule RomanNumeralsTest do
use ExUnit.Case
# @tag :pending
test "1" do
assert RomanNumerals.numeral(1) == "I"
end
@tag :pending
test "2" do
assert RomanNumerals.numeral(2) == "II"
end
@tag :pending
test "3" do
assert RomanNumerals.numeral(3) == "III"
end
@tag :pending
test "4" do
assert RomanNumerals.numeral(4) == "IV"
end
@tag :pending
test "5" do
assert RomanNumerals.numeral(5) == "V"
end
@tag :pending
test "6" do
assert RomanNumerals.numeral(6) == "VI"
end
@tag :pending
test "9" do
assert RomanNumerals.numeral(9) == "IX"
end
@tag :pending
test "27" do
assert RomanNumerals.numeral(27) == "XXVII"
end
@tag :pending
test "48" do
assert RomanNumerals.numeral(48) == "XLVIII"
end
@tag :pending
test "59" do
assert RomanNumerals.numeral(59) == "LIX"
end
@tag :pending
test "93" do
assert RomanNumerals.numeral(93) == "XCIII"
end
@tag :pending
test "141" do
assert RomanNumerals.numeral(141) == "CXLI"
end
@tag :pending
test "163" do
assert RomanNumerals.numeral(163) == "CLXIII"
end
@tag :pending
test "402" do
assert RomanNumerals.numeral(402) == "CDII"
end
@tag :pending
test "575" do
assert RomanNumerals.numeral(575) == "DLXXV"
end
@tag :pending
test "911" do
assert RomanNumerals.numeral(911) == "CMXI"
end
@tag :pending
test "1024" do
assert RomanNumerals.numeral(1024) == "MXXIV"
end
@tag :pending
test "3000" do
assert RomanNumerals.numeral(3000) == "MMM"
end
end

2
elixir/roman-numerals/test/test_helper.exs

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