1
exercism fetch elixir prime-factors

prime_factors_test.exs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("prime_factors.exs", __DIR__)
end

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

defmodule PrimeFactorsTest do
  use ExUnit.Case

  # @tag :pending
  test "1" do
    assert PrimeFactors.factors_for(1) == []
  end

  @tag :pending
  test "2" do
    assert PrimeFactors.factors_for(2) == [2]
  end

  @tag :pending
  test "3" do
    assert PrimeFactors.factors_for(3) == [3]
  end

  @tag :pending
  test "4" do
    assert PrimeFactors.factors_for(4) == [2, 2]
  end

  @tag :pending
  test "6" do
    assert PrimeFactors.factors_for(6) == [2, 3]
  end

  @tag :pending
  test "8" do
    assert PrimeFactors.factors_for(8) == [2, 2, 2]
  end

  @tag :pending
  test "9" do
    assert PrimeFactors.factors_for(9) == [3, 3]
  end

  @tag :pending
  test "27" do
    assert PrimeFactors.factors_for(27) == [3, 3, 3]
  end

  @tag :pending
  test "625" do
    assert PrimeFactors.factors_for(625) == [5, 5, 5, 5]
  end

  @tag :pending
  test "901255" do
    assert PrimeFactors.factors_for(901255) == [5, 17, 23, 461]
  end

  @tag :pending
  test "93819012551" do
    assert PrimeFactors.factors_for(93819012551) == [11, 9539, 894119]
  end

  @tag :pending
  # @tag timeout: 2000
  #
  # The timeout tag above will set the below test to fail unless it completes
  # in under two sconds. Uncomment it if you want to test the efficiency of your
  # solution.
  test "10000000055" do
    assert PrimeFactors.factors_for(10000000055) == [5, 2000000011]
  end
end