Skip to content

Commit 16596fd

Browse files
authored
Added tests 7-11
1 parent e70844a commit 16596fd

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import unittest
2+
from Solution0007 import Solution
3+
4+
class SolutionTest(unittest.TestCase):
5+
def setUp(self):
6+
self.solution = Solution()
7+
8+
def test_reverse(self):
9+
self.assertEqual(Solution().reverse(123), 321)
10+
11+
def test_reverse2(self):
12+
self.assertEqual(Solution().reverse(-123), -321)
13+
14+
def test_reverse3(self):
15+
self.assertEqual(Solution().reverse(120), 21)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import unittest
2+
from Solution0008 import Solution
3+
4+
class SolutionTest(unittest.TestCase):
5+
def setUp(self):
6+
self.solution = Solution()
7+
8+
def test_myAtoi(self):
9+
self.assertEqual(Solution().myAtoi("42"), 42)
10+
11+
def test_myAtoi2(self):
12+
self.assertEqual(Solution().myAtoi(" -42"), -42)
13+
14+
def test_myAtoi3(self):
15+
self.assertEqual(Solution().myAtoi("4193 with words"), 4193)
16+
17+
def test_myAtoi4(self):
18+
self.assertEqual(Solution().myAtoi("words and 987"), 0)
19+
20+
def test_myAtoi5(self):
21+
self.assertEqual(Solution().myAtoi("-91283472332"), -2147483648)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import unittest
2+
from Solution0009 import Solution
3+
4+
class SolutionTest(unittest.TestCase):
5+
def test_isPalindrome(self):
6+
self.assertEqual(Solution().isPalindrome(121), True)
7+
8+
def test_isPalindrome2(self):
9+
self.assertEqual(Solution().isPalindrome(-121), False)
10+
11+
def test_isPalindrome3(self):
12+
self.assertEqual(Solution().isPalindrome(10), False)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import unittest
2+
from Solution0010 import Solution
3+
4+
class SolutionTest(unittest.TestCase):
5+
def test_isMatch(self):
6+
self.assertEqual(Solution().isMatch("aa", "a"), False)
7+
8+
def test_isMatch2(self):
9+
self.assertEqual(Solution().isMatch("aa", "a*"), True)
10+
11+
def test_isMatch3(self):
12+
self.assertEqual(Solution().isMatch("ab", ".*"), True)
13+
14+
def test_isMatch4(self):
15+
self.assertEqual(Solution().isMatch("aab", "c*a*b"), True)
16+
17+
def test_isMatch5(self):
18+
self.assertEqual(Solution().isMatch("mississippi", "mis*is*p*."), False)

src/main/python/g0001_0100/s0011_container_with_most_water/Solution0011.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# #LeetCode_75_Two_Pointers #Algorithm_II_Day_4_Two_Pointers #Top_Interview_150_Two_Pointers
33
# #Big_O_Time_O(n)_Space_O(1) #2025_07_22_Time_68_ms_(91.16%)_Space_28.60_MB_(23.78%)
44

5+
from typing import List
6+
57
class Solution:
68
def maxArea(self, height: List[int]) -> int:
79
max_area = -1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import unittest
2+
from Solution0011 import Solution
3+
4+
class SolutionTest(unittest.TestCase):
5+
def test_maxArea(self):
6+
self.assertEqual(Solution().maxArea([1, 8, 6, 2, 5, 4, 8, 3, 7]), 49)
7+
8+
def test_maxArea2(self):
9+
self.assertEqual(Solution().maxArea([1, 1]), 1)

0 commit comments

Comments
 (0)