fn size_cache_racing_keys_eviction_regression() {
        let mut c = SizedCache::with_size(2);
        assert_eq!(c.cache_set(1, 100), None);
        assert_eq!(c.cache_set(1, 100), Some(100));
        // size would be 1, but internal ordered would be [1, 1]
        assert_eq!(c.cache_set(2, 100), None);
        assert_eq!(c.cache_set(3, 100), None);
        // this next set would fail because a duplicate key would be evicted
        assert_eq!(c.cache_set(4, 100), None);
    }
/// This is a regression test to confirm that racing cache sets on a SizedCache
/// do not cause duplicates to exist in the internal `order`. See issue #7
This is a regression test to confirm that racing cache sets on a SizedCache
do not cause duplicates to exist in the internal `order`. See issue #7
This is a regression test to confirm that racing cache sets on a SizedCache do not cause duplicates to exist in the internal ` order ` . See issue #7
fn size_cache_racing_keys_eviction_regression() {
        let mut c = SizedCache::with_size(2);
        assert_eq!(c.cache_set(1, 100), None);
        assert_eq!(c.cache_set(1, 100), Some(100));
        // size would be 1, but internal ordered would be [1, 1]
        assert_eq!(c.cache_set(2, 100), None);
        assert_eq!(c.cache_set(3, 100), None);
        // this next set would fail because a duplicate key would be evicted
        assert_eq!(c.cache_set(4, 100), None);
    }
fn size_cache_racing_keys_eviction_regression ( ) { let mut c = SizedCache :: with_size ( 2 ) ; assert_eq ! ( c cache_set ( 1 100 ) None ) ; assert_eq ! ( c cache_set ( 1 100 ) Some ( 100 ) ) ; // size would be 1, but internal ordered would be [1, 1] assert_eq ! ( c cache_set ( 2 100 ) None ) ; assert_eq ! ( c cache_set ( 3 100 ) None ) ; // this next set would fail because a duplicate key would be evicted assert_eq ! ( c cache_set ( 4 100 ) None ) ; }
This is a regression test to confirm that racing cache sets on a SizedCache
do not cause duplicates to exist in the internal `order`.
This is a regression test to confirm that racing cache sets on a SizedCache do not cause duplicates to exist in the internal ` order ` .