2014-02-22 09:12:05 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
|
2016-01-07 16:56:30 +00:00
|
|
|
from pymath.calculus import arithmetic
|
2014-02-22 09:12:05 +00:00
|
|
|
|
2016-02-13 03:49:37 +00:00
|
|
|
|
2014-12-21 17:10:52 +00:00
|
|
|
def test_gcd_commu():
|
2016-02-13 03:49:37 +00:00
|
|
|
assert arithmetic.gcd(3, 15) == arithmetic.gcd(15, 3)
|
|
|
|
|
2014-02-22 09:12:05 +00:00
|
|
|
|
2014-12-21 17:10:52 +00:00
|
|
|
def test_gcd1():
|
|
|
|
assert arithmetic.gcd(3, 15) == 3
|
2014-02-22 09:12:05 +00:00
|
|
|
|
2016-02-13 03:49:37 +00:00
|
|
|
|
2014-12-21 17:10:52 +00:00
|
|
|
def test_gcd2():
|
|
|
|
assert arithmetic.gcd(14, 21) == 7
|
2014-02-22 09:12:05 +00:00
|
|
|
|
2016-02-13 03:49:37 +00:00
|
|
|
|
2014-12-21 17:10:52 +00:00
|
|
|
def test_gcd_prem():
|
|
|
|
assert arithmetic.gcd(14, 19) == 1
|
2014-02-22 09:12:05 +00:00
|
|
|
|
2016-02-13 03:49:37 +00:00
|
|
|
|
2014-12-21 17:10:52 +00:00
|
|
|
def test_gcd_neg():
|
|
|
|
assert arithmetic.gcd(3, -15) == 3
|
|
|
|
assert arithmetic.gcd(-3, -15) == -3
|
2014-02-22 09:12:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -----------------------------
|
|
|
|
# Reglages pour 'vim'
|
|
|
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
2016-02-13 03:29:26 +00:00
|
|
|
# cursor: 16 del
|