Exemple #1
0
        static bool TestForPositiveInput(MikesLib.Calculator c, int amount, bool ExpectedFail, string id)
        {
            Random rnd   = new Random();
            string input = "";
            double total = 0;

            for (int i = 0; i < amount; i++)
            {
                int random = rnd.Next(0, 1000000);
                total += random;
                input += random.ToString();
                if (i != amount - 1)
                {
                    input += ",";
                }
            }
            //Console.WriteLine(input);
            double results = c.Add(input, out bool IsError);

            return(PrintTestResult(id, $"Testing for correction addition for {amount} numbers", results.ToString(), total.ToString(), ExpectedFail.ToString(), IsError.ToString()));
        }
Exemple #2
0
        static bool TestMismatchedNegativeSymbols(MikesLib.Calculator c, string input = "")
        {
            if (input == "")
            {
                input = "1-,23-,53-,14-,541-,44-,555-";
            }

            double results = c.Add(input, out bool IsError);

            return(PrintTestResult("3", "Mismatching negative symbols", "0", results.ToString(), "True", IsError.ToString()));
        }