go-pus/decoder_test.go
DataHoarder 6cc027f24d
Some checks failed
continuous-integration/drone/push Build is failing
Use libopusenc to encode stream, WiP: tests
2022-02-27 18:56:08 +01:00

33 lines
767 B
Go

// Copyright © 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)
}
}