public void Segfp_user_placement() { Given_Executable(".text", 0x0010_0000, 0x4000); Given_Procedure(0x00101000); Given_Procedure(0x00101100); Given_UserProcedure(0x00101000, "myproc", "myproc.c"); var ofp = new SegmentFilePolicy(program); var placements = ofp.GetProcedurePlacements(".asm").ToArray(); Assert.AreEqual(2, placements.Length); Assert.AreEqual("myproc.asm", placements[0].Key); Assert.AreEqual("myprogram_text.asm", placements[1].Key); }
public void Segfp_Single_Segment() { Given_Executable(".text", 0x00100000, 0x4000); Given_Procedure(0x00101000); var ofp = new SegmentFilePolicy(program); var placements = ofp.GetProcedurePlacements(".asm").ToArray(); Assert.AreEqual(1, placements.Length); Assert.AreEqual("myprogram_text.asm", placements[0].Key); var procs = placements[0].Value; Assert.AreEqual(1, procs.Count); Assert.AreEqual("fn00101000", procs[0].Name); }
public void SegFp_object_placement() { Given_Executable(".text", 0x0010_0000, 0x4000); Given_Segment(".data", 0x0020_0000, 0x4000); Given_Data(0x0020_0010, "78 56 34 12"); Given_GlobalVariable(0x0020_0010, PrimitiveType.Int32); var ofp = new SegmentFilePolicy(program); var placements = ofp.GetObjectPlacements(".c", listener).ToArray(); Assert.AreEqual(1, placements.Length); Assert.AreEqual("myprogram_data.c", placements[0].Key); var objs = placements[0].Value.OrderBy(k => k.Key).ToArray(); Assert.AreEqual(1, objs.Length); }
public void Segfp_large_segment() { Given_Executable(".text", 0x0010_0000, 0x10_0000); Given_Procedure(0x00101000); Given_Procedure(0x00113F00); Given_Procedure(0x00133F00); var ofp = new SegmentFilePolicy(program); var placements = ofp.GetProcedurePlacements(".asm").ToArray(); Assert.AreEqual(3, placements.Length); Assert.AreEqual("myprogram_text_0000.asm", placements[0].Key); Assert.AreEqual("myprogram_text_0001.asm", placements[1].Key); Assert.AreEqual("myprogram_text_0003.asm", placements[2].Key); Assert.IsTrue(placements.All(p => p.Value.Count == 1)); }
public void Segfp_Single_Segment_Two_procs() { Given_Executable(".text", 0x00100000, 0x4000); Given_Procedure(0x00101000); Given_Procedure(0x00101400); var ofp = new SegmentFilePolicy(program); var placements = ofp.GetObjectPlacements(".asm", listener).ToArray(); Assert.AreEqual(1, placements.Length); Assert.AreEqual("myprogram_text.asm", placements[0].Key); var procs = placements[0].Value.Values.Cast <Procedure>().ToArray(); Assert.AreEqual(2, procs.Length); Assert.AreEqual("fn00101000", procs[0].Name); Assert.AreEqual("fn00101400", procs[1].Name); }