public void Hfp_ReadString_ZeroLength() { var bytes = hm.MakeImageReader(0); var parser = new HunkFileParser(bytes); Assert.AreEqual("", parser.ReadString()); }
public void Hfp_ReadString_TrailingZeros() { var bytes = hm.MakeImageReader("a"); var parser = new HunkFileParser(bytes); Assert.AreEqual("a", parser.ReadString()); }
public void Hfp_CodeBlock() { var rdr = hm.MakeImageReader( //0x3E9, // Assumes this is already read 2, 3, 4); var parser = new HunkFileParser(rdr); TextHunk code = parser.ParseText(q => { }); Assert.AreEqual(12, rdr.Offset); Assert.AreEqual(new byte[] { 0, 0, 0, 3, 0, 0, 0, 4 }, code.Data); }
public void Hfp_DebugHunk() { var rdr = hm.MakeImageReader( //0x3F3, 2, 0x00, 1234, 0x12345678); var parser = new HunkFileParser(rdr); parser.ParseDebug(q => { }); var nextWord = rdr.ReadBeInt32(); Assert.AreEqual(0x12345678, nextWord); }
public void Hfp_HeaderBlock() { var rdr = hm.MakeImageReader( //0x3F3, "Hello", "", 2, 0, 1, 4, 16); var parser = new HunkFileParser(rdr); HeaderHunk hdr = parser.ParseHeader(q => { }); Assert.AreEqual(1, hdr.HunkNames.Count); Assert.AreEqual("Hello", hdr.HunkNames[0]); Assert.AreEqual(0, hdr.FirstHunkId); Assert.AreEqual(1, hdr.LastHunkId); Assert.AreEqual(2, hdr.HunkInfos.Count); Assert.AreEqual(16, hdr.HunkInfos[0].Size); Assert.AreEqual(64, hdr.HunkInfos[1].Size); }