Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
30 lines
985 B
Go
30 lines
985 B
Go
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package samplebuilder
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSampleSequenceLocationCompare(t *testing.T) {
|
|
s1 := sampleSequenceLocation{32, 42}
|
|
assert.Equal(t, slCompareBefore, s1.compare(16))
|
|
assert.Equal(t, slCompareInside, s1.compare(32))
|
|
assert.Equal(t, slCompareInside, s1.compare(38))
|
|
assert.Equal(t, slCompareInside, s1.compare(41))
|
|
assert.Equal(t, slCompareAfter, s1.compare(42))
|
|
assert.Equal(t, slCompareAfter, s1.compare(0x57))
|
|
|
|
s2 := sampleSequenceLocation{0xffa0, 32}
|
|
assert.Equal(t, slCompareBefore, s2.compare(0xff00))
|
|
assert.Equal(t, slCompareInside, s2.compare(0xffa0))
|
|
assert.Equal(t, slCompareInside, s2.compare(0xffff))
|
|
assert.Equal(t, slCompareInside, s2.compare(0))
|
|
assert.Equal(t, slCompareInside, s2.compare(31))
|
|
assert.Equal(t, slCompareAfter, s2.compare(32))
|
|
assert.Equal(t, slCompareAfter, s2.compare(128))
|
|
}
|