Exemplo n.º 1
0
        public void SaveLoadPolyNET()
        {
            var stream = new MemoryStream();

            var poly  = new BigPoly();
            var poly2 = new BigPoly(1, 32);

            poly2[0].Set(1);
            stream.Seek(0, SeekOrigin.Begin);
            poly.Save(stream);
            stream.Seek(0, SeekOrigin.Begin);
            poly2.Load(stream);
            Assert.AreEqual(poly, poly2);

            poly.Resize(3, 96);
            poly[0].Set(2);
            poly[1].Set(3);
            poly[2].Set(4);
            stream.Seek(0, SeekOrigin.Begin);
            poly.Save(stream);
            stream.Seek(0, SeekOrigin.Begin);
            poly2.Load(stream);
            Assert.AreEqual(poly, poly2);

            poly[0].Set("FFFFFFFFFFFFFFFFFF");
            stream.Seek(0, SeekOrigin.Begin);
            poly.Save(stream);
            stream.Seek(0, SeekOrigin.Begin);
            poly2.Load(stream);
            Assert.AreEqual(poly, poly2);

            poly.Resize(2, 32);
            poly[0].Set(1);
            stream.Seek(0, SeekOrigin.Begin);
            poly.Save(stream);
            stream.Seek(0, SeekOrigin.Begin);
            poly2.Load(stream);
            Assert.AreEqual(poly, poly2);
        }