Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
megaadam committed Jan 31, 2022
1 parent cb6092e commit 9eaf349
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,40 @@ func TestDecodeMediaPlaylistStartTime(t *testing.T) {
}
}

func TestDecodeMasterChannels(t *testing.T) {
f, err := os.Open("sample-playlists/master-with-channels.m3u8")
if err != nil {
t.Fatal(err)
}
p, listType, err := DecodeFrom(bufio.NewReader(f), true)
if err != nil {
t.Fatal(err)
}

if listType != MASTER {
t.Error("Input not recognized as master playlist.")
}
pp := p.(*MasterPlaylist)

alt0 := pp.Variants[0].Alternatives[0]
if alt0.Type != "AUDIO" {
t.Error("Expected AUDIO track in test input Alternatives[0]")
}

if alt0.Channels != 2 {
t.Error("Expected 2 channels track in test input Alternatives[0]")
}

alt1 := pp.Variants[0].Alternatives[1]
if alt1.Type != "AUDIO" {
t.Error("Expected AUDIO track in test input Alternatives[1]")
}

if alt1.Channels != 6 {
t.Error("Expected 6 channels track in test input Alternatives[1]")
}
}

/****************
* Benchmarks *
****************/
Expand Down

0 comments on commit 9eaf349

Please sign in to comment.