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