Esempio n. 1
0
        public void TestReadOnEmptyStream()
        {
            IList <byte> data;
            uint         address;

            var intelHexReader = new IntelHexReader(new MemoryStream());

            var result = intelHexReader.Read(out address, out data);

            result.Should().Be(false);
        }
Esempio n. 2
0
        public void TestReadExtendedSegmentAddressRecords()
        {
            int readCount = 0;

            using (var intelHexReader = new IntelHexReader(IntelHexData.ExtendedSegmentAddressRecords))
            {
                uint         address;
                IList <byte> data;

                while (intelHexReader.Read(out address, out data))
                {
                    address.Should().Be((uint)(0x10000 * readCount));

                    readCount++;
                }
            }

            Assert.AreEqual(4, readCount);
        }
Esempio n. 3
0
        public void TestReadDataRecords()
        {
            int          readCount = 0;
            IList <byte> data;
            uint         address;

            using (var intelHexReader = new IntelHexReader(IntelHexData.DataRecords))
            {
                while (intelHexReader.Read(out address, out data))
                {
                    data.Should().NotBeNull();
                    data.Count.Should().Be(16);

                    address.Should().Be((uint)(0x100 + (0x10 * readCount)));

                    readCount++;
                }
            }

            readCount.Should().Be(4);
        }