import unittest
from electre import ElectreSolver
from electre.utils import generate_example_data

class TestElectre(unittest.TestCase):
    
    def setUp(self):
        data = generate_example_data()
        self.solver = ElectreSolver(
            alternatives=data['alternatives'],
            criteria=data['criteria'],
            criteria_types=data['criteria_types'],
            weights=data['weights']
        )
        self.solver.set_decision_matrix(data['decision_matrix'])
    
    def test_initialization(self):
        self.assertEqual(len(self.solver.alternatives), 3)
        self.assertEqual(len(self.solver.criteria), 3)
    
    def test_normalization(self):
        self.solver.normalize_matrix()
        self.assertIsNotNone(self.solver.normalized_matrix)
        self.assertEqual(self.solver.normalized_matrix.shape, (3, 3))
    
    def test_solve(self):
        results = self.solver.solve()
        self.assertIn('kernel', results)
        self.assertIn('concordance_matrix', results)
        self.assertIsInstance(results['kernel'], list)

if __name__ == '__main__':
    unittest.main()