Ejemplo n.º 1
0
def test_invalid_bin_length():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._check_parameters()
Ejemplo n.º 2
0
def test_invalid_get_mut_bit_offset():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._get_mut_bit_offset()
Ejemplo n.º 3
0
def test_valid_get_mut_bit_offset(bin_length, result):
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = bin_length

    assert ga._get_mut_bit_offset() == result
Ejemplo n.º 4
0
def test_invalid_bin_length():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._check_parameters()
Ejemplo n.º 5
0
def test_invalid_get_mut_bit_offset():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._get_mut_bit_offset()
Ejemplo n.º 6
0
def test_valid_get_mut_bit_offset(bin_length, result):
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = bin_length

    assert ga._get_mut_bit_offset() == result