Example #1
0
        public void Parse_Succeeds(string input, int real, int imaginary)
        {
            var number = LongComplex.Parse(input);

            Assert.AreEqual(real, (int)number.Real);
            Assert.AreEqual(imaginary, (int)number.Imaginary);
        }
Example #2
0
        public void Subtract_Succeeds()
        {
            var left   = new LongComplex(3, 5);
            var right  = new LongComplex(7, 11);
            var result = LongComplex.Subtract(left, right);

            Assert.AreEqual(-4, result.Real);
            Assert.AreEqual(-6, result.Imaginary);
        }
Example #3
0
        public void Add_Succeeds()
        {
            var left   = new LongComplex(3, 5);
            var right  = new LongComplex(7, 11);
            var result = LongComplex.Add(left, right);

            Assert.AreEqual(10, result.Real);
            Assert.AreEqual(16, result.Imaginary);
        }
Example #4
0
        public void Multiply_Succeeds()
        {
            var left   = new LongComplex(3, 5);
            var right  = new LongComplex(7, 11);
            var result = LongComplex.Multiply(left, right);

            Assert.AreEqual(21 - 55, result.Real);
            Assert.AreEqual(33 + 35, result.Imaginary);
        }