// 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 pprofile

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"go.opentelemetry.io/collector/pdata/internal"
	otlpprofiles "go.opentelemetry.io/collector/pdata/internal/data/protogen/profiles/v1development"
)

func TestLine_MoveTo(t *testing.T) {
	ms := generateTestLine()
	dest := NewLine()
	ms.MoveTo(dest)
	assert.Equal(t, NewLine(), ms)
	assert.Equal(t, generateTestLine(), dest)
	dest.MoveTo(dest)
	assert.Equal(t, generateTestLine(), dest)
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { ms.MoveTo(newLine(internal.NewOrigLine(), sharedState)) })
	assert.Panics(t, func() { newLine(internal.NewOrigLine(), sharedState).MoveTo(dest) })
}

func TestLine_CopyTo(t *testing.T) {
	ms := NewLine()
	orig := NewLine()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	orig = generateTestLine()
	orig.CopyTo(ms)
	assert.Equal(t, orig, ms)
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { ms.CopyTo(newLine(internal.NewOrigLine(), sharedState)) })
}

func TestLine_FunctionIndex(t *testing.T) {
	ms := NewLine()
	assert.Equal(t, int32(0), ms.FunctionIndex())
	ms.SetFunctionIndex(int32(13))
	assert.Equal(t, int32(13), ms.FunctionIndex())
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { newLine(&otlpprofiles.Line{}, sharedState).SetFunctionIndex(int32(13)) })
}

func TestLine_Line(t *testing.T) {
	ms := NewLine()
	assert.Equal(t, int64(0), ms.Line())
	ms.SetLine(int64(13))
	assert.Equal(t, int64(13), ms.Line())
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { newLine(&otlpprofiles.Line{}, sharedState).SetLine(int64(13)) })
}

func TestLine_Column(t *testing.T) {
	ms := NewLine()
	assert.Equal(t, int64(0), ms.Column())
	ms.SetColumn(int64(13))
	assert.Equal(t, int64(13), ms.Column())
	sharedState := internal.NewState()
	sharedState.MarkReadOnly()
	assert.Panics(t, func() { newLine(&otlpprofiles.Line{}, sharedState).SetColumn(int64(13)) })
}

func generateTestLine() Line {
	ms := newLine(internal.GenTestOrigLine(), internal.NewState())
	return ms
}
