コード例 #1
0
ファイル: test_ntheory.py プロジェクト: sn6uv/gmpy_cffi
 def test_gcdext(self):
     assert gcdext(15, 25) == (mpz(5), mpz(2), mpz(-1))
     assert gcdext(323, 340) == gcdext(mpz(323), 340) == gcdext(323, mpz(340)) == gcdext(mpz(323), mpz(340)) == (mpz(17), mpz(-1), mpz(1))
     with pytest.raises(TypeError):
         gcdext(mpq(1.5), 2)
     with pytest.raises(TypeError):
         gcd(3)
コード例 #2
0
 def test_gcdext(self):
     assert gcdext(15, 25) == (mpz(5), mpz(2), mpz(-1))
     assert gcdext(323, 340) == gcdext(mpz(323), 340) == gcdext(
         323, mpz(340)) == gcdext(mpz(323),
                                  mpz(340)) == (mpz(17), mpz(-1), mpz(1))
     with pytest.raises(TypeError):
         gcdext(mpq(1.5), 2)
     with pytest.raises(TypeError):
         gcd(3)
コード例 #3
0
 def test_gcd(self):
     assert gcd(4, 6) == mpz(2)
     assert gcd(5, 0) == mpz(5)
     assert gcd(5, 0) == mpz(5)
     assert gcd(323, 340) == gcd(mpz(323), 340) == gcd(
         323, mpz(340)) == gcd(mpz(323), mpz(340)) == mpz(17)
     with pytest.raises(TypeError):
         gcd(mpq(1.5), 2)
     with pytest.raises(TypeError):
         gcd(3)
コード例 #4
0
ファイル: test_ntheory.py プロジェクト: sn6uv/gmpy_cffi
 def test_gcd(self):
     assert gcd(4, 6) == mpz(2)
     assert gcd(5, 0) == mpz(5)
     assert gcd(5, 0) == mpz(5)
     assert gcd(323, 340) == gcd(mpz(323), 340) == gcd(323, mpz(340)) == gcd(mpz(323), mpz(340)) == mpz(17)
     with pytest.raises(TypeError):
         gcd(mpq(1.5), 2)
     with pytest.raises(TypeError):
         gcd(3)