shithub: opus

Download patch

ref: 535efb0707307c9d74bdb8cdcee0b5dc0d409d6e
parent: 119d53c94d404b97c23939ae6babc1cb152a2a97
author: Gregory Maxwell <[email protected]>
date: Wed Dec 5 14:26:44 EST 2012

Add missing packet_get_nb_samples test coverage and fix test output.

--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -226,15 +226,20 @@
 
    VG_UNDEF(packet,sizeof(packet));
    packet[0]=0;
-   if(opus_packet_get_nb_samples(packet,1,48000)!=480)test_failed();
    if(opus_decoder_get_nb_samples(dec,packet,1)!=480)test_failed();
-   cfgs++;
+   if(opus_packet_get_nb_samples(packet,1,48000)!=480)test_failed();
+   if(opus_packet_get_nb_samples(packet,1,96000)!=960)test_failed();
+   if(opus_packet_get_nb_samples(packet,1,32000)!=320)test_failed();
+   if(opus_packet_get_nb_samples(packet,1,8000)!=80)test_failed();
+   packet[0]=3;
+   if(opus_packet_get_nb_samples(packet,1,24000)!=OPUS_INVALID_PACKET)test_failed();
    packet[0]=(63<<2)|3;
    packet[1]=63;
+   if(opus_packet_get_nb_samples(packet,0,24000)!=OPUS_BAD_ARG)test_failed();
    if(opus_packet_get_nb_samples(packet,2,48000)!=OPUS_INVALID_PACKET)test_failed();
    if(opus_decoder_get_nb_samples(dec,packet,2)!=OPUS_INVALID_PACKET)test_failed();
-   fprintf(stdout,"    opus_{packet,decoder}_get_nb_samples() ................ OK.\n");
-   cfgs++;
+   fprintf(stdout,"    opus_{packet,decoder}_get_nb_samples() ....... OK.\n");
+   cfgs+=9;
 
    if(OPUS_BAD_ARG!=opus_packet_get_nb_frames(packet,0))test_failed();
    for(i=0;i<256;i++) {