def test_complicated4(self): s = [4, 1, 3, 5, 8, 11, 13, 2] n = 43 expect = {2, 4, 5, 8, 11, 13} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_duplicates(self): s = [4, 1, 1, 3, 5] n = 11 expect = {1, 4, 5} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_empty_result(self): s = [4, 2, 3, 5] n = 1 expect = set() msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_simple1(self): s = [4, 1, 3, 5] n = 7 expect = {3, 4} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_complicated3(self): s = [4, 1, 3, 5, 8, 11, 13, 2] n = 42 expect = {1, 2, 3, 4, 8, 11, 13} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_duplicates(self): s = [4, 1, 1, 3, 5] n = 11 expect = {1, 4, 5} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_empty_result(self): s = [4, 2, 3, 5] n = 1 expect = set() msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)
def test_simple1(self): s = [4, 1, 3, 5] n = 7 expect = {3, 4} msg = 'bug in test function: sum(%s)=%d > %d' % (str(expect), sum(expect), n) self.assertTrue(sum(expect) <= n, msg) found = pack(s, n) msg = 'pack(%s, %d) returned %s, expected %s' % (str(s), n, str(found), str(expect)) self.assertTrue(found == expect, msg)