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

Function TestNewBytes

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

Source from the content-addressed store, hash-verified

217}
218
219func TestNewBytes(t *testing.T) {
220 tmpStore := NewSimpleInMemoryStore()
221 tmpStore.Add(atom("i(/persist)"))
222 tmpStore.Add(atom("we(/persist)"))
223 var b bytes.Buffer
224 sc := SimpleColumn{}
225 if err := sc.WriteTo(tmpStore, &b); err != nil {
226 t.Fatal(err)
227 }
228 store, err := NewSimpleColumnStoreFromBytes(b.Bytes())
229 if err != nil {
230 t.Fatal(err)
231 }
232 if diff := cmp.Diff(tmpStore.ListPredicates(), store.ListPredicates(),
233 cmpopts.SortSlices(sortBySymbol)); diff != "" {
234 t.Errorf("NewSimpleColumnStoreFromBytes: diff (-want +got) %v", diff)
235 }
236 if !store.Contains(atom("i(/persist)")) {
237 t.Errorf("NewSimpleColumnStoreFromBytes: expected atom i(/persist)")
238 }
239 if !store.Contains(atom("we(/persist)")) {
240 t.Errorf("NewSimpleColumnStoreFromBytes: expected atom i(/persist)")
241 }
242}
243
244func TestGzip(t *testing.T) {
245 tmpStore := NewSimpleInMemoryStore()

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