<commit_before>#!/usr/bin/env python3

import unittest

from euclidean import euclideanGCD, extendedEuclidean


class test_euclideanGCD(unittest.TestCase):
    
    def test_0(self):
        self.assertEqual(euclideanGCD(0,0), 0)
        self.assertEqual(euclideanGCD(0,1), 1)
        self.assertEqual(euclideanGCD(1,0), 1)
        self.assertEqual(euclideanGCD(0,12), 12)
        self.assertEqual(euclideanGCD(12,0), 12)
    
    def test_1(self):
        self.assertEqual(euclideanGCD(1,12), 1)
        self.assertEqual(euclideanGCD(12,1), 1)
    
    def test_big_factors(self):
        self.assertEqual(euclideanGCD(1406700, 164115  ), 23445)
        self.assertEqual(euclideanGCD(164115,  1406700 ), 23445)
        self.assertEqual(euclideanGCD(55534,   434334  ), 2)
        self.assertEqual(euclideanGCD(434334,  55534   ), 2)
        self.assertEqual(euclideanGCD(30315475,24440870), 31415)
        self.assertEqual(euclideanGCD(24440870,30315475), 31415)
        self.assertEqual(euclideanGCD(37279462087332,366983722766), 564958)
        self.assertEqual(euclideanGCD(366983722766,37279462087332), 564958)
    
    def test_big_primes(self):
        self.assertEqual(euclideanGCD(2921802413,20358439), 1)
        self.assertEqual(euclideanGCD(20358439,2921802413), 1)
        self.assertEqual(euclideanGCD(85796527,34775062331),1)
        self.assertEqual(euclideanGCD(34775062331,85796527),1)

class test_extendedEuclidean(unittest.TestCase):
    
    pass



if __name__ == '__main__':
    unittest.main()<commit_msg>Refactored euclideanGCD tests, added extendedEuclidean tests<commit_after>#!/usr/bin/env python3

import unittest

from euclidean import euclideanGCD, extendedEuclidean


class test_euclideanGCD(unittest.TestCase):
    
    def test_0(self):
        
        data = [
            (0,0,  0),
            (0,1,  1),
            (1,0,  1),
            (0,12, 12),
            (12,0, 12)
        ]
        
        for a,b,r in data:
            with self.subTest(a=a, b=b, r=r):
                self.assertEqual( euclideanGCD( a, b ), r )
    
    
    def test_1(self):
        
        data = [
            (1,12, 1),
            (12,1, 1)
        ]
        
        for a,b,r in data:
            with self.subTest(a=a, b=b, r=r):
                self.assertEqual( euclideanGCD( a, b ), r )
    
    
    def test_big_factors(self):
        
        data = [
            (1406700,       164115,         23445),
            (164115,        1406700,        23445),
            (55534,         434334,         2),
            (434334,        55534,          2),
            (30315475,      24440870,       31415),
            (24440870,      30315475,       31415),
            (37279462087332,366983722766,   564958),
            (366983722766,  37279462087332, 564958)
        ]
        
        for a,b,r in data:
            with self.subTest(a=a, b=b, r=r):
                self.assertEqual( euclideanGCD( a, b ), r )
    
    
    def test_big_primes(self):
        
        data = [
            (2921802413, 20358439,   1),
            (20358439,   2921802413, 1),
            (85796527,   34775062331,1),
            (34775062331,85796527,   1)
        ]
        
        for a,b,r in data:
            with self.subTest(a=a, b=b, r=r):
                self.assertEqual( euclideanGCD( a, b ), r )



class test_extendedEuclidean(unittest.TestCase):
    
    def test_gcd(self):
        
        data = [
            (0,         0,          0),
            (0,         1,          1),
            (1,         12,         1),
            (55534,     434334,     2),
            (30315475,  24440870,   31415),
            (2921802413,20358439,   1)
        ]
        
        for a,b,r in data:
            with self.subTest(a=a, b=b, r=r):
                self.assertEqual( extendedEuclidean( a, b )[0], r )
    
    
    def test_linearcombos(self):
        
        data = [
            (0,             0),
            (0,             1),
            (1,             0),
            (1,             12),
            (12,            1),
            (55534,         434334),
            (434334,        55534),
            (434334,        -55534),
            (-434334,        55534),
            (30315475,      24440870),
            (2921802413,    20358439),
            (20358439,      2921802413),
            (37279462087332,366983722766)
        ]
        
        for a,b in data:
            with self.subTest(a=a, b=b):
                r,s,t = extendedEuclidean( a, b )
                
                self.assertEqual( r, a*s + b*t )
        

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.11302847282139776, 'fraction_numerical': 0.1606988783433995, 'mean_word_length': 1.5228509249183895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4271146', 'n_tokens_mistral': 2088, 'n_tokens_neox': 1564, 'n_words': 275}