Skip to content

Commit

Permalink
Diophantine Equation
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 9, 2024
1 parent 25f4409 commit 734f1d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions kyu_5/diophantine_equation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Diophantine Equation."""
7 changes: 6 additions & 1 deletion kyu_5/diophantine_equation/solution.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
"""
Solution for -> Diophantine Equation
Solution for -> Diophantine Equation.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""


def sol_equa(n: int) -> list:
"""
Diophantine Equation solution.
Finds all integers x, y (x >= 0, y >= 0)
solutions of a diophantine equation of the form x2 - 4 * y2 = n
:param n: int
:return: list

Check warning on line 16 in kyu_5/diophantine_equation/solution.py

View check run for this annotation

Codecov / codecov/patch

kyu_5/diophantine_equation/solution.py#L15-L16

Added lines #L15 - L16 were not covered by tests
"""
result: list = []

Expand Down
19 changes: 11 additions & 8 deletions kyu_5/diophantine_equation/test_solution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Test for -> Diophantine Equation
Test for -> Diophantine Equation.
Created by Egor Kostan.
GitHub: https://github.com/ikostan
"""
Expand Down Expand Up @@ -27,13 +28,12 @@
name='Source/Kata')
@pytest.mark.skip(reason="The solution is not ready")
class SolutionTestCase(unittest.TestCase):
"""
Testing sol_equa function
"""
"""Testing sol_equa function."""

def test_solution_basic(self):
"""
Testing using basic test data
Testing using basic test data.
:return:
"""
self.assertEqual(sol_equa(5), [[3, 1]])
Expand All @@ -45,7 +45,8 @@ def test_solution_basic(self):

def test_solution_medium(self):
"""
Testing using medium test data
Testing using medium test data.
:return:
"""
self.assertEqual(sol_equa(9001), [[4501, 2250]])
Expand All @@ -69,7 +70,8 @@ def test_solution_medium(self):

def test_solution_big(self):
"""
Testing using big test data
Testing using big test data.
:return:
"""
self.assertEqual(sol_equa(900000), [[112502, 56249],
Expand Down Expand Up @@ -107,7 +109,8 @@ def test_solution_big(self):

def test_solution_empty(self):
"""
Testing using empty test data
Testing using empty test data.
:return:
"""
self.assertEqual(sol_equa(90002), [])

0 comments on commit 734f1d2

Please sign in to comment.