Sha256: 14ba07856fdb8912a0c19a8fb4840269e7ac9305b4e91838c7a2817e923b1448

Contents?: true

Size: 1.44 KB

Versions: 69

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

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.179 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.178 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.177 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.176 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.175 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.174 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.173 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.172 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.171 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.170 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.169 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.167 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.166 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.165 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.164 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.163 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.162 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.161 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs
trackler-2.2.1.160 tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs