diff options
-rw-r--r-- | tests/test_opus_api.c | 20 | ||||
-rw-r--r-- | tests/test_opus_decode.c | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c index 98dab2ef..2b467810 100644 --- a/tests/test_opus_api.c +++ b/tests/test_opus_api.c @@ -147,6 +147,8 @@ opus_int32 test_dec_api(void) fprintf(stdout," opus_decoder_create() ........................ OK.\n"); fprintf(stdout," opus_decoder_init() .......................... OK.\n"); + err=opus_decoder_ctl(dec, OPUS_GET_FINAL_RANGE((opus_uint32 *)NULL)); + if(err != OPUS_BAD_ARG)test_failed(); VG_UNDEF(&dec_final_range,sizeof(dec_final_range)); err=opus_decoder_ctl(dec, OPUS_GET_FINAL_RANGE(&dec_final_range)); if(err!=OPUS_OK)test_failed(); @@ -159,12 +161,22 @@ opus_int32 test_dec_api(void) fprintf(stdout," OPUS_UNIMPLEMENTED ........................... OK.\n"); cfgs++; + err=opus_decoder_ctl(dec, OPUS_GET_BANDWIDTH((opus_int32 *)NULL)); + if(err != OPUS_BAD_ARG)test_failed(); VG_UNDEF(&i,sizeof(i)); err=opus_decoder_ctl(dec, OPUS_GET_BANDWIDTH(&i)); if(err != OPUS_OK || i!=0)test_failed(); fprintf(stdout," OPUS_GET_BANDWIDTH ........................... OK.\n"); cfgs++; + err=opus_decoder_ctl(dec, OPUS_GET_SAMPLE_RATE((opus_int32 *)NULL)); + if(err != OPUS_BAD_ARG)test_failed(); + VG_UNDEF(&i,sizeof(i)); + err=opus_decoder_ctl(dec, OPUS_GET_SAMPLE_RATE(&i)); + if(err != OPUS_OK || i!=48000)test_failed(); + fprintf(stdout," OPUS_GET_SAMPLE_RATE ......................... OK.\n"); + cfgs++; + /*GET_PITCH has different execution paths depending on the previously decoded frame.*/ err=opus_decoder_ctl(dec, OPUS_GET_PITCH(nullvalue)); if(err!=OPUS_BAD_ARG)test_failed(); @@ -190,6 +202,14 @@ opus_int32 test_dec_api(void) cfgs++; fprintf(stdout," OPUS_GET_PITCH ............................... OK.\n"); + err=opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION((opus_int32 *)NULL)); + if(err != OPUS_BAD_ARG)test_failed(); + VG_UNDEF(&i,sizeof(i)); + err=opus_decoder_ctl(dec, OPUS_GET_LAST_PACKET_DURATION(&i)); + if(err != OPUS_OK || i!=960)test_failed(); + cfgs++; + fprintf(stdout," OPUS_GET_LAST_PACKET_DURATION ................ OK.\n"); + VG_UNDEF(&i,sizeof(i)); err=opus_decoder_ctl(dec, OPUS_GET_GAIN(&i)); VG_CHECK(&i,sizeof(i)); diff --git a/tests/test_opus_decode.c b/tests/test_opus_decode.c index 58c477bb..44a0ae52 100644 --- a/tests/test_opus_decode.c +++ b/tests/test_opus_decode.c @@ -111,6 +111,10 @@ int test_decoder_code0(int no_fuzz) if(opus_decoder_ctl(dec[t], OPUS_GET_LAST_PACKET_DURATION(&dur))!=OPUS_OK)test_failed(); if(dur!=120/factor)test_failed(); + /*Test on a size which isn't a multiple of 2.5ms*/ + out_samples = opus_decode(dec[t], 0, 0, outbuf, 120/factor+2, fec); + if(out_samples!=OPUS_BAD_ARG)test_failed(); + /*Test null pointer input*/ out_samples = opus_decode(dec[t], 0, -1, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); |