Sha256: 7f81349fec8213777c38feb85185593872bb3bf051e13665609543866b17ee97

Contents?: true

Size: 484 Bytes

Versions: 6

Compression:

Stored size: 484 Bytes

Contents

require 'compsci/fibonacci'
require 'minitest/autorun'

include CompSci

describe Fibonacci do
  before do
    @answers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
  end

  it "must calculate fib(0..10)" do
    @answers.each_with_index { |ans, i|
      Fibonacci.classic(i).must_equal ans
      Fibonacci.cache_recursive(i).must_equal ans
      Fibonacci.cache_iterative(i).must_equal ans
      Fibonacci.dynamic(i).must_equal ans
      Fibonacci.matrix(i).must_equal ans
    }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
compsci-0.3.0.1 test/fibonacci.rb
compsci-0.2.0.1 test/fibonacci.rb
compsci-0.1.1.1 test/fibonacci.rb
compsci-0.1.0.1 test/fibonacci.rb
compsci-0.0.3.1 test/fibonacci.rb
compsci-0.0.2.1 test/fibonacci.rb