Exemple #1
0
        public void PriReadLiterals()
        {
            var bytes = new byte [] {
                0x01, 0x00, 0xFE, 0x80,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x3F,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F,
                0xF1, 0x68, 0xE3, 0x88, 0xB5, 0xF8, 0xE4, 0x3E,
                0x27, 0x10, 0x10, 0x10, 0x10, 0x10, 0x80, 0x3F,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x49, 0x40,
            };
            var img = new MemoryArea(Address.SegPtr(0xC00, 0), bytes);

            Assert.AreEqual(-0x7F01FFFF, img.ReadLeInt32(0));
            Assert.AreEqual(0.5, img.ReadLeDouble(0x04).ToDouble(), 0.00001);
            Assert.AreEqual(1.0, img.ReadLeDouble(0x0C).ToDouble(), 0.00001);
            Assert.AreEqual(1e-5, img.ReadLeDouble(0x14).ToDouble(), 1e-10);
            Assert.AreEqual(0.007843137254902, img.ReadLeDouble(0x1C).ToDouble(), 1e-8);
            Assert.AreEqual(51.0, img.ReadLeDouble(0x24).ToDouble(), 0.00001);
        }