func (suite *DynamicChunkStoreSuite) TestGetReturnsNilIfWrappedDoesntHaveIt(c *check.C) { provider := suite.createChunkProvider(func(consumer chunk.Consumer) {}) wrappedStore := store.NewProviderBacked(provider, func() {}) store := NewDynamicChunkStore(wrappedStore) holder := store.Get(res.ResourceID(2)) c.Check(holder, check.IsNil) }
func (suite *DynamicChunkStoreSuite) TestGetReturnsBlockFromWrapped(c *check.C) { provider := suite.createChunkProvider(func(consumer chunk.Consumer) { consumer.Consume(res.ResourceID(1), chunk.NewBlockHolder(chunk.BasicChunkType, res.Palette, [][]byte{[]byte{}})) }) wrappedStore := store.NewProviderBacked(provider, func() {}) store := NewDynamicChunkStore(wrappedStore) holder := store.Get(res.ResourceID(1)) c.Check(holder, check.NotNil) }
func (suite *DynamicChunkStoreSuite) TestBlockHolderModifiesWrapped(c *check.C) { provider := suite.createChunkProvider(func(consumer chunk.Consumer) { consumer.Consume(res.ResourceID(1), chunk.NewBlockHolder(chunk.BasicChunkType, res.Palette, [][]byte{[]byte{}})) }) wrappedStore := store.NewProviderBacked(provider, func() {}) store := NewDynamicChunkStore(wrappedStore) data := []byte{0x01, 0x02} holder := store.Get(res.ResourceID(1)) holder.SetBlockData(0, data) c.Check(wrappedStore.Get(res.ResourceID(1)).BlockData(0), check.DeepEquals, data) }