aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-11-01 12:16:12 +0100
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-11-01 12:16:12 +0100
commit257d5b72b07d44bf59f81806ff8352a710a1ac2b (patch)
treed956578010630b0ee195b54f7427e951218dcf2c
parent37ac9545eb77ea968a98a29c695dd52ec04cd369 (diff)
downloadlibbrandt-257d5b72b07d44bf59f81806ff8352a710a1ac2b.tar.gz
libbrandt-257d5b72b07d44bf59f81806ff8352a710a1ac2b.zip
test for no bidders
-rw-r--r--brandt.c2
-rw-r--r--test_brandt.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/brandt.c b/brandt.c
index 337de57..dab0ad2 100644
--- a/brandt.c
+++ b/brandt.c
@@ -107,7 +107,7 @@ seller_start (void *arg)
107 if (0 == (ad->n = ad->start (ad->closure))) 107 if (0 == (ad->n = ad->start (ad->closure)))
108 { 108 {
109 weprintf ("no bidders registered for auction"); 109 weprintf ("no bidders registered for auction");
110 /** todo: somehow mark auction as done / ready for cleanup */ 110 ad->result (ad->closure, NULL, 0);
111 return; 111 return;
112 } 112 }
113 113
diff --git a/test_brandt.c b/test_brandt.c
index 0db012c..04226f0 100644
--- a/test_brandt.c
+++ b/test_brandt.c
@@ -65,6 +65,9 @@ expected_outcome (uint16_t i)
65 uint16_t winners = MIN (tcase.m, tcase.n); 65 uint16_t winners = MIN (tcase.m, tcase.n);
66 uint16_t cur_winner = 0; 66 uint16_t cur_winner = 0;
67 67
68 if (0 == tcase.n)
69 return NULL;
70
68 if (0 == tcase.m) 71 if (0 == tcase.m)
69 { 72 {
70 for (uint16_t h = 0; h < tcase.n; h++) 73 for (uint16_t h = 0; h < tcase.n; h++)
@@ -379,6 +382,10 @@ main (int argc, char *argv[])
379 BRANDT_init (edc); 382 BRANDT_init (edc);
380 383
381 ret |= 0 || 384 ret |= 0 ||
385 test_auction (0, 2, NULL, 0, 0) ||
386 test_auction (0, 2, NULL, 0, 1) ||
387 test_auction (0, 2, NULL, 1, 0) ||
388 test_auction (0, 2, NULL, 2, 0) ||
382 test_auction (2, 2, (uint16_t[]) { 1, 0 }, 1, 0) || 389 test_auction (2, 2, (uint16_t[]) { 1, 0 }, 1, 0) ||
383 test_auction (3, 2, (uint16_t[]) { 0, 0, 1 }, 2, 0) || 390 test_auction (3, 2, (uint16_t[]) { 0, 0, 1 }, 2, 0) ||
384 test_auction (3, 2, (uint16_t[]) { 0, 1, 1 }, 0, 0) || 391 test_auction (3, 2, (uint16_t[]) { 0, 1, 1 }, 0, 0) ||