1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import unittest
from sources import merging_tables
class MyTestCase(unittest.TestCase):
def test1(self):
counts = [1, 1, 1, 1, 1]
db = merging_tables.Database(counts)
db.merge(4, 2)
self.assertEqual(2, db.max_row_count)
db.merge(3, 1)
self.assertEqual(2, db.max_row_count)
db.merge(3, 0)
self.assertEqual(3, db.max_row_count)
db.merge(3, 4)
self.assertEqual(5, db.max_row_count)
db.merge(2, 4)
self.assertEqual(5, db.max_row_count)
def test2(self):
counts = [10, 0, 5, 0, 3, 3]
db = merging_tables.Database(counts)
db.merge(5, 5)
self.assertEqual(10, db.max_row_count)
db.merge(4, 5)
self.assertEqual(10, db.max_row_count)
db.merge(3, 4)
self.assertEqual(10, db.max_row_count)
db.merge(2, 3)
self.assertEqual(11, db.max_row_count)
if __name__ == '__main__':
unittest.main()
|