Esempio n. 1
0
 public void ShouldHaveMoreAndLessImportantViaName()
 {
     var lookup = new SymbolLookup();
     var symbols = new List<Symbol>
     {
         new Symbol(0, 10, "LessImportant"),
         new Symbol(0, 10, "MoreImportant", SymbolType.Function)
     };
     IReadOnlyCollection<Symbol> dummy;
     lookup.InsertSymbols(symbols);
     Assert.IsTrue(lookup.TryGetSymbolsByName("MoreImportant", out dummy));
     Assert.IsTrue(lookup.TryGetSymbolsByName("LessImportant", out dummy));
 }
        public void ShouldHaveMoreAndLessImportantViaName()
        {
            var lookup  = new SymbolLookup();
            var symbols = new List <Symbol>
            {
                new Symbol(0, 10, "LessImportant"),
                new Symbol(0, 10, "MoreImportant", SymbolType.Function)
            };
            IReadOnlyCollection <Symbol> dummy;

            lookup.InsertSymbols(symbols);
            Assert.IsTrue(lookup.TryGetSymbolsByName("MoreImportant", out dummy));
            Assert.IsTrue(lookup.TryGetSymbolsByName("LessImportant", out dummy));
        }
        public void ShouldPerserveSymbol()
        {
            var symbols1 = new List <Symbol>
            {
                new Symbol(0, 100, "一"),
                new Symbol(20, 35, "三"),
                new Symbol(100, 105, "猫"),
            };
            var symbols2 = new List <Symbol>
            {
                new Symbol(15, 25, "私"),
            };
            var lookup = new SymbolLookup();

            lookup.InsertSymbols(symbols1);
            lookup.InsertSymbols(symbols2);

            var symbol = symbols1[1];
            IReadOnlyCollection <Symbol> symbols;

            Assert.IsTrue(
                lookup.TryGetSymbolsByName(symbol.Name, out symbols),
                string.Format("Symbol {0} has NOT been deduplicated.", symbol)
                );
        }
        public void ShouldCoverZeroLenghtSymbol()
        {
            var symbols1 = new List <Symbol>
            {
                new Symbol(50, 50, "二"),
            };
            var symbols2 = new List <Symbol>
            {
                new Symbol(50, 100, "一"),
                new Symbol(50, 75, "三"),
            };
            var expectedSymbols = new List <Symbol>
            {
                new Symbol(50, 100, "一"),
                new Symbol(50, 75, "三"),
            };
            var addressesToQuery = new List <uint> {
                90, 55
            };
            var lookup = new SymbolLookup();

            lookup.InsertSymbols(symbols1);
            lookup.InsertSymbols(symbols2);
            CollectionAssert.AreEqual(expectedSymbols, addressesToQuery.Select(address => lookup.GetSymbolByAddress(address)));
            IReadOnlyCollection <Symbol> symbols;

            Assert.IsFalse(lookup.TryGetSymbolsByName("二", out symbols), "Symbol \"二\"should not be present.");
        }
Esempio n. 5
0
        public void ShouldPerserveSymbol()
        {
            var symbols1 = new List<Symbol>
            {
                new Symbol(0, 100, "一"),
                new Symbol(20, 35, "三"),
                new Symbol(100, 105, "猫"),
            };
            var symbols2 = new List<Symbol>
            {
                new Symbol(15, 25, "私"),
            };
            var lookup = new SymbolLookup();
            lookup.InsertSymbols(symbols1);
            lookup.InsertSymbols(symbols2);

            var symbol = symbols1[1];
            IReadOnlyCollection<Symbol> symbols;
            Assert.IsTrue(
                lookup.TryGetSymbolsByName(symbol.Name, out symbols),
                string.Format("Symbol {0} has NOT been deduplicated.", symbol)
            );
        }
Esempio n. 6
0
 public void ShouldCoverZeroLenghtSymbol()
 {
     var symbols1 = new List<Symbol>
     {
         new Symbol(50, 50, "二"),
     };
     var symbols2 = new List<Symbol>
     {
         new Symbol(50, 100, "一"),
         new Symbol(50, 75, "三"),
     };
     var expectedSymbols = new List<Symbol>
     {
         new Symbol(50, 100, "一"),
         new Symbol(50, 75, "三"),
     };
     var addressesToQuery = new List<uint>{90, 55};
     var lookup = new SymbolLookup();
     lookup.InsertSymbols(symbols1);
     lookup.InsertSymbols(symbols2);
     CollectionAssert.AreEqual(expectedSymbols, addressesToQuery.Select(address => lookup.GetSymbolByAddress(address)));
     IReadOnlyCollection<Symbol> symbols;
     Assert.IsFalse(lookup.TryGetSymbolsByName("二", out symbols), "Symbol \"二\"should not be present.");
 }