VCDiffAddressCache { public abstract void Init(); protected  VCDiffAddressCache(); protected  VCDiffAddressCache(short near_cache_size, short same_cache_size); abstract void Init(); short FirstSameMode(); short LastMode(); final int DecodeSameAddress(short mode, short encoded_address); final boolean WriteAddressAsVarintForMode(short mode); abstract void UpdateCache(int address); abstract short EncodeAddress(int address,
            int here_address,
            AtomicInteger encoded_addr); abstract int DecodeAddress(int here_address, short vcDiffMode, ByteBuffer address_stream); static final short VCD_SELF_MODE; static final short VCD_HERE_MODE; static final short VCD_FIRST_NEAR_MODE; static final short VCD_MAX_MODES; }
@Test public void CacheContentsInitiallyZero() { VCDiffAddressCacheImpl cache = new VCDiffAddressCacheImpl(); cache.Init(); assertEquals(VCDiffAddressCache.kDefaultNearCacheSize, cache.near_addresses_.length); assertEquals(VCDiffAddressCache.kDefaultSameCacheSize * 256, cache.same_addresses_.length); for (int test_address = 0; test_address < cache.near_addresses_.length; ++test_address) { assertEquals(0, cache.near_addresses_[test_address]); } for (int test_address = 0; test_address < cache.same_addresses_.length; ++test_address) { assertEquals(0, cache.same_addresses_[test_address]); } }
@Test public void ZeroCacheSizes() { VCDiffAddressCache zero_cache = new VCDiffAddressCacheImpl((short) 0, (short) 0); zero_cache.Init(); }
@Test public void MaxLegalNearCacheSize() { VCDiffAddressCacheImpl i = new VCDiffAddressCacheImpl((short) (VCDiffAddressCache.VCD_MAX_MODES - 2), (short) 0); i.Init(); }
@Test public void MaxLegalSameCacheSize() { VCDiffAddressCacheImpl i = new VCDiffAddressCacheImpl((short) 0, (short) (VCDiffAddressCache.VCD_MAX_MODES - 2)); i.Init(); }
@Test public void MaxLegalCombinedSizes() { VCDiffAddressCacheImpl i = new VCDiffAddressCacheImpl((short) (VCDiffAddressCache.VCD_MAX_MODES / 2 - 1), (short) (VCDiffAddressCache.VCD_MAX_MODES / 2 - 1)); i.Init(); }