github.com/pion/webrtc/v4@v4.0.1/pkg/media/samplebuilder/sampleSequenceLocation_test.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package samplebuilder
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestSampleSequenceLocationCompare(t *testing.T) {
    13  	s1 := sampleSequenceLocation{32, 42}
    14  	assert.Equal(t, slCompareBefore, s1.compare(16))
    15  	assert.Equal(t, slCompareInside, s1.compare(32))
    16  	assert.Equal(t, slCompareInside, s1.compare(38))
    17  	assert.Equal(t, slCompareInside, s1.compare(41))
    18  	assert.Equal(t, slCompareAfter, s1.compare(42))
    19  	assert.Equal(t, slCompareAfter, s1.compare(0x57))
    20  
    21  	s2 := sampleSequenceLocation{0xffa0, 32}
    22  	assert.Equal(t, slCompareBefore, s2.compare(0xff00))
    23  	assert.Equal(t, slCompareInside, s2.compare(0xffa0))
    24  	assert.Equal(t, slCompareInside, s2.compare(0xffff))
    25  	assert.Equal(t, slCompareInside, s2.compare(0))
    26  	assert.Equal(t, slCompareInside, s2.compare(31))
    27  	assert.Equal(t, slCompareAfter, s2.compare(32))
    28  	assert.Equal(t, slCompareAfter, s2.compare(128))
    29  }