]> Sergey Matveev's repositories - go-opus.git/commitdiff
More samples in encode/decode unit test
authorHraban Luyat <hraban@0brg.net>
Sun, 8 Mar 2015 22:48:22 +0000 (22:48 +0000)
committerHraban Luyat <hraban@0brg.net>
Sun, 8 Mar 2015 22:50:18 +0000 (22:50 +0000)
opus_test.go

index c6ad59f31639885c0a2ad0e01bdac45d8e7cccbc..549aaae29ef60f6212694521cf6714bee3a8ef0e 100644 (file)
@@ -45,7 +45,7 @@ func TestCodecFloat32(t *testing.T) {
        // Create bogus input sound
        const G4 = 391.995
        const SAMPLE_RATE = 48000
-       const FRAME_SIZE_MS = 10
+       const FRAME_SIZE_MS = 60
        const FRAME_SIZE = SAMPLE_RATE * FRAME_SIZE_MS / 1000
        pcm := make([]float32, FRAME_SIZE)
        enc, err := NewEncoder(SAMPLE_RATE, 1, APPLICATION_VOIP)
@@ -65,7 +65,10 @@ func TestCodecFloat32(t *testing.T) {
        if err != nil {
                t.Fatalf("Couldn't decode data: %v", err)
        }
-       // TODO: Well, since this is lossy, checking the output signal is not
-       // straightforward.. I guess a FFT could work?
-       _ = pcm2
+       if len(pcm) != len(pcm2) {
+               t.Fatalf("Length mismatch: %d samples in, %d out", len(pcm), len(pcm2))
+       }
+       // Checking the output programmatically is seriously not easy. I checked it
+       // by hand and by ear, it looks fine. I'll just assume the API faithfully
+       // passes error codes through, and that's that.
 }