Skip to content

Commit

Permalink
Add some tests for MultiTrackBlockSorter (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat authored Apr 21, 2021
1 parent 4bf7a63 commit eb16ccf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mkvcore/framebuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func TestFrameBuffer(t *testing.T) {
t.Errorf("Pop() must return nil if empty, expected: nil, got %v", h)
}

if f := buf.Tail(); f != nil {
t.Errorf("Tail() must return nil if empty, expected: nil, got %v", f)
}

if n := buf.Size(); n != 0 {
t.Errorf("Size() must return 0 at beginning, got %d", n)
}
Expand All @@ -46,6 +50,9 @@ func TestFrameBuffer(t *testing.T) {
if h := buf.Head(); !reflect.DeepEqual(*h, frames[0]) {
t.Errorf("Head() must return first frame, expected: %v, got %v", frames[0].trackNumber, *h)
}
if f := buf.Tail(); !reflect.DeepEqual(*f, frames[1]) {
t.Errorf("Tail() must return last frame, expected: %v, got %v", frames[1].trackNumber, *f)
}

if h := buf.Pop(); !reflect.DeepEqual(*h, frames[0]) {
t.Errorf("Pop() must return first frame, expected: %v, got %v", frames[0].trackNumber, *h)
Expand Down
8 changes: 8 additions & 0 deletions mkvcore/interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ func TestMultiTrackBlockSorter_FailingOptions(t *testing.T) {
},
err: errDummy,
},
"ErroredOption": {
opts: []MultiTrackBlockSorterOption{
func(*MultiTrackBlockSorterOptions) error {
return errDummy
},
},
err: errDummy,
},
}

for name, c := range cases {
Expand Down

0 comments on commit eb16ccf

Please sign in to comment.