コード例 #1
0
        public async Task TestHexFileParseShortLine()
        {
            byte[]         lineExpected = new byte[] { 0x05, 0x90, 0xF4, 0x91, 0xE0, 0x2D, 0x09, 0x94, 0xF8, 0x94, 0xFF, 0xCF };
            string         lineToParse  = ":0C1280000590F491E02D0994F894FFCF44\n";
            Stream         lineStream   = streamFromString(lineToParse);
            ArduinoHexFile hexFile      = new ArduinoHexFile((uint)lineExpected.Length);


            await hexFile.Parse(lineStream);

            Assert.AreEqual(hexFile.Contents.Length, lineExpected.Length);
            CollectionAssert.AreEqual(hexFile.Contents, lineExpected);
        }
コード例 #2
0
        public async Task TestHexFileParseEndOfFile()
        {
            byte[]         lineExpected = new byte[] { };
            string         lineToParse  = ":00000001FF\n";
            Stream         lineStream   = streamFromString(lineToParse);
            ArduinoHexFile hexFile      = new ArduinoHexFile((uint)lineExpected.Length);


            await hexFile.Parse(lineStream);

            Assert.AreEqual(hexFile.Contents.Length, lineExpected.Length);
            CollectionAssert.AreEqual(hexFile.Contents, lineExpected);
        }
コード例 #3
0
        public async Task TestHexFileParseLine()
        {
            byte[]         lineExpected = new byte[] { 0x0C, 0x94, 0x67, 0x01, 0x0C, 0x94, 0x8F, 0x01, 0x0C, 0x94, 0x8F, 0x01, 0x0C, 0x94, 0x8F, 0x01 };
            string         lineToParse  = ":100000000C9467010C948F010C948F010C948F0158\n";
            Stream         lineStream   = streamFromString(lineToParse);
            ArduinoHexFile hexFile      = new ArduinoHexFile((uint)lineExpected.Length);


            await hexFile.Parse(lineStream);

            Assert.AreEqual(hexFile.Contents.Length, lineExpected.Length);
            CollectionAssert.AreEqual(hexFile.Contents, lineExpected);
        }