interactive-coding-challenges/online_judges/assign_cookies/test_assign_cookie.py

25 lines
780 B
Python
Raw Normal View History

import unittest
2017-03-29 16:36:40 +08:00
class TestAssignCookie(unittest.TestCase):
2017-03-29 16:36:40 +08:00
def test_assign_cookie(self):
solution = Solution()
self.assertRaises(TypeError, solution.find_content_children, None, None)
self.assertEqual(solution.find_content_children([1, 2, 3],
2017-03-29 16:36:40 +08:00
[1, 1]), 1)
self.assertEqual(solution.find_content_children([1, 2],
2017-03-29 16:36:40 +08:00
[1, 2, 3]), 2)
self.assertEqual(solution.find_content_children([7, 8, 9, 10],
2017-03-29 16:36:40 +08:00
[5, 6, 7, 8]), 2)
print('Success: test_find_content_children')
def main():
test = TestAssignCookie()
test.test_assign_cookie()
if __name__ == '__main__':
main()