Exemple #1
0
def test_invalid_bin_length():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._check_parameters()
Exemple #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()
Exemple #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
def test_invalid_bin_length():
    ga = RealGA(fitness_test_sin_func)
    ga._bin_length = 128

    with pytest.raises(ValueError):
        ga._check_parameters()
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()
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