public void TestPowInt() { // arange var pow = 262144; // act var result = (int)calc.Pow(new[] { 2, 3, 6 }); // assert Assert.AreEqual(pow, result); }
static void Main(string[] args) { double[] mass = Array(args); var calc = new Core.Calc(); switch (args[0]) { case "sum": Console.WriteLine(calc.Sum(mass)); break; case "sub": Console.WriteLine(calc.Sub(mass)); break; case "pow": Console.WriteLine(calc.Pow(mass)); break; case "multi": Console.WriteLine(calc.Multi(mass)); break; default: Console.WriteLine("Что-то пошло не так"); break; } Console.Read(); }
public void TestPow() { var calc = new Core.Calc(); var pow = 15625; var result = calc.Pow(new[] { 5, 3, 2 }); Assert.AreEqual(pow, result); }
public void TestPow() { var calc = new Core.Calc(); var pow = 4 * 4 * 4; var result = calc.Pow(new[] { 2, 2, 3 }); Assert.AreEqual(pow, result); }
public void TestPow() { //Arrange var calc = new Core.Calc(); var Sub = 64.0; //act var result = calc.Pow(new[] { 2.0, 3.0, 2.0 }); //Assent Assert.AreEqual(Sub, result); }
public void TestPow() { // arrange var calc = new Core.Calc(); var pow = 15625; // act var result = calc.Pow(new[] { 5, 3, 2 }); // assert Assert.AreEqual(pow, result); }
static void Main(string[] args) { try { Core.Calc calc = new Core.Calc(); Console.WriteLine("Введите одну из операций: sum, sub, pow.\nПриемер: sum 5 3 2"); string[] input = Console.ReadLine().Split(' '); cmds cm; if (!Enum.TryParse(input[0], out cm)) { throw new Exception("Некорректный ввод"); } int[] arr = input.Skip(1).Select(x => { int r; if (int.TryParse(x.ToString(), out r)) { return(r); } else { throw new Exception("Некорректный ввод"); } }).ToArray(); long res = 0; switch (cm) { case cmds.sum: res = calc.Sum(arr); break; case cmds.sub: res = calc.Sub(arr); break; case cmds.pow: res = calc.Pow(arr); break; } Console.WriteLine(res); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.ReadKey(); } }