Esempio n. 1
0
        public void TestReadDoubles()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.Equal(2, vals.Length);
                Assert.Equal("4.69197536052338E+271", vals[0].ToString(CultureInfo.InvariantCulture));
                Assert.Equal(-1.50730608775746E-189, vals[1], 15);
                Assert.Equal(null, cfile.ReadDoubles(4));
                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 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.Equal(1, vals.Length);
                Assert.Equal("4.69197536052338E+271", vals[0].ToString(CultureInfo.InvariantCulture));
                Assert.Equal(null, cfile.ReadDoubles(4));
                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());
                var vals = cfile.ReadDoubles(4);
                Assert.Equal(2, vals.Length);
                Assert.Equal("4.69197536052338E+271", vals[0].ToString(CultureInfo.InvariantCulture));
                Assert.Equal(-1.50730608775746E-189, vals[1], 15);
                Assert.Equal(null, cfile.ReadDoubles(4));
                Assert.Equal(true, cfile.EOF);
            }
        }
Esempio n. 2
0
        public void TestReadDoubles()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(2, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, vals[1], 1e-150);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                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 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(1, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                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());
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(2, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, vals[1], 1e-150);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                Assert.AreEqual(true, cfile.EOF);
            }
        }
Esempio n. 3
0
        public void TestReadDoubles()
        {
            using (var cfile = new CFile(BuildStream(new byte[] { 0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0xFE, 0xDC, 0xBA, 0x98, 0xFE, 0xDC, 0xBA, 0x98 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(2, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, vals[1], 1e-150);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                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 }))) {
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(1, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                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());
                var vals = cfile.ReadDoubles(4);
                Assert.AreEqual(2, vals.Length);
                Assert.AreEqual(4.69197536052338E+271, vals[0], 1e+257);
                Assert.AreEqual(-1.50730608775746E-189, vals[1], 1e-150);
                Assert.AreEqual(null, cfile.ReadDoubles(4));
                Assert.AreEqual(true, cfile.EOF);
            }
        }