Permalink
Browse files

Add test for tast_val method

  • Loading branch information...
1 parent becf356 commit b90f19aa39d5d673c099121eca9b3d76968f4286 @chaitanyav committed Dec 16, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/fibonacci_test.rb
View
@@ -43,4 +43,24 @@ def test_terms
@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

0 comments on commit b90f19a

Please sign in to comment.