public void ShouldFindOneSymbolBoundary()
        {
            var lookup = new SymbolLookup();

            lookup.InsertSymbol("Test", 0x100, 0x10);
            Assert.AreEqual("Test", lookup.GetSymbolByAddress(0x100).Name);
        }
        public void ShouldNotFindOneSymbolBoundary()
        {
            var lookup = new SymbolLookup();

            lookup.InsertSymbol("Test", 0x100, 0x10);
            Symbol dummy;

            Assert.IsFalse(lookup.TryGetSymbolByAddress(0x110, out dummy));
        }
        public void ShouldFindComplicatedFromSingleInsertsTest()
        {
            var symbols = new List <Symbol>
            {
                MakeSymbolEntry("一", 0, 100),
                MakeSymbolEntry("二", 10, 40),
                MakeSymbolEntry("三", 15, 15),
                MakeSymbolEntry("四", 30, 15),
                MakeSymbolEntry("五", 55, 5),
                MakeSymbolEntry("中", 60, 10),
                MakeSymbolEntry("国", 50, 20),
                MakeSymbolEntry("猫", 80, 15),
                MakeSymbolEntry("私", 85, 5),
                MakeSymbolEntry("糞", 100, 20),
                MakeSymbolEntry("ICantSpeekJapaneese", 56, 2),
                MakeSymbolEntry("KoreanNeither", 58, 2)
            };
            var lookup = new SymbolLookup();

            foreach (var symbol in symbols)
            {
                lookup.InsertSymbol(symbol);
            }

            Assert.AreEqual("一", lookup.GetSymbolByAddress(1).Name);
            Assert.AreEqual("二", lookup.GetSymbolByAddress(11).Name);
            Assert.AreEqual("三", lookup.GetSymbolByAddress(16).Name);
            Assert.AreEqual("四", lookup.GetSymbolByAddress(31).Name);
            Assert.AreEqual("二", lookup.GetSymbolByAddress(46).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(52).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(55).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(64).Name);
            Assert.AreEqual("一", lookup.GetSymbolByAddress(72).Name);
            Assert.AreEqual("猫", lookup.GetSymbolByAddress(84).Name);
            Assert.AreEqual("私", lookup.GetSymbolByAddress(86).Name);
            Assert.AreEqual("猫", lookup.GetSymbolByAddress(94).Name);
            Assert.AreEqual("一", lookup.GetSymbolByAddress(95).Name);
            Assert.AreEqual("糞", lookup.GetSymbolByAddress(100).Name);

            Assert.AreEqual("ICantSpeekJapaneese", lookup.GetSymbolByAddress(57).Name);
            Assert.AreEqual("KoreanNeither", lookup.GetSymbolByAddress(59).Name);
        }
Exemple #4
0
 public void ShouldNotFindOneSymbolMiss()
 {
     var lookup = new SymbolLookup();
     lookup.InsertSymbol("Test", 0x100, 0x10);
     Symbol dummy;
     Assert.IsFalse(lookup.TryGetSymbolByAddress(0x120, out dummy));
 }
Exemple #5
0
 public void ShouldFindOneSymbolBoundary()
 {
     var lookup = new SymbolLookup();
     lookup.InsertSymbol("Test", 0x100, 0x10);
     Assert.AreEqual("Test", lookup.GetSymbolByAddress(0x100).Name);
 }
Exemple #6
0
        public void ShouldFindComplicatedFromSingleInsertsTest()
        {
            var symbols = new List<Symbol>
            {
                MakeSymbolEntry("一", 0, 100),
                MakeSymbolEntry("二", 10, 40),
                MakeSymbolEntry("三", 15, 15),
                MakeSymbolEntry("四", 30, 15),
                MakeSymbolEntry("五", 55, 5),
                MakeSymbolEntry("中", 60, 10),
                MakeSymbolEntry("国", 50, 20),
                MakeSymbolEntry("猫", 80, 15),
                MakeSymbolEntry("私", 85, 5),
                MakeSymbolEntry("糞", 100, 20),
                MakeSymbolEntry("ICantSpeekJapaneese", 56, 2),
                MakeSymbolEntry("KoreanNeither", 58, 2)
            };
            var lookup = new SymbolLookup();
            foreach(var symbol in symbols)
            {
                lookup.InsertSymbol(symbol);
            }

            Assert.AreEqual("一", lookup.GetSymbolByAddress(1).Name);
            Assert.AreEqual("二", lookup.GetSymbolByAddress(11).Name);
            Assert.AreEqual("三", lookup.GetSymbolByAddress(16).Name);
            Assert.AreEqual("四", lookup.GetSymbolByAddress(31).Name);
            Assert.AreEqual("二", lookup.GetSymbolByAddress(46).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(52).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(55).Name);
            Assert.AreEqual("国", lookup.GetSymbolByAddress(64).Name);
            Assert.AreEqual("一", lookup.GetSymbolByAddress(72).Name);
            Assert.AreEqual("猫", lookup.GetSymbolByAddress(84).Name);
            Assert.AreEqual("私", lookup.GetSymbolByAddress(86).Name);
            Assert.AreEqual("猫", lookup.GetSymbolByAddress(94).Name);
            Assert.AreEqual("一", lookup.GetSymbolByAddress(95).Name);
            Assert.AreEqual("糞", lookup.GetSymbolByAddress(100).Name);

            Assert.AreEqual("ICantSpeekJapaneese", lookup.GetSymbolByAddress(57).Name);
            Assert.AreEqual("KoreanNeither", lookup.GetSymbolByAddress(59).Name);
        }