summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-11-25 23:53:15 -0500
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-11-25 23:53:15 -0500
commite699c1989c88fcff8c4bcf0f073966094be2d2cc (patch)
treec9107793fcdd8a9a6e8650db248955a63bdfc0d0 /tests
parent10ebc02ecf20d81502995fa92c58dc136ddff45a (diff)
downloadopus-e699c1989c88fcff8c4bcf0f073966094be2d2cc.tar.gz
Testing tools improvements (no impact on draft)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_opus_api.c15
-rw-r--r--tests/test_opus_decode.c13
-rw-r--r--tests/test_opus_encode.c11
3 files changed, 32 insertions, 7 deletions
diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c
index 86cc4a42..7e2236f8 100644
--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -92,8 +92,8 @@ opus_int32 test_dec_api(void)
#endif
short sbuf[960*2];
int c,err;
- int *nullptr;
- nullptr=0;
+ int *nullvalue;
+ nullvalue=0;
cfgs=0;
/*First test invalid configurations which should fail*/
@@ -163,7 +163,7 @@ opus_int32 test_dec_api(void)
cfgs++;
/*GET_PITCH has different execution paths depending on the previously decoded frame.*/
- err=opus_decoder_ctl(dec, OPUS_GET_PITCH(nullptr));
+ err=opus_decoder_ctl(dec, OPUS_GET_PITCH(nullvalue));
if(err!=OPUS_BAD_ARG)test_failed();
cfgs++;
VG_UNDEF(&i,sizeof(i));
@@ -297,8 +297,11 @@ opus_int32 test_msdec_api(void)
#endif
short sbuf[960*2];
int a,b,c,err;
- int *nullptr;
- nullptr=0;
+#if 0
+ /*Relevant test not enabled for multistream*/
+ int *nullvalue;
+ nullvalue=0;
+#endif
cfgs=0;
/*First test invalid configurations which should fail*/
@@ -414,7 +417,7 @@ opus_int32 test_msdec_api(void)
fprintf(stdout," OPUS_GET_BANDWIDTH ........................... OK.\n");
cfgs++;
/*GET_PITCH has different execution paths depending on the previously decoded frame.*/
- err=opus_multistream_decoder_ctl(dec, OPUS_GET_PITCH(nullptr));
+ err=opus_multistream_decoder_ctl(dec, OPUS_GET_PITCH(nullvalue));
if(err!=OPUS_BAD_ARG)test_failed();
cfgs++;
VG_UNDEF(&i,sizeof(i));
diff --git a/tests/test_opus_decode.c b/tests/test_opus_decode.c
index b7fa26e8..b2f78e31 100644
--- a/tests/test_opus_decode.c
+++ b/tests/test_opus_decode.c
@@ -91,7 +91,7 @@ int test_decoder_code0(void)
}
}
- decsize=opus_decoder_get_size(2);
+ decsize=opus_decoder_get_size(1);
decbak=(OpusDecoder *)malloc(decsize);
if(decbak==NULL)test_failed();
@@ -335,19 +335,30 @@ int test_decoder_code0(void)
int main(int _argc, char **_argv)
{
const char * oversion;
+ const char * env_seed;
+ int env_used;
+
if(_argc>2)
{
fprintf(stderr,"Usage: %s [<seed>]\n",_argv[0]);
return 1;
}
+ env_used=0;
+ env_seed=getenv("SEED");
if(_argc>1)iseed=atoi(_argv[1]);
+ else if(env_seed)
+ {
+ iseed=atoi(env_seed);
+ env_used=1;
+ }
else iseed=(opus_uint32)time(NULL)^((getpid()&65535)<<16);
Rw=Rz=iseed;
oversion=opus_get_version_string();
if(!oversion)test_failed();
fprintf(stderr,"Testing %s decoder. Random seed: %u (%.4X)\n", oversion, iseed, fast_rand() % 65535);
+ if(env_used)fprintf(stderr," Random seed set from the environment (SEED=%s).\n", env_seed);
test_decoder_code0();
diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c
index 735d5438..315790c6 100644
--- a/tests/test_opus_encode.c
+++ b/tests/test_opus_encode.c
@@ -366,19 +366,30 @@ int run_test1(void)
int main(int _argc, char **_argv)
{
const char * oversion;
+ const char * env_seed;
+ int env_used;
+
if(_argc>2)
{
fprintf(stderr,"Usage: %s [<seed>]\n",_argv[0]);
return 1;
}
+ env_used=0;
+ env_seed=getenv("SEED");
if(_argc>1)iseed=atoi(_argv[1]);
+ else if(env_seed)
+ {
+ iseed=atoi(env_seed);
+ env_used=1;
+ }
else iseed=(opus_uint32)time(NULL)^((getpid()&65535)<<16);
Rw=Rz=iseed;
oversion=opus_get_version_string();
if(!oversion)test_failed();
fprintf(stderr,"Testing %s encoder. Random seed: %u (%.4X)\n", oversion, iseed, fast_rand() % 65535);
+ if(env_used)fprintf(stderr," Random seed set from the environment (SEED=%s).\n", env_seed);
run_test1();