Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Feb 17, 2023
1 parent 27cd6be commit 9ef4a7c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/utils/numeric_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import deque
from itertools import islice

from qupulse.utils.numeric import approximate_rational, approximate_double, smallest_factor_ge
from qupulse.utils.numeric import approximate_rational, approximate_double, smallest_factor_ge, lcm


def stern_brocot_sequence() -> Iterator[int]:
Expand Down Expand Up @@ -120,3 +120,14 @@ def test_smallest_factor_ge(self):
self.assertEqual(smallest_factor_ge(45, 4), 5, brute_force)
self.assertEqual(smallest_factor_ge(45, 5), 5, brute_force)
self.assertEqual(smallest_factor_ge(36, 8), 9, brute_force)


class LeastCommonMultipleTests(unittest.TestCase):
def test_few_args(self):
self.assertEqual(1, lcm())
self.assertEqual(5, lcm(5))

def test_multi_args(self):
self.assertEqual(15, lcm(3, 5))
self.assertEqual(0, lcm(3, 0))
self.assertEqual(20, lcm(2, 5, 4, 10))

0 comments on commit 9ef4a7c

Please sign in to comment.