import random
import math
random.seed("basic04")

class TestGen:
    def __init__(self):
        self.test_number = 0

    def generate_samples(self):
        self.print_test(3, 3)

    def generate_min_tests(self):
        for n in range(1, 6):
            for m in range(1, 6):
                self.print_test(n, m)
                                                                    
    def generate_hand_tests(self):
        pass        

    def generate_random_test(self, maxn):
        self.print_test(random.randint(1, maxn), random.randint(1, maxn))

    def generate_max_tests(self, maxn):
        for n in range(100 - 5, 101):
            for m in range(100 - 5, 101):
                self.print_test(n, m)

    def print_test(self, n, m):
        self.test_number += 1
        test_name = "../tests/" + "{0:0=2d}".format(self.test_number)
        test_file = open(test_name, "w")
        print(n, m, file=test_file)
        test_file.close()

    def generate_all_tests(self):
        maxn = 100

        self.generate_samples()
        self.generate_hand_tests()
        self.generate_min_tests()
        
        for i in range(10):
            self.generate_random_test(maxn)
        self.generate_max_tests(maxn)        

import os, shutil
if os.path.exists('../tests'):
    print('Directory tests is already exists')
    shutil.rmtree('../tests', ignore_errors=False, onerror=None)
try:
    os.makedirs('../tests')
except OSError:
    pass

import time
start = time.time()
writer = TestGen()
writer.generate_all_tests()
finish = time.time()
print('All tests were generated. Elapsed time: ', finish - start)