mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
24 lines
608 B
Python
24 lines
608 B
Python
import unittest
|
|
|
|
|
|
class TestCompress(unittest.TestCase):
|
|
|
|
def test_compress(self, func):
|
|
self.assertEqual(func(None), None)
|
|
self.assertEqual(func(''), '')
|
|
self.assertEqual(func('AABBCC'), 'AABBCC')
|
|
self.assertEqual(func('AAABCCDDDDE'), 'A3BC2D4E')
|
|
self.assertEqual(func('BAAACCDDDD'), 'BA3C2D4')
|
|
self.assertEqual(func('AAABAACCDDDD'), 'A3BA2C2D4')
|
|
print('Success: test_compress')
|
|
|
|
|
|
def main():
|
|
test = TestCompress()
|
|
compress_string = CompressString()
|
|
test.test_compress(compress_string.compress)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|