diff options
Diffstat (limited to 'test_brandt.c')
-rw-r--r-- | test_brandt.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test_brandt.c b/test_brandt.c index 1fb985c..46ec90d 100644 --- a/test_brandt.c +++ b/test_brandt.c @@ -84,6 +84,29 @@ expected_outcome (uint16_t i) return ret; } + /* fewer bidders than needed -> everyone wins with lowest price */ + if (tcase.n <= tcase.m) + { + if (tcase.outcome_public || i == tcase.n) + { + ret = GNUNET_new_array (tcase.n, struct BRANDT_Result); + for (uint16_t h = 0; h < tcase.n; h++) + { + ret[h].bidder = h; + ret[h].price = 0; + ret[h].status = BRANDT_bidder_won; + } + } + else + { + ret = GNUNET_new (struct BRANDT_Result); + ret->bidder = i; + ret->price = 0; + ret->status = BRANDT_bidder_won; + } + return ret; + } + /* find M+1st highest bidder to determine selling price */ for (uint16_t h = 0; h < tcase.n; h++) if (tcase.bids[h] > mpf_highest_bid) @@ -387,6 +410,9 @@ main (int argc, char *argv[]) test_auction (0, 2, NULL, 0, 1) || test_auction (0, 2, NULL, 1, 0) || test_auction (0, 2, NULL, 2, 0) || + test_auction (1, 2, (uint16_t[]) { 1 }, 1, 0) || + test_auction (1, 2, (uint16_t[]) { 0 }, 2, 0) || + test_auction (2, 2, (uint16_t[]) { 1, 0 }, 2, 0) || test_auction (2, 2, (uint16_t[]) { 1, 0 }, 1, 0) || test_auction (3, 2, (uint16_t[]) { 0, 0, 1 }, 2, 0) || test_auction (3, 2, (uint16_t[]) { 0, 1, 1 }, 0, 0) || |