public void Associate() { var foo = new Identifier("foo", PrimitiveType.SegmentSelector, null); var bar = new Identifier("bar", PrimitiveType.Word16, null); var mpc = new SegmentedAccessClassifier(null, null); mpc.Associate(foo, bar); Assert.IsNotNull(mpc.AssociatedIdentifier(foo), "Bar should be associated"); mpc.Associate(foo, bar); Assert.IsNotNull(mpc.AssociatedIdentifier(foo), "Bar should still be associated"); }
public void Disassociate() { Identifier foo = new Identifier("foo", PrimitiveType.SegmentSelector, null); Identifier bar = new Identifier("bar", PrimitiveType.Word16, null); Identifier baz = new Identifier("baz", PrimitiveType.Word16, null); SegmentedAccessClassifier mpc = new SegmentedAccessClassifier(null, null); mpc.Associate(foo, bar); mpc.Associate(foo, baz); Assert.IsNull(mpc.AssociatedIdentifier(foo), "Bar should no longer be associated"); }
public void Classify2() { Prepare(new Mp2()); SegmentedAccessClassifier mpc = new SegmentedAccessClassifier(proc, ssaIds); mpc.Classify(); Identifier ds = ssaIds.Where(s => s.Identifier.Name == "ds").Single().Identifier; Assert.AreEqual("ds", ds.Name); Identifier bx = ssaIds.Where(s => s.Identifier.Name == "bx").Single().Identifier; Assert.AreEqual("bx", bx.Name); Identifier a = mpc.AssociatedIdentifier(ds); Assert.AreSame(a, bx); }
public void Classify3() { Prepare(new Mp3()); SegmentedAccessClassifier mpc = new SegmentedAccessClassifier(proc, ssaIds); mpc.Classify(); Identifier ds = ssaIds.Where(s => s.Identifier.Name == "ds").Single().Identifier; Assert.AreEqual("ds", ds.Name); Identifier bx = ssaIds.Where(s => s.Identifier.Name == "bx").Single().Identifier; Assert.AreEqual("bx", bx.Name); Identifier a = mpc.AssociatedIdentifier(ds); Assert.IsNull(a, "ds is used both as ds:[bx+4] and ds:[0x3000], it should't be strongly associated with a register"); }