26 lines
560 B
Go
26 lines
560 B
Go
package playlist_test
|
|
|
|
import (
|
|
"segmento/internal/playlist"
|
|
"segmento/internal/segment"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestMediaPlaylistImplements(t *testing.T) {
|
|
require.Implements(t, (*playlist.Playlist)(nil), playlist.NewMediaPlaylist())
|
|
}
|
|
|
|
func TestMediaPlaylist(t *testing.T) {
|
|
playlist := playlist.NewMediaPlaylist()
|
|
|
|
for i := 0; i < 8; i++ {
|
|
s := segment.NewSegment(10*time.Second, 0)
|
|
s.IncrementDuration(3 * time.Second)
|
|
playlist.AddSegment(s)
|
|
}
|
|
require.Equal(t, 21*time.Second, playlist.Duration())
|
|
}
|