gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 03/03: auction: add test for auction-create


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 03/03: auction: add test for auction-create
Date: Thu, 12 Jan 2017 20:18:42 +0100

This is an automated email from the git hooks/post-receive script.

mteich pushed a commit to branch master
in repository gnunet.

commit cdb78737878d73db365e2af9be5729d39fbab2bb
Author: Markus Teich <address@hidden>
AuthorDate: Thu Jan 12 20:17:35 2017 +0100

    auction: add test for auction-create
---
 src/auction/Makefile.am            | 37 +++++++++++-------
 src/auction/test_auction_create.sh | 80 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 15 deletions(-)

diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
index 8518244fa..0c250a0b4 100644
--- a/src/auction/Makefile.am
+++ b/src/auction/Makefile.am
@@ -5,6 +5,7 @@ pkgcfgdir= $(pkgdatadir)/config.d/
 
 libexecdir= $(pkglibdir)/libexec/
 
+
 dist_pkgcfg_DATA = \
   auction.conf
 
@@ -16,13 +17,22 @@ if USE_COVERAGE
   AM_CFLAGS = -fprofile-arcs -ftest-coverage
 endif
 
-# use bin_PROGRAMS for gnunet-auction wrapper script
 
 libexec_PROGRAMS = \
+ gnunet-service-auction
+
+gnunet_service_auction_SOURCES = \
+ gnunet-service-auction.c
+gnunet_service_auction_LDADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  -ljansson \
+  $(GN_LIBINTL)
+
+
+bin_PROGRAMS = \
  gnunet-auction-create \
  gnunet-auction-info \
- gnunet-auction-join \
- gnunet-service-auction
+ gnunet-auction-join
 
 gnunet_auction_create_SOURCES = \
  gnunet-auction-create.c
@@ -45,23 +55,20 @@ gnunet_auction_join_LDADD = \
   -ljansson \
   $(GN_LIBINTL)
 
-gnunet_service_auction_SOURCES = \
- gnunet-service-auction.c
-gnunet_service_auction_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  -ljansson \
-  $(GN_LIBINTL)
-
 
 check_PROGRAMS = \
  test_auction_api
 
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export 
GNUNET_PREFIX=$${GNUNET_PREFIX:address@hidden@};export 
PATH=$${GNUNET_PREFIX:address@hidden@}/bin:$$PATH;
-TESTS = $(check_PROGRAMS)
-endif
-
 test_auction_api_SOURCES = \
  test_auction_api.c
 test_auction_api_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la
+
+
+check_SCRIPTS = \
+ test_auction_create.sh
+
+if ENABLE_TEST_RUN
+AM_TESTS_ENVIRONMENT=export 
GNUNET_PREFIX=$${GNUNET_PREFIX:address@hidden@};export 
PATH=$${GNUNET_PREFIX:address@hidden@}/bin:$$PATH;
+TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+endif
diff --git a/src/auction/test_auction_create.sh 
b/src/auction/test_auction_create.sh
new file mode 100755
index 000000000..b0f4de738
--- /dev/null
+++ b/src/auction/test_auction_create.sh
@@ -0,0 +1,80 @@
+#! /bin/sh
+
+trap 'rm -f test.json' EXIT
+
+
+# missing required cmdline args
+gnunet-auction-create      -r 1 -d foo -p test.json && exit 1
+gnunet-auction-create -s 1      -d foo -p test.json && exit 1
+gnunet-auction-create -s 1 -r 1        -p test.json && exit 1
+gnunet-auction-create -s 1 -r 1 -d foo              && exit 1
+
+
+# no pricemap
+rm -f test.json
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+
+# json errors
+cat <<DOG >test.json
+[,]
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+bla
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+
+# unexpected structures
+cat <<DOG >test.json
+{"foo": "bar"}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"currency": "foo"}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"prices": []}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"currency": "foo", "prices": "bar"}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+
+# wrong array content
+cat <<DOG >test.json
+{"currency": "foo", "prices": []}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"currency": "foo", "prices": ["bar"]}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"currency": "foo", "prices": [null]}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+cat <<DOG >test.json
+{"currency": "foo", "prices": [1, 2]}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
+
+
+# correct example
+cat <<DOG >test.json
+{"currency": "foo", "prices": [2, 1]}
+DOG
+gnunet-auction-create -s 1 -r 1 -d foo -p test.json || exit 1
+
+rm -f test.json

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]