Sha256: 10198ae9fcc38a06b2288a5eeedddadb28ed4e705393af65bdc55e28b1330582

Contents?: true

Size: 1.44 KB

Versions: 326

Compression:

Stored size: 1.44 KB

Contents

if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("hexadecimal.exs", __DIR__)
end

ExUnit.start
ExUnit.configure exclude: :pending, trace: true

defmodule HexadecimalTest do
  use ExUnit.Case

  test "returns 1 when hex is 1" do
    assert Hexadecimal.to_decimal("1") ==  1
  end

  @tag :pending
  test "returns 12 when hex is c" do
    assert Hexadecimal.to_decimal("c") == 12
  end

  @tag :pending
  test "hexadecimal is case insensitive" do
    assert Hexadecimal.to_decimal("C") == 12
  end

  @tag :pending
  test "returns 16 when hex is 10" do
    assert Hexadecimal.to_decimal("10") == 16
  end

  @tag :pending
  test "returns 175 when hex is af" do
    assert Hexadecimal.to_decimal("af") == 175
  end

  @tag :pending
  test "returns 256 when hex is 100" do
    assert Hexadecimal.to_decimal("100") == 256
  end

  @tag :pending
  test "returns 105_166 when hex is 19ace" do
    assert Hexadecimal.to_decimal("19ace") == 105_166
  end

  @tag :pending
  test "returns 0 when hex is invalid" do
    assert Hexadecimal.to_decimal("carrot") == 0
  end

  @tag :pending
  test "returns 0 when hex represents black" do
    assert Hexadecimal.to_decimal("000000") == 0
  end

  @tag :pending
  test "returns 16_777_215 when hex represents white" do
    assert Hexadecimal.to_decimal("ffffff") == 16_777_215
  end

  @tag :pending
  test "returns 16_776_960 when hex represents yellow" do
    assert Hexadecimal.to_decimal("ffff00") == 16_776_960
  end
end

Version data entries

326 entries across 326 versions & 1 rubygems

Version Path
trackler-2.2.1.89 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.88 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.87 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.86 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.85 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.84 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.83 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.82 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.81 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.80 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.79 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.78 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.77 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.76 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.75 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.74 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.73 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.72 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.71 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.70 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs