File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 1919 is_prime , next_prime , smallprimes ,
2020 square_root_mod_prime )
2121
22- def test_numbertheory ():
23-
24- print_ ("Testing lcm..." )
25- assert lcm (3 , 5 * 3 , 7 * 3 ) == 3 * 5 * 7
26- assert lcm ([3 , 5 * 3 , 7 * 3 ]) == 3 * 5 * 7
27- assert lcm (3 ) == 3
28-
2922
3023BIGPRIMES = (999671 ,
3124 999683 ,
@@ -202,6 +195,18 @@ def test_gcd_with_random_numbers(self, numbers):
202195 # check that at least it's a divider
203196 assert i % n == 0
204197
198+ def test_lcm (self ):
199+ assert lcm (3 , 5 * 3 , 7 * 3 ) == 3 * 5 * 7
200+ assert lcm ([3 , 5 * 3 , 7 * 3 ]) == 3 * 5 * 7
201+ assert lcm (3 ) == 3
202+
203+ @given (st .lists (st .integers (min_value = 1 , max_value = 2 ** 8192 ),
204+ min_size = 1 , max_size = 20 ))
205+ def test_lcm_with_random_numbers (self , numbers ):
206+ n = lcm (numbers )
207+ for i in numbers :
208+ assert n % i == 0
209+
205210 @unittest .skipUnless (HC_PRESENT ,
206211 "Hypothesis 2.0.0 can't be made tolerant of hard to "
207212 "meet requirements (like `is_prime()`)" )
You can’t perform that action at this time.
0 commit comments