From a25a70a18b51120f151e4cfed2eaca036965d244 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sun, 5 Jul 2015 12:35:02 +0100 Subject: [PATCH] Unit test for opus error string --- opus_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 { -- 2.48.1