MCPcopy
hub / github.com/google/mangle / TestGzip

Function TestGzip

factstore/simplecolumn_test.go:244–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

242}
243
244func TestGzip(t *testing.T) {
245 tmpStore := NewSimpleInMemoryStore()
246 tmpStore.Add(atom("i(/persist, '%%')"))
247 tmpStore.Add(atom("we(/persist)"))
248 var b bytes.Buffer
249 w := gzip.NewWriter(&b)
250 sc := SimpleColumn{}
251 if err := sc.WriteTo(tmpStore, w); err != nil {
252 t.Fatal(err)
253 }
254 if err := w.Close(); err != nil {
255 t.Fatal(err)
256 }
257 store, err := NewSimpleColumnStoreFromGzipBytes(b.Bytes())
258 if err != nil {
259 t.Fatal(err)
260 }
261 if diff := cmp.Diff(tmpStore.ListPredicates(), store.ListPredicates(),
262 cmpopts.SortSlices(sortBySymbol)); diff != "" {
263 t.Errorf("NewSimpleColumnStoreFromGzipBytes: diff (-want +got) %v", diff)
264 }
265 if !store.Contains(atom("i(/persist, '%%')")) {
266 t.Errorf("NewSimpleColumnStoreFromGzipBytes: expected atom i(/persist, '%%')")
267 }
268 if !store.Contains(atom("we(/persist)")) {
269 t.Errorf("NewSimpleColumnStoreFromGzipBytes: expected atom i(/persist)")
270 }
271}

Callers

nothing calls this directly

Calls 8

AddMethod · 0.95
WriteToMethod · 0.95
ListPredicatesMethod · 0.95
NewSimpleInMemoryStoreFunction · 0.85
atomFunction · 0.70
ListPredicatesMethod · 0.65
ContainsMethod · 0.65

Tested by

no test coverage detected