Sha256: 8e30dbd6dc79307911c2bb1163b821941adabc426b9ab603a74dd0b0d419c69f

Contents?: true

Size: 1.49 KB

Versions: 167

Compression:

Stored size: 1.49 KB

Contents

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

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

defmodule PhoneTest do
  use ExUnit.Case

  test "cleans number" do
    assert Phone.number("(123) 456-7890") == "1234567890"
  end

  @tag :pending
  test "cleans number with dots" do
    assert Phone.number("123.456.7890") == "1234567890"
  end

  @tag :pending
  test "valid when 11 digits and first is 1" do
    assert Phone.number("11234567890") == "1234567890"
  end

  @tag :pending
  test "invalid when 11 digits" do
    assert Phone.number("21234567890") == "0000000000"
  end

  @tag :pending
  test "invalid when 9 digits" do
    assert Phone.number("123456789") == "0000000000"
  end

  @tag :pending
  test "invalid when proper number of digits but letters mixed in" do
    assert Phone.number("1a2a3a4a5a6a7a8a9a0a") == "0000000000"
  end

  @tag :pending
  test "invalid with correct number of characters but some are letters" do
    assert Phone.number("1a2a3a4a5a") == "0000000000"
  end

  @tag :pending
  test "area code" do
    assert Phone.area_code("1234567890") == "123"
  end

  @tag :pending
  test "area code with full US phone number" do
    assert Phone.area_code("11234567890") == "123"
  end

  @tag :pending
  test "pretty print" do
    assert Phone.pretty("1234567890") == "(123) 456-7890"
  end

  @tag :pending
  test "pretty print with full US phone number" do
    assert Phone.pretty("11234567890") == "(123) 456-7890"
  end
end

Version data entries

167 entries across 167 versions & 1 rubygems

Version Path
trackler-2.0.8.18 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.17 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.16 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.15 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.14 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.13 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.12 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.11 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.10 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.9 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.8 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.7 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.6 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.5 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.4 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.3 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.2 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.8.1 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.7.0 tracks/elixir/exercises/phone-number/phone_number_test.exs
trackler-2.0.6.44 tracks/elixir/exercises/phone-number/phone_number_test.exs