Ejemplo n.º 1
0
        public void TestReadDouble()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.Equal("4.69197536052338E+271", cfile.ReadDouble().ToString(CultureInfo.InvariantCulture));
                Assert.Equal(-1.50730608775746E-189, cfile.ReadDouble(), 15);
                Assert.Equal(0, cfile.ReadDouble());
                Assert.Equal(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA }))) {
                Assert.Equal("4.69197536052338E+271", cfile.ReadDouble().ToString(CultureInfo.InvariantCulture));
                Assert.Equal(0, cfile.ReadDouble());
                Assert.Equal(0, cfile.ReadDouble());
                Assert.Equal(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] { 97, 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.Equal('a', cfile.ReadChar());
                Assert.Equal("4.69197536052338E+271", cfile.ReadDouble().ToString(CultureInfo.InvariantCulture));
                Assert.Equal(-1.50730608775746E-189, cfile.ReadDouble(), 15);
                Assert.Equal(0, cfile.ReadInt32());
                Assert.Equal(true, cfile.EOF);
            }
        }
Ejemplo n.º 2
0
        public void TestReadDouble()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, cfile.ReadDouble(), 1e-150);
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA }))) {
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] { 97, 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.AreEqual('a', cfile.ReadChar());
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, cfile.ReadDouble(), 1e-150);
                Assert.AreEqual(0, cfile.ReadInt32());
                Assert.AreEqual(true, cfile.EOF);
            }
        }
Ejemplo n.º 3
0
        public void TestReadDouble()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, cfile.ReadDouble(), 1e-150);
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA}))) {
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(0, cfile.ReadDouble());
                Assert.AreEqual(true, cfile.EOF);
            }

            using (var cfile = new CFile(BuildStream(new byte[] {97,  0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                Assert.AreEqual('a', cfile.ReadChar());
                Assert.AreEqual(4.69197536052338E+271, cfile.ReadDouble(), 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, cfile.ReadDouble(), 1e-150);
                Assert.AreEqual(0, cfile.ReadInt32());
                Assert.AreEqual(true, cfile.EOF);
            }
        }