aboutsummaryrefslogtreecommitdiff
path: root/src/auction/test_auction_create.sh
diff options
context:
space:
mode:
authorMarkus Teich <teichm@fs.tum.de>2017-01-12 20:17:35 +0100
committerMarkus Teich <teichm@fs.tum.de>2017-01-12 20:18:09 +0100
commitcdb78737878d73db365e2af9be5729d39fbab2bb (patch)
tree4e736f385b26d12d1ea9ddb775d0d292494fbaa1 /src/auction/test_auction_create.sh
parent9006be70fd75641136a5a230f613498d5082bb3d (diff)
downloadgnunet-cdb78737878d73db365e2af9be5729d39fbab2bb.tar.gz
gnunet-cdb78737878d73db365e2af9be5729d39fbab2bb.zip
auction: add test for auction-create
Diffstat (limited to 'src/auction/test_auction_create.sh')
-rwxr-xr-xsrc/auction/test_auction_create.sh80
1 files changed, 80 insertions, 0 deletions
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 @@
1#! /bin/sh
2
3trap 'rm -f test.json' EXIT
4
5
6# missing required cmdline args
7gnunet-auction-create -r 1 -d foo -p test.json && exit 1
8gnunet-auction-create -s 1 -d foo -p test.json && exit 1
9gnunet-auction-create -s 1 -r 1 -p test.json && exit 1
10gnunet-auction-create -s 1 -r 1 -d foo && exit 1
11
12
13# no pricemap
14rm -f test.json
15gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
16
17
18# json errors
19cat <<DOG >test.json
20[,]
21DOG
22gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
23
24cat <<DOG >test.json
25bla
26DOG
27gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
28
29
30# unexpected structures
31cat <<DOG >test.json
32{"foo": "bar"}
33DOG
34gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
35
36cat <<DOG >test.json
37{"currency": "foo"}
38DOG
39gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
40
41cat <<DOG >test.json
42{"prices": []}
43DOG
44gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
45
46cat <<DOG >test.json
47{"currency": "foo", "prices": "bar"}
48DOG
49gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
50
51
52# wrong array content
53cat <<DOG >test.json
54{"currency": "foo", "prices": []}
55DOG
56gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
57
58cat <<DOG >test.json
59{"currency": "foo", "prices": ["bar"]}
60DOG
61gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
62
63cat <<DOG >test.json
64{"currency": "foo", "prices": [null]}
65DOG
66gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
67
68cat <<DOG >test.json
69{"currency": "foo", "prices": [1, 2]}
70DOG
71gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1
72
73
74# correct example
75cat <<DOG >test.json
76{"currency": "foo", "prices": [2, 1]}
77DOG
78gnunet-auction-create -s 1 -r 1 -d foo -p test.json || exit 1
79
80rm -f test.json