tests/testthat/test_run_simulation.R

test_that("Log every n",
          {
            assertthat::are_equal(unique(run_simulation(max_gens = 30,
                                     males_per_winner = 10,
                                     num_nests = 10,
                                     encounter_delta = 1,
                                     metabolism = 1,
                                     female_mat_time = 10, 
                                     maturation_rate = 1,
                                     mutation_rate = 0.1,
                                     mutation_sd = 0.1,
                                     mass_to_energy = 10,
                                     growth_a = 0.5,
                                     growth_b = 0.1,
                                     initial_mass = 5,
                                     alpha_mean = 0,
                                     alpha_sd = 3,
                                     beta_sd = 3,
                                     beta_max = 2,
                                     beta_mean = 0,
                                     contest_noise = 100,
                                     verbose = F,
                                     quiet = T)$generation), c(1, 10, 20, 30))
            
            assertthat::are_equal(unique(run_simulation(max_gens = 30,
                                    males_per_winner = 10,
                                    num_nests = 10,
                                    encounter_delta = 1,
                                    metabolism = 1,
                                    female_mat_time = 10, 
                                    maturation_rate = 1,
                                    mutation_rate = 0.1,
                                    mutation_sd = 0.1,
                                    mass_to_energy = 10,
                                    growth_a = 0.5,
                                    growth_b = 0.1,
                                    initial_mass = 5,
                                    alpha_mean = 0,
                                    alpha_sd = 3,
                                    beta_sd = 3,
                                    beta_max = 2,
                                    beta_mean = 0,
                                    contest_noise = 100,
                                    verbose = F,
                                    log_every = 1,
                                    quiet = T)$generation), 1:30)
          })
johnWilshire/contest documentation built on May 19, 2019, 3:03 p.m.