public void PolyGF2DivRem() { var ps = PolyGF2.GetAll().Take(1000).ToArray(); var g = new Generator("PolyGF2DivRem"); for (int i = 0; i < 100; i++) { var p = ps[g.Int32(1000)]; var q = ps[g.Int32(1000)]; PolyGF2 r; var d = PolyGF2.DivRem(p, q, out r); Assert.AreEqual(p, d * q + r); } }
public void PolyGF2DivNoRem() { var ps = PolyGF2.GetAll().Take(1000).ToArray(); var g = new Generator("PolyGF2DivNoRem"); for (int i = 0; i < 100; i++) { var p = ps[g.Int32(1000)]; var q = ps[g.Int32(1000)]; var z = p * q; PolyGF2 r; var d = PolyGF2.DivRem(z, p, out r); Assert.IsTrue(r.IsZero); Assert.AreEqual(q, d); d = PolyGF2.DivRem(z, q, out r); Assert.IsTrue(r.IsZero); Assert.AreEqual(p, d); } }