1
exercism fetch ruby prime-factors

prime_factors_test.rb

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
require 'minitest/autorun'
require_relative 'prime_factors'

class PrimeFactorsTest < Minitest::Test
  def test_1
    assert_equal [], PrimeFactors.for(1)
  end

  def test_2
    skip
    assert_equal [2], PrimeFactors.for(2)
  end

  def test_3
    skip
    assert_equal [3], PrimeFactors.for(3)
  end

  def test_4
    skip
    assert_equal [2, 2], PrimeFactors.for(4)
  end

  def test_6
    skip
    assert_equal [2, 3], PrimeFactors.for(6)
  end

  def test_8
    skip
    assert_equal [2, 2, 2], PrimeFactors.for(8)
  end

  def test_9
    skip
    assert_equal [3, 3], PrimeFactors.for(9)
  end

  def test_27
    skip
    assert_equal [3, 3, 3], PrimeFactors.for(27)
  end

  def test_625
    skip
    assert_equal [5, 5, 5, 5], PrimeFactors.for(625)
  end

  def test_901255
    skip
    assert_equal [5, 17, 23, 461], PrimeFactors.for(901_255)
  end

  def test_93819012551
    skip
    assert_equal [11, 9539, 894_119], PrimeFactors.for(93_819_012_551)
  end
end