Commit 20415cab authored by Guillaume CLOCHARD's avatar Guillaume CLOCHARD
Browse files

Ajout test de algo_cfop()

parent ea8776cd
"""
Unit tests pour algo.py
"""
import unittest
import json
from Cube import Cube
from lire_entree import lecture_cube
from algo import algo_cfop
JEU_TEST = './tests/samples/sample.json'
def extract_cubes(data):
result = []
for cube, mvts_result in data.items():
result.append(cube)
result += data[cube].values()
return result
class TestAlgo(unittest.TestCase):
def runTest(self):
"""Test de l'algo CFOP"""
with open(JEU_TEST) as data_file: #on parse le jeu de test JSON
data = json.load(data_file)
cubes = extract_cubes(data) #1140 cubes
for cube in cubes:
err, c = lecture_cube(cube)
if err:
raise Error("Erreur lecture_cube \n" + cube)
err = algo_cfop(c)[0]
self.assertIsNone(err)
if __name__ == "__main__":
unittest.main(verbosity=2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment