# Path: pyswarms/utils/functions/single_obj.py
# def ackley(x):
# def beale(x):
# def booth(x):
# def bukin6(x):
# def crossintray(x):
# def easom(x):
# def eggholder(x):
# def goldstein(x):
# def himmelblau(x):
# def holdertable(x):
# def levi(x):
# def matyas(x):
# def rastrigin(x):
# def rosenbrock(x):
# def schaffer2(x):
# def sphere(x):
# def threehump(x):


from collections import namedtuple
from pyswarms.utils.functions import single_obj as fx
import numpy as np
import pytest
# Import modules

# Import from pyswarms

Bounds = namedtuple("Bounds", "low high")
b = {
    # Define all bounds here
    "ackley": Bounds(low=-32, high=32),
    "beale": Bounds(low=-4.5, high=4.5),
    "booth": Bounds(low=-10, high=10),
    # bukin_6 is not symmetrical
    "crossintray": Bounds(low=-1, high=10),
    "easom": Bounds(low=-100, high=100),
    "eggholder": Bounds(low=-512, high=512),
    "goldstein": Bounds(low=-2, high=-2),
    "himmelblau": Bounds(low=-5, high=5),
    "holdertable": Bounds(low=-10, high=10),
    "levi": Bounds(low=-10, high=10),
    "matyas": Bounds(low=-10, high=10),
    "rastrigin": Bounds(low=-5.12, high=5.12),
    # rosenbrock has an infinite domain
    "schaffer2": Bounds(low=-100, high=100),
    "threehump": Bounds(low=-5, high=5),
}


def test_ackley_bound_fail(outbound):
    """Test ackley bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["ackley"].low, b["ackley"].high, size=(3, 2))

# Path: pyswarms/utils/functions/single_obj.py
# def ackley(x):
# def beale(x):
# def booth(x):
# def bukin6(x):
# def crossintray(x):
# def easom(x):
# def eggholder(x):
# def goldstein(x):
# def himmelblau(x):
# def holdertable(x):
# def levi(x):
# def matyas(x):
# def rastrigin(x):
# def rosenbrock(x):
# def schaffer2(x):
# def sphere(x):
# def threehump(x):


# Path: tests/utils/functions/test_singleobj_bounds.py
from collections import namedtuple
from pyswarms.utils.functions import single_obj as fx
import numpy as np
import pytest

# Import modules

# Import from pyswarms

Bounds = namedtuple("Bounds", "low high")
b = {
    # Define all bounds here
    "ackley": Bounds(low=-32, high=32),
    "beale": Bounds(low=-4.5, high=4.5),
    "booth": Bounds(low=-10, high=10),
    # bukin_6 is not symmetrical
    "crossintray": Bounds(low=-1, high=10),
    "easom": Bounds(low=-100, high=100),
    "eggholder": Bounds(low=-512, high=512),
    "goldstein": Bounds(low=-2, high=-2),
    "himmelblau": Bounds(low=-5, high=5),
    "holdertable": Bounds(low=-10, high=10),
    "levi": Bounds(low=-10, high=10),
    "matyas": Bounds(low=-10, high=10),
    "rastrigin": Bounds(low=-5.12, high=5.12),
    # rosenbrock has an infinite domain
    "schaffer2": Bounds(low=-100, high=100),
    "threehump": Bounds(low=-5, high=5),
}


def test_ackley_bound_fail(outbound):
    """Test ackley bound exception"""
    with pytest.raises(ValueError):
        x = outbound(b["ackley"].low, b["ackley"].high, size=(3, 2))

        fx.ackley(x)