From: Hraban Luyat Date: Sun, 5 Jul 2015 11:35:02 +0000 (+0100) Subject: Unit test for opus error string X-Git-Tag: v2.0.0~109 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a25a70a18b51120f151e4cfed2eaca036965d244;p=go-opus.git Unit test for opus error string --- diff --git a/opus_test.go b/opus_test.go index 5cc3adc..bdab063 100644 --- a/opus_test.go +++ b/opus_test.go @@ -38,6 +38,16 @@ func TestDecoderNew(t *testing.T) { } } +func TestOpuserr(t *testing.T) { + // I scooped this -1 up from opus_defines.h, it's OPUS_BAD_ARG. Not pretty, + // but it's better than not testing at all. Again, accessing #defines from + // CGO is not possible. + err := opuserr(-1) + if err.Error() != "opus: invalid argument" { + t.Errorf("Expected \"invalid argument\" error message for error code -1: %v") + } +} + func addSineFloat32(buf []float32, sampleRate int, freq float64) { factor := 2 * math.Pi * freq / float64(sampleRate) for i := range buf {