]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/tests/lib/totals.py
more misc test coverage
[bluechips.git] / bluechips / tests / lib / totals.py
1 from unittest import TestCase
2 from bluechips.lib import totals
3
4 class TestReorderingSettle(TestCase):
5     def test(self):
6         """
7         Test that the number of transfers is actually minimized.
8
9         Taken from a real-world situation, we discovered that failing
10         to re-order the debt lists after every transfer could lead to
11         extra, unnecessary transfers.
12         """
13         self.assertEqual(len(totals.settle({'Alice': 100,
14                                             'Bob': -85,
15                                             'Charlie': 35,
16                                             'Dave': -35,
17                                             'Eve': -15})),
18                          3)