Debian Codegraph @

pdata/pprofile/generated_profilesdictionary_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package pprofile
8
9 import (
10 "testing"
11
12 "github.com/stretchr/testify/assert"
13
14 "go.opentelemetry.io/collector/pdata/internal"
15 "go.opentelemetry.io/collector/pdata/pcommon"
16 )
17
18 func TestProfilesDictionary_MoveTo(t *testing.T) {
19 ms := generateTestProfilesDictionary()
20 dest := NewProfilesDictionary()
21 ms.MoveTo(dest)
22 assert.Equal(t, NewProfilesDictionary(), ms)
23 assert.Equal(t, generateTestProfilesDictionary(), dest)
24 dest.MoveTo(dest)
25 assert.Equal(t, generateTestProfilesDictionary(), dest)
26 sharedState := internal.NewState()
27 sharedState.MarkReadOnly()
28 assert.Panics(t, func() { ms.MoveTo(newProfilesDictionary(internal.NewProfilesDictionary(), sharedState)) })
29 assert.Panics(t, func() { newProfilesDictionary(internal.NewProfilesDictionary(), sharedState).MoveTo(dest) })
30 }
31
32 func TestProfilesDictionary_CopyTo(t *testing.T) {
33 ms := NewProfilesDictionary()
34 orig := NewProfilesDictionary()
35 orig.CopyTo(ms)
36 assert.Equal(t, orig, ms)
37 orig = generateTestProfilesDictionary()
38 orig.CopyTo(ms)
39 assert.Equal(t, orig, ms)
40 sharedState := internal.NewState()
41 sharedState.MarkReadOnly()
42 assert.Panics(t, func() { ms.CopyTo(newProfilesDictionary(internal.NewProfilesDictionary(), sharedState)) })
43 }
44
45 func TestProfilesDictionary_MappingTable(t *testing.T) {
46 ms := NewProfilesDictionary()
47 assert.Equal(t, NewMappingSlice(), ms.MappingTable())
48 ms.orig.MappingTable = internal.GenTestMappingPtrSlice()
49 assert.Equal(t, generateTestMappingSlice(), ms.MappingTable())
50 }
51
52 func TestProfilesDictionary_LocationTable(t *testing.T) {
53 ms := NewProfilesDictionary()
54 assert.Equal(t, NewLocationSlice(), ms.LocationTable())
55 ms.orig.LocationTable = internal.GenTestLocationPtrSlice()
56 assert.Equal(t, generateTestLocationSlice(), ms.LocationTable())
57 }
58
59 func TestProfilesDictionary_FunctionTable(t *testing.T) {
60 ms := NewProfilesDictionary()
61 assert.Equal(t, NewFunctionSlice(), ms.FunctionTable())
62 ms.orig.FunctionTable = internal.GenTestFunctionPtrSlice()
63 assert.Equal(t, generateTestFunctionSlice(), ms.FunctionTable())
64 }
65
66 func TestProfilesDictionary_LinkTable(t *testing.T) {
67 ms := NewProfilesDictionary()
68 assert.Equal(t, NewLinkSlice(), ms.LinkTable())
69 ms.orig.LinkTable = internal.GenTestLinkPtrSlice()
70 assert.Equal(t, generateTestLinkSlice(), ms.LinkTable())
71 }
72
73 func TestProfilesDictionary_StringTable(t *testing.T) {
74 ms := NewProfilesDictionary()
75 assert.Equal(t, pcommon.NewStringSlice(), ms.StringTable())
76 ms.orig.StringTable = internal.GenTestStringSlice()
77 assert.Equal(t, pcommon.StringSlice(internal.GenTestStringSliceWrapper()), ms.StringTable())
78 }
79
80 func TestProfilesDictionary_AttributeTable(t *testing.T) {
81 ms := NewProfilesDictionary()
82 assert.Equal(t, NewKeyValueAndUnitSlice(), ms.AttributeTable())
83 ms.orig.AttributeTable = internal.GenTestKeyValueAndUnitPtrSlice()
84 assert.Equal(t, generateTestKeyValueAndUnitSlice(), ms.AttributeTable())
85 }
86
87 func TestProfilesDictionary_StackTable(t *testing.T) {
88 ms := NewProfilesDictionary()
89 assert.Equal(t, NewStackSlice(), ms.StackTable())
90 ms.orig.StackTable = internal.GenTestStackPtrSlice()
91 assert.Equal(t, generateTestStackSlice(), ms.StackTable())
92 }
93
94 func generateTestProfilesDictionary() ProfilesDictionary {
95 return newProfilesDictionary(internal.GenTestProfilesDictionary(), internal.NewState())
96 }