// Copyright 2017-2019 Alexander Luzgarev
using NUnit.Framework;
namespace MatFileHandler.Tests
{
    /// 
    /// Tests of the ComplexOf value type.
    /// 
    [TestFixture]
    public class ComplexOfTests
    {
        /// 
        /// Test getting real and imaginary parts.
        /// 
        [Test]
        public void TestAccessors()
        {
            var c = new ComplexOf(1, 2);
            Assert.That(c.Real, Is.EqualTo(1));
            Assert.That(c.Imaginary, Is.EqualTo(2));
        }
        /// 
        /// Test equality operators.
        /// 
        [Test]
        public void TestEquals()
        {
            var c1 = new ComplexOf(1, 2);
            var c2 = new ComplexOf(3, 4);
            var c3 = new ComplexOf(1, 2);
            Assert.That(c1 == c3, Is.True);
            Assert.That(c1 != c2, Is.True);
            Assert.That(c2 != c3, Is.True);
        }
        /// 
        /// Test hash code calculation.
        /// 
        [Test]
        public void TestGetHashCode()
        {
            var c1 = new ComplexOf(1, 2);
            var c2 = new ComplexOf(1, 2);
            var h1 = c1.GetHashCode();
            var h2 = c2.GetHashCode();
            Assert.That(h1, Is.EqualTo(h2));
        }
    }
}