Beispiel #1
0
        private void first50NumbersToolStripMenuItem_Click(object sender, EventArgs e) // First 50 fib's function
        {
            int fibNum = 50;                                                           // Number of fibonacci's to generate
            FibonacciTextReader fibFifty = new FibonacciTextReader(fibNum);            // Create new instance of Fibonacci Text Reader

            LoadText(fibFifty);                                                        // Send object to LoadFile function
        }
Beispiel #2
0
        private void first100NumbersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int fibNum = 100;                                                 // Number of fibonacci's to generate
            FibonacciTextReader fibHundred = new FibonacciTextReader(fibNum); // Create new instance of Fibonacci Text Reader

            LoadText(fibHundred);                                             // Send object to LoadFile function
        }
Beispiel #3
0
        public void TestReadToEndWithZero()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(0);
            string output = fibTest.ReadToEnd();

            Assert.That(output, Is.EqualTo(string.Empty));
        }
Beispiel #4
0
        public void TestReadLineWithZero()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(0);
            string output = fibTest.ReadLine();

            Assert.That(output, Is.EqualTo(null));
        }
Beispiel #5
0
        public void TestReadLineWithNegativeNumbers()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(-1);
            string output = fibTest.ReadLine();

            Assert.That(output, Is.EqualTo(null));
        }
Beispiel #6
0
        public void TestReadToEndWithNegativeNumbers()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(-2);
            string output = fibTest.ReadToEnd();

            Assert.That(output, Is.EqualTo(string.Empty));
        }
            public void ThirdFibonacciCalculatorTest()
            {
                // TODO: Add your test code here
                FibonacciTextReader f   = new FibonacciTextReader(1);
                BigInteger          res = f.FibonacciCalculator(10);
                BigInteger          ans = 34;

                Assert.That(res, Is.EqualTo(ans));
            }
Beispiel #8
0
        public void TestReadLineWithSpecialCases()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(1);
            int fibNumber = fibTest.NumberOfSequence;

            // Checks the first case of 0
            if (fibNumber == 0)
            {
                Assert.That(fibNumber, Is.EqualTo(0));
            }

            // Checks the second case of 1
            if (fibNumber == 1)
            {
                Assert.That(fibNumber, Is.EqualTo(1));
            }
        }
Beispiel #9
0
        public void TestReadToEndWithSpecialCases()
        {
            FibonacciTextReader fibTest = new FibonacciTextReader(2);
            string output    = fibTest.ReadToEnd();
            int    fibNumber = fibTest.NumberOfSequence;

            // Checks the first case of 0
            if (fibNumber == 0)
            {
                Assert.That(output, Is.EqualTo("1: 0\r\n"));
            }

            // Checks the second case of 1
            if (fibNumber == 1)
            {
                Assert.That(output, Is.EqualTo("1: 0\r\n" + "2: 1\r\n"));
            }
        }
Beispiel #10
0
        //load the first 100 numbers of the Fibonacci sequence
        private void loadFibonacciNumbersfirst100ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FibonacciTextReader sr = new FibonacciTextReader(100);

            textBox1.Text = sr.ReadToEnd();
        }
Beispiel #11
0
        private void displayFibHundred(object sender, EventArgs e)
        {   //new FibTextReader, max line count == 100, done by constructor
            FibonacciTextReader fib100 = new FibonacciTextReader(100);

            loadText(fib100);    //reads FibTextReader to end
        }
Beispiel #12
0
        private void displayFibFifty(object sender, EventArgs e)
        {   //new FibTextReader, max line count == 50, done by constructor
            FibonacciTextReader fib50 = new FibonacciTextReader(50);

            loadText(fib50);    //reads FibTextReader to end
        }