#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Import modules
import pytest
import numpy as np

# Import from package
import pyswarms.backend as P


@pytest.mark.parametrize('bounds', [None, ([2,2,2], [5,5,5]), ([-1,-1,0], [2,2,5])])
@pytest.mark.parametrize('center', [1, [3,3,3], [0.2,0.2,0.1]])
def test_generate_swarm_return_values(bounds, center):
    """Tests if generate_swarm() returns expected values"""
    pos = P.generate_swarm(n_particles=2, dimensions=3, bounds=bounds,
                           center=center)
    if bounds is None:
        min_bounds, max_bounds = (0.0, 1.00)
    else:
        min_bounds, max_bounds = bounds
    lower_bound = center * np.array(min_bounds)
    upper_bound = center * np.array(max_bounds)
    assert (pos <= upper_bound).all() and (pos >= lower_bound).all()

@pytest.mark.parametrize('clamp', [None, (0,1), (2,5), (1,6)])
def test_generate_velocity_return_values(clamp):
    """Tests if generate_velocity() returns expected values"""
    min_clamp, max_clamp = (0,1) if clamp == None else clamp
    velocity = P.generate_velocity(n_particles=2, dimensions=3, clamp=clamp)
    assert (velocity <= max_clamp).all() and (velocity >= min_clamp).all()
@@ -805,16 +805,1188 @@
 .all()%0A%0A
+%0A@pytest.mark.parametrize('bounds', %5BNone, (%5B1,1,1%5D, %5B10,10,10%5D)%5D)%0A@pytest.mark.parametrize('init_pos', %5BNone, np.array(%5B%5B2,5,6%5D,%5B7,2,1%5D%5D)%5D)%0Adef test_generate_swarm_bounds_init_pos(bounds, init_pos):%0A    %22%22%22Tests if generate_swarm() returns expected values given init_pos and bounds%22%22%22%0A    pos = P.generate_swarm(n_particles=2, dimensions=3, bounds=bounds,%0A                           init_pos=init_pos)%0A    if (bounds is None) and (init_pos is None):%0A        min_bounds, max_bounds = (0.0, 1.00)%0A    elif (bounds is None) and (init_pos is not None):%0A        min_bounds, max_bounds = (-np.inf, np.inf)%0A    else:%0A        min_bounds, max_bounds = bounds%0A    lower_bound = np.array(min_bounds)%0A    upper_bound = np.array(max_bounds)%0A    assert (pos %3C= upper_bound).all() and (pos %3E= lower_bound).all()%0A%0Adef test_generate_swarm_out_of_bounds():%0A    %22%22%22Tests if generate_swarm() raises ValueError when initialized with the wrong value%22%22%22%0A    bounds = (%5B1,1,1%5D, %5B5,5,5%5D)%0A    init_pos = np.array(%5B%5B-2,3,3%5D, %5B6,8,1%5D%5D)%0A    with pytest.raises(ValueError):%0A        pos = P.generate_swarm(n_particles=2, dimensions=3, bounds=bounds,%0A                               init_pos=init_pos)%0A%0A%0A
 @pytest.

Add tests for init_pos