4 * This software is distributed under a zlib-style license.
\r
5 * See license.txt for more information.
\r
9 using System.Collections.Generic;
\r
12 using NUnit.Framework;
\r
14 namespace YubeshiTest
\r
16 public class ParserTest
\r
18 private static OctetString noise;
\r
22 noise = new OctetString(100);
\r
23 for (int i = 0; i < noise.Length; ++i)
\r
25 noise[i] = (byte)(i & 0x7F | 0x80);
\r
27 noise[52, -1] = Nmea.SamplePackets.Dummy;
\r
28 noise[79, -1] = Ubx.SamplePackets.Dummy;
\r
34 Parser parser = new Parser();
\r
44 public void NoisePacketsNoise()
\r
46 Parser parser = new Parser();
\r
49 OctetString data = noise;
\r
50 data += Nmea.SamplePackets.GpDtm;
\r
51 data += Ubx.SamplePackets.NavClock;
\r
57 while (null != (p = parser.Peek()))
\r
59 if (p is Yubeshi.Nmea.GpDtm)
\r
63 Assert.IsTrue(p is UnknownPacket);
\r
64 length += p.Raw.Length;
\r
66 Assert.AreEqual(noise.Length, length);
\r
68 Assert.IsTrue(p is Yubeshi.Nmea.GpDtm);
\r
71 Assert.IsTrue(p is Yubeshi.Ubx.NavClock);
\r