public void TestFibonacciBigIntegerEqualsFibonacciInt() { for (int n = 0; n < 10; n++) { // arrange int fibonacci0 = BigIntegerMathLib.Fibonacci0(n); BigInteger fibonacci1 = BigIntegerMathLib.Fibonacci1(n); // assert Assert.AreEqual((BigInteger)fibonacci0, fibonacci1); } }
public void DebugFibonacci() { for (int n = 0; n < 10; n++) { BigInteger result0 = BigIntegerMathLib.Fibonacci0(n); BigInteger result1 = BigIntegerMathLib.Fibonacci1(n); BigInteger result2 = BigIntegerMathLib.Fibonacci2(n); string message = string.Format("{0}, {1}, {2}, {3}", n, result0, result1, result2); Debug.WriteLine(message); } }
public void TestFibonacciOfOneIsOne() { // act BigInteger result1 = BigIntegerMathLib.Fibonacci1(1); BigInteger result2 = BigIntegerMathLib.Fibonacci2(1); // assert BigInteger one = 1; Assert.AreEqual(one, result1); Assert.AreEqual(one, result2); }
public void TestFibonacciOfZeroIsZero() { // act BigInteger result1 = BigIntegerMathLib.Fibonacci1(0); BigInteger result2 = BigIntegerMathLib.Fibonacci2(0); // assert BigInteger zero = 0; Assert.AreEqual(zero, result1); Assert.AreEqual(zero, result2); }
public void TestBothVersionsOfFibonacciAreEqual() { for (BigInteger n = 0; n < 10; n++) { // arrange BigInteger fibonacci1 = BigIntegerMathLib.Fibonacci1(n); BigInteger fibonacci2 = BigIntegerMathLib.Fibonacci2(n); // assert Assert.AreEqual(fibonacci1, fibonacci2); } }
public void TestFibonacci11OfNegativeNumberThrowsArgumentException() { // assert Assert.That(() => BigIntegerMathLib.Fibonacci1(-1), Throws.TypeOf <ArgumentException>()); }