opus_test.go | 10 ++++++++++ diff --git a/opus_test.go b/opus_test.go index 5cc3adcbcf4728f958b9ded6c849b0c6f7f6e694..bdab063c6d98bdd0032125e9338ffd372f0b9445 100644 --- a/opus_test.go +++ b/opus_test.go @@ -38,6 +38,16 @@ t.Errorf("Expected error for illegal samplerate 12345") } } +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 {