From b76ffc1883c8d7fb0fc0389fceb0d67864cec1ec Mon Sep 17 00:00:00 2001 From: hori-ryota Date: Tue, 5 Jul 2016 09:15:50 +0900 Subject: [PATCH] Add test --- writer_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/writer_test.go b/writer_test.go index be124dc9..cd86f3ee 100644 --- a/writer_test.go +++ b/writer_test.go @@ -620,6 +620,46 @@ func ExampleMediaPlaylist_String() { // test01.ts } +// Create new media playlist +// Add two segments to media playlist +// Print it +func ExampleMediaPlaylist_String_Winsize0() { + p, _ := NewMediaPlaylist(0, 2) + p.Append("test01.ts", 5.0, "") + p.Append("test02.ts", 6.0, "") + fmt.Printf("%s\n", p) + // Output: + // #EXTM3U + // #EXT-X-VERSION:3 + // #EXT-X-MEDIA-SEQUENCE:0 + // #EXT-X-TARGETDURATION:6 + // #EXTINF:5.000, + // test01.ts + // #EXTINF:6.000, + // test02.ts +} + +// Create new media playlist +// Add two segments to media playlist +// Print it +func ExampleMediaPlaylist_String_Winsize0_VOD() { + p, _ := NewMediaPlaylist(0, 2) + p.Append("test01.ts", 5.0, "") + p.Append("test02.ts", 6.0, "") + p.Close() + fmt.Printf("%s\n", p) + // Output: + // #EXTM3U + // #EXT-X-VERSION:3 + // #EXT-X-MEDIA-SEQUENCE:0 + // #EXT-X-TARGETDURATION:6 + // #EXTINF:5.000, + // test01.ts + // #EXTINF:6.000, + // test02.ts + // #EXT-X-ENDLIST +} + // Create new master playlist // Add media playlist // Encode structures to HLS