Exemple #1
0
 static void TestInvalid(int id, int nbr)
 {
     //test -127
     try
     {
         var result = Arithmetic.Sqr(nbr);
         Console.WriteLine($"Test #{id} fail-1");
     }
     catch (Exception)
     {
         Console.WriteLine($"Test #{id} pass");
     }
 }
Exemple #2
0
 static void TestValid(int id, int nbr, int expected)
 {
     try
     {
         var actual = Arithmetic.Sqr(nbr);
         if (actual == expected)
         {
             Console.WriteLine($"Test #{id} pass");
         }
         else
         {
             Console.WriteLine($"Test #{id} fail-2");
             //Console.WriteLine($"Test #{id} fail-2. Expected {nbr*nbr} - Actual {result}");
         }
     }
     catch (Exception)
     {
         Console.WriteLine($"Test #{id} fail-1");
     }
 }