public void TryGetNetAt_WorksWell_WithProperInnput() { IBitmapAccessor accessor = new MockupBitmapAccessor( new string[] { // 012345678 " XXXXXXX", " XX X", " XX XXX X", "", " XX XXX X", " XX X", " XXXX", "", }); BitmapScanner dut = new BitmapScanner(accessor); dut.Scan(); dut.ComputeNetlists(); dut.CompactNets(); dut.MapNetlists(); Assert.IsTrue(dut.TryGetNetAt(1, 2, out int netId)); Assert.AreEqual(1, netId); Assert.IsTrue(dut.TryGetNetAt(5, 2, out netId)); Assert.AreEqual(2, netId); Assert.IsTrue(dut.TryGetNetAt(5, 4, out netId)); Assert.AreEqual(4, netId); Assert.IsFalse(dut.TryGetNetAt(3, 4, out netId)); }
public void MapNetlists_WorksWell() { IBitmapAccessor accessor = new MockupBitmapAccessor( new string[] { // 012345678 "X X", "X X X X", "X X X X", "XXXX XXXX", "", }); BitmapScanner dut = new BitmapScanner(accessor); dut.Scan(); dut.ComputeNetlists(); dut.CompactNets(); dut.MapNetlists(); for (int netId = 1; netId <= dut.GetNetCount(); netId++) { Console.WriteLine($"NetId : {netId}"); foreach (var segment in dut.GetSegmentsOfNet(netId)) { Console.WriteLine($" {segment}"); } } }
private bool IsSingleNetlist(BitmapScanner dut) { var result = true; dut.Scan(); dut.ComputeNetlists(); foreach (var segment in dut.Segments) { result &= segment.NetList == 1; } return(result); }