Beispiel #1
0
        public void TestExtremeEquality(double x, double y, bool equal)
        {
            RealFieldElement elementX = x;
            RealFieldElement elementY = y;

            Assert.AreEqual(equal, Field.ElementsEqual(elementX, elementY));
        }
Beispiel #2
0
        public void TestMultiplyIdentities(int a, int b, double c)
        {
            RealFieldElement elementA = a == 0 ? Field.Zero() : Field.One();
            RealFieldElement elementB = b == 0 ? Field.Zero() : Field.One();

            Assert.IsTrue(Field.ElementsEqual(Field.Multiply(elementA, elementB), c));
        }
Beispiel #3
0
        public void TestDivision(double a, double b, double c)
        {
            RealFieldElement elementA = a;
            RealFieldElement elementB = b;
            RealFieldElement elementC = c;

            Assert.IsTrue(Field.ElementsEqual(Field.Multiply(elementA, Field.Inverse(elementB)), elementC));
        }
Beispiel #4
0
        public void TestMultiplication(double a, double b, double c)
        {
            RealFieldElement elementA = a;
            RealFieldElement elementB = b;
            RealFieldElement elementC = c;

            Assert.IsTrue(Field.ElementsEqual(Field.Multiply(elementA, elementB), elementC));
        }
Beispiel #5
0
        public void TestSubtraction(double a, double b, double c)
        {
            RealFieldElement elementA = a;
            RealFieldElement elementB = b;
            RealFieldElement elementC = c;

            Assert.IsTrue(Field.ElementsEqual(Field.Add(elementA, Field.Negative(elementB)), elementC));
        }
Beispiel #6
0
        public void TestAddition(double a, double b, double c)
        {
            RealFieldElement elementA = a;
            RealFieldElement elementB = b;
            RealFieldElement elementC = c;

            Assert.IsTrue(Field.ElementsEqual(Field.Add(elementA, elementB), elementC));
        }
Beispiel #7
0
        public void TestDivideByZero(double x, bool throws)
        {
            RealFieldElement element = x;
            RealFieldElement inverse;

            if (throws)
            {
                Assert.Throws <DivideByZeroException>(delegate
                {
                    inverse = Field.Inverse(element);
                });
            }
            else
            {
                Assert.DoesNotThrow(delegate
                {
                    inverse = Field.Inverse(element);
                });
            }
        }