Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "test/unit"
- require 'fibonacci'
- class FibonacciTest < Test::Unit::TestCase
- def test_fibonacci_impossibility
- assert_raise(ArgumentError) { Fibonacci.get_sequence(-1) }
- end
- def test_fibonacci_sequence
- assert_fibonacci_sequence([], 0)
- assert_fibonacci_sequence([1], 1)
- assert_fibonacci_sequence([1, 1], 2)
- assert_fibonacci_sequence([1, 1, 2], 3)
- assert_fibonacci_sequence([1, 1, 2, 3], 4)
- assert_fibonacci_sequence([1, 1, 2, 3, 5], 5)
- assert_fibonacci_sequence([1, 1, 2, 3, 5, 8], 6)
- end
- def assert_fibonacci_sequence(act, num)
- assert_equal(act, Fibonacci.get_sequence(num))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement