tests =	\
	test1.output \
	test2.output \
	test3.output \
	test4.output

noinst_PROGRAMS = test-transfer
noinst_DATA = $(tests)

test_transfer_SOURCES =					\
	$(top_srcdir)/src/sglib/sg-util.c		\
	$(top_srcdir)/src/sglib/sg-util.h		\
	$(top_srcdir)/src/streamtuner/st-transfer-api.h	\
	$(top_srcdir)/src/streamtuner/st-transfer.c	\
	$(top_srcdir)/src/streamtuner/st-transfer.h	\
	test-transfer.c
test_transfer_LDFLAGS = $(GLIB_LIBS) $(CURL_LIBS)
test_transfer_CPPFLAGS = \
	$(WARN_CFLAGS) \
	$(GLIB_CFLAGS) $(CURL_CFLAGS) \
	-I$(top_srcdir)/src/sglib \
	-I$(top_srcdir)/src/streamtuner \
	-DST_REGRESSION_TEST

test1.output: test-transfer text.input
	./test-transfer -m normal file://`pwd`/text.input > test1.output
	@if cmp text.input test1.output > /dev/null; then echo "+++ TEST 1 PASSED"; else echo "--- TEST 1 FAILED"; exit 1; fi

test2.output: test-transfer binary.input
	./test-transfer -m binary file://`pwd`/binary.input > test2.output
	@if cmp binary.input test2.output > /dev/null; then echo "+++ TEST 2 PASSED"; else echo "--- TEST 2 FAILED"; exit 1; fi

test3.output: test-transfer text.input test3.expected
	./test-transfer -m line file://`pwd`/text.input > test3.output
	@if cmp test3.expected test3.output > /dev/null; then echo "+++ TEST 3 PASSED"; else echo "--- TEST 3 FAILED"; exit 1; fi

test4.output: test-transfer text.input test4.expected
	./test-transfer -n -m line file://`pwd`/text.input > test4.output
	@if cmp test4.expected test4.output > /dev/null; then echo "+++ TEST 4 PASSED"; else echo "--- TEST 4 FAILED"; exit 1; fi

MOSTLYCLEANFILES = $(tests)

EXTRA_DIST = \
	binary.input	\
	test3.expected	\
	test4.expected	\
	text.input
