From 62f21d8d5736247a8e786ef90e9dfaf76283a747 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Tue, 6 Dec 2011 00:44:47 +0800 Subject: [PATCH] Some tweaks to spandsp tests --- libs/spandsp/tests/v18_tests.c | 9 ++++----- libs/spandsp/tests/v22bis_tests.c | 11 ++++++++--- libs/spandsp/tests/v8_tests.c | 9 ++++----- libs/spandsp/tests/vector_int_tests.c | 4 ---- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index d6465fe21a..1666ce96a1 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -228,7 +228,6 @@ static int test_x_06(void) char dtmf[1024]; char result[1024]; const char *ref; - int len; int i; /* III.5.4.5.6 DTMF character conversion */ @@ -237,14 +236,14 @@ static int test_x_06(void) msg[127] = '\0'; printf("%s\n", msg); - len = v18_encode_dtmf(NULL, dtmf, msg); + v18_encode_dtmf(NULL, dtmf, msg); printf("%s\n", dtmf); - len = v18_decode_dtmf(NULL, result, dtmf); + v18_decode_dtmf(NULL, result, dtmf); ref = "\b \n\n\n?\n\n\n %+().+,-.0123456789:;(=)" - "?XABCDEFGHIJKLMNOPQRSTUVWXYZĈĜĊ" - " abcdefghijklmnopqrstuvwxyzĉĝċ \b"; + "?XABCDEFGHIJKLMNOPQRSTUVWXYZ\xC6\xD8\xC5" + " abcdefghijklmnopqrstuvwxyz\xE6\xF8\xE5 \b"; printf("Result:\n%s\n", result); printf("Reference result:\n%s\n", ref); diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index 3f47d61843..f1527a4c91 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -224,6 +224,7 @@ int main(int argc, char *argv[]) int log_audio; int channel_codec; int rbs_pattern; + int guard_tone_option; int opt; channel_codec = MUNGE_CODEC_NONE; @@ -234,8 +235,9 @@ int main(int argc, char *argv[]) noise_level = -70; signal_level = -13; bits_per_test = 50000; + guard_tone_option = V22BIS_GUARD_TONE_1800HZ; log_audio = FALSE; - while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:")) != -1) + while ((opt = getopt(argc, argv, "b:B:c:d:gG:lm:n:r:s:")) != -1) { switch (opt) { @@ -264,6 +266,9 @@ int main(int argc, char *argv[]) exit(2); #endif break; + case 'G': + guard_tone_option = atoi(optarg); + break; case 'l': log_audio = TRUE; break; @@ -309,7 +314,7 @@ int main(int argc, char *argv[]) for (i = 0; i < 2; i++) { - endpoint[i].v22bis = v22bis_init(NULL, test_bps, V22BIS_GUARD_TONE_1800HZ, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]); + endpoint[i].v22bis = v22bis_init(NULL, test_bps, guard_tone_option, (i == 0), v22bis_getbit, &endpoint[i], v22bis_putbit, &endpoint[i]); v22bis_tx_power(endpoint[i].v22bis, signal_level); /* Move the carrier off a bit */ endpoint[i].v22bis->tx.carrier_phase_rate = dds_phase_ratef((i == 0) ? 1207.0f : 2407.0f); @@ -420,7 +425,7 @@ int main(int argc, char *argv[]) } if (log_audio) { - if (sf_close_telephony(outhandle) != 0) + if (sf_close_telephony(outhandle)) { fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME); exit(2); diff --git a/libs/spandsp/tests/v8_tests.c b/libs/spandsp/tests/v8_tests.c index 0f3ee358ba..35f1eb20e5 100644 --- a/libs/spandsp/tests/v8_tests.c +++ b/libs/spandsp/tests/v8_tests.c @@ -514,7 +514,6 @@ int main(int argc, char *argv[]) { int16_t amp[SAMPLES_PER_CHUNK]; int samples; - int remnant; int caller_available_modulations; int answerer_available_modulations; SNDFILE *inhandle; @@ -622,10 +621,10 @@ int main(int argc, char *argv[]) while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK))) { - remnant = v8_rx(v8_caller, amp, samples); - remnant = v8_rx(v8_answerer, amp, samples); - remnant = v8_tx(v8_caller, amp, samples); - remnant = v8_tx(v8_answerer, amp, samples); + v8_rx(v8_caller, amp, samples); + v8_rx(v8_answerer, amp, samples); + v8_tx(v8_caller, amp, samples); + v8_tx(v8_answerer, amp, samples); } /*endwhile*/ diff --git a/libs/spandsp/tests/vector_int_tests.c b/libs/spandsp/tests/vector_int_tests.c index 53f0b07949..1b0aa309c1 100644 --- a/libs/spandsp/tests/vector_int_tests.c +++ b/libs/spandsp/tests/vector_int_tests.c @@ -110,15 +110,11 @@ static int test_vec_min_maxi16(void) int32_t za; int32_t zb; int16_t x[99]; - int16_t y[99]; int16_t outa[2]; int16_t outb[2]; for (i = 0; i < 99; i++) - { x[i] = rand(); - y[i] = rand(); - } x[42] = -32768; za = vec_min_maxi16_dumb(x, 99, outa);