Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5290909

Browse files
committed
Add tests
1 parent 82805f5 commit 5290909

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

‎array-string/1768_merge_strings_alternately.py renamed to ‎array-string/1768_merge_strings_alternately/solution.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ def mergeAlternately(self, word1: str, word2: str) -> str:
99
result.append(word2[index])
1010

1111
return ''.join(result)
12-
13-
assert Solution().mergeAlternately(word1="abc", word2="pqr") == "apbqcr", "Test 1 Failed"
14-
assert Solution().mergeAlternately(word1="ab", word2="pqrs") == "apbqrs", "Test 2 Failed"
15-
assert Solution().mergeAlternately(word1="abcd", word2="pq") == "apbqcd", "Test 3 Failed"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pytest
2+
from solution import Solution
3+
4+
@pytest.mark.parametrize("word1, word2, expected", [
5+
("abc", "pqr", "apbqcr"),
6+
("ab", "pqrs", "apbqrs"),
7+
("abcd", "pq", "apbqcd")
8+
])
9+
def test_merge_alternately(word1, word2, expected):
10+
solution = Solution()
11+
assert solution.mergeAlternately(word1, word2) == expected

‎requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest~=8.4.1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /