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

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

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