public void DLAreBasesEqualBadInputTest()
        {
            GroupElement[]            bases1 = StaticHelperClass.GenerateRandomBases(10, 0);
            ClosedDLRepOfGroupElement udl    = new ClosedDLRepOfGroupElement(bases1, bases1[0], _parameters[0].Group);

            GroupElement[] bases2 = new GroupElement[9];
            for (int i = 0; i < bases2.Length; ++i)
            {
                bases2[i] = bases1[i];
            }
            ClosedDLRepOfGroupElement udlbad = new ClosedDLRepOfGroupElement(bases2, bases1[0], _parameters[0].Group);

            Assert.IsFalse(udl.AreBasesEqual(udlbad), "different bases due to different rep length");
            Assert.IsFalse(udlbad.AreBasesEqual(udl), "different bases due to different rep length");


            udlbad = null;
            Assert.IsFalse(udl.AreBasesEqual(udlbad), "different bases since udlbad is null");


            // testing on array input
            ClosedDLRepOfGroupElement[] udlArray = null;
            Assert.IsFalse(ClosedDLRepOfGroupElement.AreBasesEqual(udlArray), "fails on null input.");

            udlArray = new ClosedDLRepOfGroupElement[0];
            Assert.IsFalse(ClosedDLRepOfGroupElement.AreBasesEqual(udlArray), "fails on empty array input.");

            udlArray = new ClosedDLRepOfGroupElement[1] {
                udl
            };
            Assert.IsTrue(ClosedDLRepOfGroupElement.AreBasesEqual(udlArray), "array of one element should pass");
        }
        public void AreBasesEqualTest()
        {
            for (int i = 0; i < _parameters.Length; ++i)
            {
                GroupElement[] bases0 = GetGenerators(_parameters[i], 6);
                GroupElement[] bases1 = GetGenerators(_parameters[i], 6);
                bases1[5] = bases1[5] * bases1[3];


                ClosedDLRepOfGroupElement dl = new ClosedDLRepOfGroupElement(bases0, _parameters[i].G, _parameters[i].Group);
                ClosedDLRepOfGroupElement dlWithSameBases = new ClosedDLRepOfGroupElement(bases0, _parameters[i].H, _parameters[i].Group);
                ClosedDLRepOfGroupElement dlWithDiffBases = new ClosedDLRepOfGroupElement(bases1, _parameters[i].G, _parameters[i].Group);

                Assert.IsTrue(dl.AreBasesEqual(dlWithSameBases), "bases are the same.");
                Assert.IsTrue(dlWithSameBases.AreBasesEqual(dl), "bases are same");
                Assert.IsFalse(dl.AreBasesEqual(dlWithDiffBases), "bases are different.");

                ClosedDLRepOfGroupElement[] sameBaseArray = new ClosedDLRepOfGroupElement[4] {
                    dlWithSameBases, dl, dlWithSameBases, dl
                };
                ClosedDLRepOfGroupElement[] diffBaseArray = new ClosedDLRepOfGroupElement[4] {
                    dl, dl, dl, dlWithDiffBases
                };
                Assert.IsTrue(ClosedDLRepOfGroupElement.AreBasesEqual(sameBaseArray), "Bases are identical");
                Assert.IsFalse(ClosedDLRepOfGroupElement.AreBasesEqual(diffBaseArray), "Bases are different");
            }
        }
        public void ExponentiateTest()
        {
            for (int paramIndex = 0; paramIndex < _parameters.Length; ++paramIndex)
            {
                GroupElement[]            bases    = StaticHelperClass.GenerateRandomBases(8, paramIndex);
                FieldZqElement[]          exponent = StaticHelperClass.GenerateRandomExponents(1, paramIndex);
                GroupElement              value    = _parameters[paramIndex].Generators[0];
                ClosedDLRepOfGroupElement udl      = new ClosedDLRepOfGroupElement(bases, value, _parameters[paramIndex].Group);

                ClosedDLRepOfGroupElement actualUDL = udl.Exponentiate(exponent[0]);
                Assert.IsTrue(actualUDL.AreBasesEqual(udl), "bases should be the same.");
                Assert.AreEqual(udl.Value.Exponentiate(exponent[0]), actualUDL.Value, "Value computed incorrectly.");
            }
        }