Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine("Conversion of decimal to binary system.");
            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine(MathConverter.DecToBin(8));


            Console.WriteLine("\n-------------------------------------------------");
            Console.WriteLine("Conversion of binary to decimal system.");
            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine(MathConverter.BinToDec("0101"));


            Console.WriteLine("\n-------------------------------------------------");
            Console.WriteLine("Conversion of decimal number to roman.");
            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine(MathConverter.DecToRoman(3269));


            Console.WriteLine("\n-------------------------------------------------");
            Console.WriteLine("Conversion of roman number to decimal.");
            Console.WriteLine("-------------------------------------------------");
            Console.WriteLine(MathConverter.RomanToDec("XLMCD"));


            Console.WriteLine("\n-------------------------------------------------");
            Console.WriteLine("Solving of a quadratic equation.");
            Console.WriteLine("-------------------------------------------------");
            ExtraMath.SolveQuadraticEquation(1, -3, -4);

            Console.WriteLine("\n-------------------------------------------------");
            Console.WriteLine("Generation of random double.");
            Console.WriteLine("-------------------------------------------------");
            ExtraMath.GenerateRndNum(new Random(), 0.56256, 10.581254);
        }
Ejemplo n.º 2
0
 public void SolveQuadraticEquationAssertTrue()
 {
     Assert.True(ExtraMath.SolveQuadraticEquation(1, 2, 1, out var x1, out var x2));
 }
Ejemplo n.º 3
0
 public void SolveQuadraticEquationAssertThrows()
 {
     Assert.Throws <ArgumentException>(() => ExtraMath.SolveQuadraticEquation(0, 2, 1, out var x1, out var x2));
 }
Ejemplo n.º 4
0
 public void SolveQuadraticEquationAssertEquals()
 {
     ExtraMath.SolveQuadraticEquation(1, 2, 1, out var x1, out var x2);
     Assert.Equal(-1, x1);
     Assert.Equal(-1, x2);
 }
Ejemplo n.º 5
0
 public void SolveQuadraticEquationAssertNull()
 {
     ExtraMath.SolveQuadraticEquation(1, 2, 2, out var x1, out var x2);
     Assert.Null(x1);
     Assert.Null(x2);
 }
Ejemplo n.º 6
0
 public void SolveQuadraticEquationAssertFalse()
 {
     Assert.False(ExtraMath.SolveQuadraticEquation(-1, 2, -2, out var x1, out var x2));
 }