示例#1
0
        public void GetHashTest()
        {
            string fileName        = "myFile.wasp";
            int    characterNumber = 893892;
            var    target          = new Loc(fileName, characterNumber);

            Assert.AreEqual(target.GetHashCode(), new Loc(fileName, characterNumber).GetHashCode());
        }
示例#2
0
        public void TestLoc()
        {
            PlainCellCache cache = new PlainCellCache();

            for (int bookIndex = 0; bookIndex < 0x1000; bookIndex += 0x100)
            {
                for (int sheetIndex = 0; sheetIndex < 0x1000; sheetIndex += 0x100)
                {
                    for (int rowIndex = 0; rowIndex < 0x100000; rowIndex += 0x1000)
                    {
                        for (int columnIndex = 0; columnIndex < 0x4000; columnIndex += 0x100)
                        {
                            Loc loc = new Loc(bookIndex, sheetIndex, rowIndex, columnIndex);
                            Assert.AreEqual(bookIndex, loc.BookIndex);
                            Assert.AreEqual(sheetIndex, loc.SheetIndex);
                            Assert.AreEqual(rowIndex, loc.RowIndex);
                            Assert.AreEqual(columnIndex, loc.ColumnIndex);

                            Loc sameLoc = new Loc(bookIndex, sheetIndex, rowIndex, columnIndex);
                            Assert.AreEqual(loc.GetHashCode(), sameLoc.GetHashCode());
                            Assert.IsTrue(loc.Equals(sameLoc));

                            Assert.IsNull(cache.Get(loc));
                            PlainValueCellCacheEntry entry = new PlainValueCellCacheEntry(new NumberEval(0));
                            cache.Put(loc, entry);

                            Assert.AreSame(entry, cache.Get(loc));
                            cache.Remove(loc);
                            Assert.IsNull(cache.Get(loc));

                            cache.Put(loc, entry);
                        }
                        cache.Clear();
                    }
                }
            }
        }
示例#3
0
 public override int GetHashCode()
 {
     return(TexLoc.GetHashCode() ^ Sheet.GetHashCode());
 }