github.com/grafana/pyroscope@v1.18.0/pkg/og/storage/tree/serialize_nodict_test.go (about) 1 package tree 2 3 import ( 4 "bytes" 5 6 . "github.com/onsi/ginkgo/v2/dsl/core" 7 . "github.com/onsi/gomega" 8 ) 9 10 var serializationExample = []byte("\x00\x00\x01\x01a\x00\x02\x01b\x01\x00\x01c\x02\x00") 11 12 var _ = Describe("tree package", func() { 13 14 Describe("DeserializeNoDict", func() { 15 It("returns correct results", func() { 16 r := bytes.NewReader(serializationExample) 17 t, err := DeserializeNoDict(r) 18 Expect(err).ToNot(HaveOccurred()) 19 20 Expect(string(t.root.Name)).To(Equal("")) 21 Expect(string(t.root.ChildrenNodes[0].Name)).To(Equal("a")) 22 Expect(string(t.root.ChildrenNodes[0].ChildrenNodes[0].Name)).To(Equal("b")) 23 Expect(string(t.root.ChildrenNodes[0].ChildrenNodes[1].Name)).To(Equal("c")) 24 }) 25 }) 26 })