tests/testthat/test-initialize_population.R

test_that("initialize_population generates correct number of individuals", {
    population <- genetic.algo.optimizeR::initialize_population(population_size = 10, min = 0, max = 3)
    expect_equal(length(population), 10)
})

test_that("initialize_population generates integers within specified range", {
    population <- genetic.algo.optimizeR::initialize_population(population_size = 10, min = 0, max = 3)
    expect_true(all(population >= 0 & population <= 3))
})

Try the genetic.algo.optimizeR package in your browser

Any scripts or data that you put into this service are public.

genetic.algo.optimizeR documentation built on Oct. 10, 2024, 5:07 p.m.