public void TestFibonacciCalcZero() { var i = 0; var f = FibonacciCalc.GetNthFibonacciString(i); Assert.AreEqual(f, "0"); }
public void TestFibonacciCalcLarger() { var i = 44; var f = FibonacciCalc.GetNthFibonacciString(i); Assert.AreEqual(f, "701408733 "); }
public void TestFibonacciCalcBaseCase() { var i = 1; var f = FibonacciCalc.GetNthFibonacciString(i); Assert.AreEqual(f, "1"); }
public void Iterative(ulong input, ulong expected) { var sut = new FibonacciCalc(); var actual = sut.Iterative(input); Assert.Equal(expected, actual); }
public void RecursiveWithMemoization(ulong input, ulong expected) { var sut = new FibonacciCalc(); var actual = sut.RecursiveWithMemoization(input); Assert.Equal(expected, actual); }
public void TestRandom() { ulong input = (ulong)(new Random().Next(4, 30)); ulong expected = new FibonacciCalc().Recursive(input); ulong actualRecursive = new FibonacciCalc().RecursiveWithMemoization(input); ulong actualIterative = new FibonacciCalc().Iterative(input); Assert.AreEqual(expected, actualRecursive); Assert.AreEqual(expected, actualIterative); }
public void FibonacciTailRecursiveMemoized(ulong n, ulong expected) { // Arrange var fib = new FibonacciCalc(); // Act var result = fib.TailRecursiveMemoized(n); // Assert Assert.Equal(expected, result); }
public void FibonacciImperative(ulong n, ulong expected) { // Arrange var fib = new FibonacciCalc(); // Act var result = fib.Iterative(n); // Assert Assert.Equal(expected, result); }
public void Get_WhenGivenLength_WilReturnCorrectSequence() { var length = 5; var result = FibonacciCalc.Get(length); Assert.AreEqual(result.Length, length); Assert.AreEqual(0, result[0]); Assert.AreEqual(1, result[1]); Assert.AreEqual(2, result[2]); Assert.AreEqual(3, result[3]); Assert.AreEqual(5, result[4]); }
public void Init() { calc = new FibonacciCalc(); }
public void ParameterizedTestWithTheory(int input, int expected) { var result = FibonacciCalc.Fibonacci(input); result.Should().Be(expected); }
public long ParameterizedTestWithTestCase(int input) { return(FibonacciCalc.Fibonacci(input)); }
public virtual string GetNthFibonacci(int n) { return(FibonacciCalc.GetNthFibonacciString(n)); }
public void TestFibonacciCalcNegative() { var i = -1; var f = FibonacciCalc.GetNthFibonacciString(i); }