# Path: platypus/tests/test_core.py
# def createSolution(*args):
#     problem = Problem(0, len(args))
#     solution = Solution(problem)
#     solution.objectives[:] = [float(x) for x in args]
#     return solution


import unittest
import functools
from ..tools import *
from .test_core import createSolution
        self.assertAlmostEqual(0.965, x[0], delta=0.001)
        self.assertAlmostEqual(-1.586, x[1], delta=0.001)
        self.assertAlmostEqual(0.517, x[2], delta=0.001)
        
    def test_lsolve_singular(self):
        A = [[0.5, 0.5], [0.5, 0.5]]
        b = [1, 1]
        self.assertRaises(SingularError, functools.partial(lsolve, A, b))

class TestCombinatorics(unittest.TestCase):
    
    def test_choose(self):
        self.assertEqual(1, choose(0, 0))
        self.assertEqual(1, choose(1, 0))
        self.assertEqual(1, choose(5, 0))
        self.assertEqual(1, choose(1, 1))
        self.assertEqual(5, choose(5, 1))
        self.assertEqual(5, choose(5, 4))
        self.assertEqual(1, choose(5, 5))
        
class TestDistances(unittest.TestCase):
    
    def test_euclidean(self):
        self.assertEqual(0.0, euclidean_dist([1, 1], [1, 1]))
        self.assertAlmostEqual(1.414, euclidean_dist([0, 0], [1, 1]), delta=0.001)
        self.assertAlmostEqual(1.414, euclidean_dist([1, 1], [0, 0]), delta=0.001)
        
class TestDistanceMatrix(unittest.TestCase):
    
    def test(self):

# Path: platypus/tests/test_core.py
# def createSolution(*args):
#     problem = Problem(0, len(args))
#     solution = Solution(problem)
#     solution.objectives[:] = [float(x) for x in args]
#     return solution


# Path: platypus/tests/test_tools.py
import unittest
import functools
from ..tools import *
from .test_core import createSolution

        self.assertAlmostEqual(0.965, x[0], delta=0.001)
        self.assertAlmostEqual(-1.586, x[1], delta=0.001)
        self.assertAlmostEqual(0.517, x[2], delta=0.001)
        
    def test_lsolve_singular(self):
        A = [[0.5, 0.5], [0.5, 0.5]]
        b = [1, 1]
        self.assertRaises(SingularError, functools.partial(lsolve, A, b))

class TestCombinatorics(unittest.TestCase):
    
    def test_choose(self):
        self.assertEqual(1, choose(0, 0))
        self.assertEqual(1, choose(1, 0))
        self.assertEqual(1, choose(5, 0))
        self.assertEqual(1, choose(1, 1))
        self.assertEqual(5, choose(5, 1))
        self.assertEqual(5, choose(5, 4))
        self.assertEqual(1, choose(5, 5))
        
class TestDistances(unittest.TestCase):
    
    def test_euclidean(self):
        self.assertEqual(0.0, euclidean_dist([1, 1], [1, 1]))
        self.assertAlmostEqual(1.414, euclidean_dist([0, 0], [1, 1]), delta=0.001)
        self.assertAlmostEqual(1.414, euclidean_dist([1, 1], [0, 0]), delta=0.001)
        
class TestDistanceMatrix(unittest.TestCase):
    
    def test(self):

        solutions = [createSolution(0, 1), createSolution(0.5, 0.5), createSolution(0.75, 0.25), createSolution(1, 0)]