History

Add new test tests/downsample_test.c and hook into build.

Erik de Castro Lopo committed 18 years ago

Commit a2236761 parent 6328b632 files · +62 −1Browse files

Unified · Split

2 files
  1. tests/Makefile.am +5 −1
  2. tests/downsample_test.c +57 −0
tests/Makefile.am+5−1
@@ -1,7 +1,7 @@
11 noinst_PROGRAMS = misc_test termination_test simple_test callback_test \
22 reset_test multi_channel_test snr_bw_test \
33 float_short_test varispeed_test callback_hang_test \
4− src-evaluate throughput_test
4+ src-evaluate throughput_test downsample_test
55
66 SAMPLRATEDIR =../src
77 INCLUDES = -I$(srcdir)/$(SAMPLRATEDIR)
@@ -39,6 +39,9 @@ callback_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la · 31 unmodified lines
3939 float_short_test_SOURCES = float_short_test.c util.c util.h
4040 float_short_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la
4141
42+downsample_test_SOURCES = downsample_test.c util.c util.h
43+downsample_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la
44+
4245 varispeed_test_SOURCES = varispeed_test.c util.c util.h calc_snr.c
4346 varispeed_test_CFLAGS = @FFTW3_CFLAGS@
4447 varispeed_test_LDADD = $(SAMPLRATEDIR)/libsamplerate.la $(FFTW3_LIBS)
@@ -61,6 +64,7 @@ check: $(noinst_PROGRAMS) · 16 unmodified lines
6164 ./misc_test
6265 ./termination_test
6366 ./callback_hang_test
67+ ./downsample_test
6468 ./simple_test
6569 ./callback_test
6670 ./reset_test
tests/downsample_test.c+57−0
@@ -0,0 +1,57 @@
1+/*
2+** Copyright (C) 2008 Erik de Castro Lopo <erikd@mega-nerd.com>
3+**
4+** This program is free software; you can redistribute it and/or modify
5+** it under the terms of the GNU General Public License as published by
6+** the Free Software Foundation; either version 2 of the License, or
7+** (at your option) any later version.
8+**
9+** This program is distributed in the hope that it will be useful,
10+** but WITHOUT ANY WARRANTY; without even the implied warranty of
11+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+** GNU General Public License for more details.
13+**
14+** You should have received a copy of the GNU General Public License
15+** along with this program; if not, write to the Free Software
16+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17+*/
18+
19+#include <stdio.h>
20+#include <samplerate.h>
21+
22+#include "util.h"
23+
24+static void
25+downsample_test (int converter)
26+{ static float in [1000], out[10] ;
27+ SRC_DATA data ;
28+
29+ printf (" downsample_test (%-28s) ....... ", src_get_name (converter)) ;
30+ fflush (stdout) ;
31+
32+ data.src_ratio = 1.0 / 255.0 ;
33+ data.input_frames = ARRAY_LEN (in) ;
34+ data.output_frames = ARRAY_LEN (out) ;
35+ data.data_in = in ;
36+ data.data_out = out ;
37+
38+ src_simple (&data, converter, 1) ;
39+
40+ puts ("ok") ;
41+} /* downsample_test */
42+
43+int
44+main (void)
45+{
46+ puts ("") ;
47+
48+ downsample_test (SRC_ZERO_ORDER_HOLD) ;
49+ downsample_test (SRC_LINEAR) ;
50+ downsample_test (SRC_SINC_FASTEST) ;
51+ downsample_test (SRC_SINC_MEDIUM_QUALITY) ;
52+ downsample_test (SRC_SINC_BEST_QUALITY) ;
53+
54+ puts ("") ;
55+
56+ return 0 ;
57+} /* main */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t