Exemplo n.º 1
0
        public void FibonacciSequence_ResetTests(int count, int k, long[] expected)
        {
            var sequence = new FibonacciSequence(count);

            while (sequence.MoveNext())
            {
            }

            sequence.Reset();

            for (int i = 0; i < k; i++)
            {
                sequence.MoveNext();
            }

            Assert.AreEqual(new BigInteger(expected[k - 1]), sequence.Current);
        }
Exemplo n.º 2
0
        public void FibonacciSequence_MoveNextAndCurrentTests(int count, long[] expected)
        {
            var sequence = new FibonacciSequence(count);
            int i        = 0;

            while (sequence.MoveNext())
            {
                Assert.AreEqual(new BigInteger(expected[i++]), sequence.Current);
            }
        }
Exemplo n.º 3
0
        public void FibonacciSequence_LongSequenceTests(int count)
        {
            var sequence = new FibonacciSequence(count);
            int k        = 0;

            while (sequence.MoveNext())
            {
                k++;
            }

            Assert.IsTrue(k == count);
        }