// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
// To regenerate this file run "make genpdata".

package ptrace

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"go.opentelemetry.io/collector/pdata/internal"
)

func TestTraces_MoveTo(t *testing.T) {
	ms := generateTestTraces()
	dest := NewTraces()
	ms.MoveTo(dest)
	assert.Equal(t, NewTraces(), ms)
	assert.Equal(t, generateTestTraces(), dest)
	dest.MoveTo(dest)
	assert.Equal(t, generateTestTraces(), dest)
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { ms.MoveTo(newTraces(internal.NewExportTraceServiceRequest(), sharedState)) })
	assert.Panics(t, func() { newTraces(internal.NewExportTraceServiceRequest(), sharedState).MoveTo(dest) })
}

func TestTraces_CopyTo(t *testing.T) {
	ms := NewTraces()
	orig := NewTraces()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	orig = generateTestTraces()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { ms.CopyTo(newTraces(internal.NewExportTraceServiceRequest(), sharedState)) })
}

func TestTraces_ResourceSpans(t *testing.T) {
	ms := NewTraces()
	assert.Equal(t, NewResourceSpansSlice(), ms.ResourceSpans())
	ms.getOrig().ResourceSpans = internal.GenTestResourceSpansPtrSlice()
	assert.Equal(t, generateTestResourceSpansSlice(), ms.ResourceSpans())
}

func generateTestTraces() Traces {
	return newTraces(internal.GenTestExportTraceServiceRequest(), internal.NewState())
}
