From ca4b3beb5a77543fb268659ffc0b4d6ef444c93a Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Fri, 15 Apr 2011 19:03:35 +0000 Subject: [PATCH] Test program usability fixes --- run-test.sh | 2 +- src/tests/plot_filter.c | 18 +++--------------- src/tests/zplot_filter.c | 16 ++-------------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/run-test.sh b/run-test.sh index b18a468..60d2d86 100755 --- a/run-test.sh +++ b/run-test.sh @@ -48,7 +48,7 @@ then exit 0 fi -run_test $* +run_test "$@" # kate: replace-trailing-space-save true; space-indent true; tab-width 4; # vim: expandtab:ts=4:sw=4 diff --git a/src/tests/plot_filter.c b/src/tests/plot_filter.c index fdba6a3..a8f0913 100644 --- a/src/tests/plot_filter.c +++ b/src/tests/plot_filter.c @@ -1,6 +1,6 @@ /* libiir/src/tests/plot_filter.c * - * Copyright: ©2010, Laurence Withers. + * Copyright: ©2010–2011, Laurence Withers. * Author: Laurence Withers * License: GPLv3 */ @@ -50,18 +50,7 @@ do_plot(const char* filter_desc, double samp_rat, const char* png_filename) "set output '%s'\n" "set multiplot layout 2,1 title \"Bode plot for filter '", png_filename); - ret = 0; - while(*filter_desc) { - if(isspace(*filter_desc)) { - if(!ret) { - ret = 1; - putc('\n', fp); - } - } else { - putc(*filter_desc, fp); - } - ++filter_desc; - } + fputs(strstr(filter_desc, "raw") ? "raw" : filter_desc, fp); fprintf(fp, "' at %fHz\"\n" "set grid\n" "set logscale\n" @@ -209,7 +198,7 @@ main(int argc, char* argv[]) /* process commandline arguments */ if(argc == 2 && !strcmp(argv[1], "--print-summary")) { - fputs("Generates Bode plot for a filter.\n", stdout); + fputs("Generates Bode plot for a filter (simulation method).\n", stdout); return 0; } @@ -266,6 +255,5 @@ main(int argc, char* argv[]) /* options for text editors -kate: replace-trailing-space-save true; space-indent true; tab-width 4; vim: expandtab:ts=4:sw=4 */ diff --git a/src/tests/zplot_filter.c b/src/tests/zplot_filter.c index d49ed9a..c905c98 100644 --- a/src/tests/zplot_filter.c +++ b/src/tests/zplot_filter.c @@ -51,18 +51,7 @@ do_plot(const char* filter_desc, double samp_rat, const char* png_filename) "set output '%s'\n" "set multiplot layout 2,1 title \"Bode plot for filter '", png_filename); - ret = 0; - while(*filter_desc) { - if(isspace(*filter_desc)) { - if(!ret) { - ret = 1; - putc('\n', fp); - } - } else { - putc(*filter_desc, fp); - } - ++filter_desc; - } + fputs(strstr(filter_desc, "raw") ? "raw" : filter_desc, fp); fprintf(fp, "' at %fHz\"\n" "set grid\n" "set logscale\n" @@ -142,7 +131,7 @@ main(int argc, char* argv[]) /* process commandline arguments */ if(argc == 2 && !strcmp(argv[1], "--print-summary")) { - fputs("Generates Bode plot for a filter.\n", stdout); + fputs("Generates Bode plot for a filter (Z transform method).\n", stdout); return 0; } @@ -201,6 +190,5 @@ main(int argc, char* argv[]) /* options for text editors -kate: replace-trailing-space-save true; space-indent true; tab-width 4; vim: expandtab:ts=4:sw=4 */