<commit_before>require 'minitest/autorun'
require 'fibonacci'

class FibonacciTest < MiniTest::Unit::TestCase
  def setup
    @fib = Fibonacci.new
  end

  def test_brackets_method
    assert_equal 0, @fib[0]
    assert_equal 1, @fib[1]
    assert_equal 34, @fib[9]
    assert_equal 55, @fib[10]
    assert_equal 354224848179261915075, @fib[100]

    assert_raises ArgumentError do
      @fib[-1]
    end

    assert_raises ArgumentError do
      @fib["12"]
    end

    assert_raises ArgumentError do
      @fib[1.0]
    end
  end

  def test_terms
    assert_equal [0, 1, 1, 2, 3, 5], @fib.terms(6)
    assert_equal [], @fib.terms(0)
    assert_equal [0], @fib.terms(1)

    assert_raises ArgumentError do
      @fib.terms(-1)
    end

    assert_raises TypeError do
      @fib.terms("12")
    end

    assert_raises RangeError do
      @fib.terms(100000000000000000000000000000)
    end
  end

  def test_fast_val
    assert_equal 0, @fib.fast_val(0)
    assert_equal 1, @fib.fast_val(1)
    assert_equal 34, @fib.fast_val(9)
    assert_equal 55, @fib.fast_val(10)
    assert_equal 354224848179261915075, @fib.fast_val(100)

    assert_raises ArgumentError do
      @fib.fast_val(-1)
    end

    assert_raises ArgumentError do
      @fib.fast_val("12")
    end

    assert_raises ArgumentError do
      @fib.fast_val(1.0)
    end
  end
end<commit_msg>Add test for matrix method<commit_after>require 'minitest/autorun'
require 'fibonacci'

class FibonacciTest < MiniTest::Unit::TestCase
  def setup
    @fib = Fibonacci.new
  end

  def test_brackets_method
    assert_equal 0, @fib[0]
    assert_equal 1, @fib[1]
    assert_equal 34, @fib[9]
    assert_equal 55, @fib[10]
    assert_equal 354224848179261915075, @fib[100]

    assert_raises ArgumentError do
      @fib[-1]
    end

    assert_raises ArgumentError do
      @fib["12"]
    end

    assert_raises ArgumentError do
      @fib[1.0]
    end
  end

  def test_terms
    assert_equal [0, 1, 1, 2, 3, 5], @fib.terms(6)
    assert_equal [], @fib.terms(0)
    assert_equal [0], @fib.terms(1)

    assert_raises ArgumentError do
      @fib.terms(-1)
    end

    assert_raises TypeError do
      @fib.terms("12")
    end

    assert_raises RangeError do
      @fib.terms(100000000000000000000000000000)
    end
  end

  def test_fast_val
    assert_equal 0, @fib.fast_val(0)
    assert_equal 1, @fib.fast_val(1)
    assert_equal 34, @fib.fast_val(9)
    assert_equal 55, @fib.fast_val(10)
    assert_equal 354224848179261915075, @fib.fast_val(100)

    assert_raises ArgumentError do
      @fib.fast_val(-1)
    end

    assert_raises ArgumentError do
      @fib.fast_val("12")
    end

    assert_raises ArgumentError do
      @fib.fast_val(1.0)
    end
  end

  def test_matrix
    assert_equal 0, (@fib.matrix(0))[0][1]
    assert_equal 1, (@fib.matrix(1))[0][1]
    assert_equal 34, (@fib.matrix(9))[0][1]
    assert_equal 55, (@fib.matrix(10))[0][1]
    assert_equal 354224848179261915075, (@fib.matrix(100))[0][1]

    matrix = @fib.matrix(100)
    assert_equal (@fib.matrix(101))[0][1], (matrix[0][1] + matrix[1][1])

    assert_raises ArgumentError do
      @fib.matrix(-1)
    end

    assert_raises ArgumentError do
      @fib.matrix("12")
    end

    assert_raises ArgumentError do
      @fib.matrix(1.0)
    end
  end
end
{'fraction_non_alphanumeric': 0.10932280595201943, 'fraction_numerical': 0.09353173398117218, 'mean_word_length': 2.9927272727272727, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4403463', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1213, 'n_words': 262}