import random

from fractions import gcd
from src.gcf import gcf, xgcf


class TestGCF:
    def test_00(self):
        assert gcf(0, 0) == 0

    def test_10(self):
        assert gcf(1, 0) == 1

    def test_01(self):
        assert gcf(0, 1) == 1

    def check_random(self, lo=-1024, hi=1024, seed=0):
        random.seed(seed)

        a, b = random.randint(lo, hi), random.randint(lo, hi)

        g = gcf(a, b)

        assert g == gcd(a, b), "{}, {}".format(a, b)

    def test_random(self, times=10000):
        for i in range(times): yield self.check_random


class TestXGCF:
    def test_00(self):
        assert xgcf(0, 0)[0] == 0

    def test_10(self):
        assert xgcf(1, 0) == (1, 1, 0)

    def test_01(self):
        assert xgcf(0, 1) == (1, 0, 1)

    def check_random(self, lo=-1024, hi=1024, seed=0):
        random.seed(seed)

        a, b = random.randint(lo, hi), random.randint(lo, hi)

        g, s, t = xgcf(a, b)
        correct = gcd(a, b)

        assert correct == g, "{}, {}".format(a, b)
        assert correct == s * a + t * b, "{}, {}".format(a, b)

    def test_random(self, times=10000):
        for i in range(times): yield self.check_random


@@ -6,16 +6,24 @@
 t random
+, pytest
 %0A%0Afrom f
@@ -78,27 +78,8 @@
 f%0A%0A%0A
-class TestGCF:%0A    
 def 
@@ -82,39 +82,31 @@
 def test_00(
-self
 ):%0A    
- 
-   
 assert gcf(0
@@ -112,28 +112,24 @@
 0, 0) == 0%0A%0A
-    
 def test_10(
@@ -124,35 +124,27 @@
 def test_10(
-self):%0A    
+):%0A
     assert g
@@ -154,28 +154,24 @@
 1, 0) == 1%0A%0A
-    
 def test_01(
@@ -166,35 +166,27 @@
 def test_01(
-self):%0A    
+):%0A
     assert g
@@ -204,33 +204,83 @@
  1%0A%0A
-    def check
+@pytest.mark.parametrize(%22seed%22, list(range(100)))%0Adef test
 _random
+_gcd
 (se
-lf
+ed
 , lo
@@ -290,39 +290,27 @@
 024, hi=1024
-, seed=0):%0A    
+):%0A
     random.s
@@ -312,36 +312,32 @@
 dom.seed(seed)%0A%0A
-    
     a, b = rando
@@ -383,20 +383,16 @@
 i)%0A%0A    
-   
- 
 g = gcf(
@@ -390,36 +390,32 @@
  g = gcf(a, b)%0A%0A
-    
     assert g == 
@@ -440,36 +440,32 @@
 %22.format(a, b)%0A%0A
-    
 def test_random(
@@ -461,135 +461,14 @@
 est_
-random(self, times=10000):%0A        for i in range(times): yield self.check_random%0A%0A%0Aclass TestXGCF:%0A    def test_00(self):%0A    
+00():%0A
     
@@ -494,20 +494,16 @@
 %5D == 0%0A%0A
-    
 def test
@@ -506,27 +506,19 @@
 test_10(
-self):%0A    
+):%0A
     asse
@@ -545,20 +545,16 @@
  1, 0)%0A%0A
-    
 def test
@@ -561,23 +561,15 @@
 _01(
-self
 ):%0A    
-  
-  
 asse
@@ -600,33 +600,83 @@
 1)%0A%0A
-    def check
+@pytest.mark.parametrize(%22seed%22, list(range(100)))%0Adef test
 _random
+_gcf
 (se
-lf
+ed
 , lo
@@ -694,23 +694,11 @@
 1024
-, seed=0):%0A    
+):%0A
     
@@ -716,20 +716,16 @@
 (seed)%0A%0A
-    
     a, b
@@ -775,20 +775,16 @@
 o, hi)%0A%0A
-    
     g, s
@@ -804,20 +804,16 @@
  b)%0A    
-  
-  
 correct 
@@ -825,20 +825,16 @@
 (a, b)%0A%0A
-    
     asse
@@ -876,20 +876,16 @@
  b)%0A    
-  
-  
 assert c
@@ -936,100 +936,4 @@
 b)%0A%0A
-    def test_random(self, times=10000):%0A        for i in range(times): yield self.check_random%0A%0A

use @pytest.mark.parametrize in test_gcf