forked from hraban/opus
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdecoder_test.go
More file actions
32 lines (28 loc) · 777 Bytes
/
decoder_test.go
File metadata and controls
32 lines (28 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright © 2015-2017 Go Opus Authors (see AUTHORS file)
//
// License for use of this code is detailed in the LICENSE file
package opus
import (
"testing"
)
func TestDecoderNew(t *testing.T) {
dec, err := NewDecoder(48000, 1)
if err != nil || dec == nil {
t.Errorf("Error creating new decoder: %v", err)
}
dec, err = NewDecoder(12345, 1)
if err == nil || dec != nil {
t.Errorf("Expected error for illegal samplerate 12345")
}
}
func TestDecoderUnitialized(t *testing.T) {
var dec Decoder
_, err := dec.Decode(nil, nil)
if err != errDecUninitialized {
t.Errorf("Expected \"unitialized decoder\" error: %v", err)
}
_, err = dec.DecodeFloat32(nil, nil)
if err != errDecUninitialized {
t.Errorf("Expected \"unitialized decoder\" error: %v", err)
}
}