Repository navigation
Regression tests for empty species (#19, #45), ref #73 - #91
Merged
Merged
Conversation
- tests/empty_species_regression_tests.rs: 1000 generations, seed 19, population 30, target_species 5, stagnation limit 3 (1 protected) and negative XOR fitness so species are removed and left empty; asserts no panic, exact population size every generation, and that the scenario really happened (several species, removals, empty species). - Specie::generate_offspring* on a species without organisms no longer panics (gen_range on an empty range, the #19 panic): it stays empty. - Unit test: evolve with empty species keeps the size and drops them. ref #73, ref #19, ref #45 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué cambia
tests/empty_species_regression_tests.rs(nuevo): test de regresión determinista de 1000 generaciones (with_seed(19), población 30,target_species(5),species_stagnation(3, 1), fitness XOR negativa = −error²). La fitness negativa hace que la especie con menor media reciba cuota 0 y quede vacía trasevolve; el límite de estancamiento corto elimina especies continuamente. Comprueba en cada generación que no hay panic y quesize() == 30(trasevolvey trasevaluate_in), y al final que el escenario de panic in Specie::generate_offspring() #19 se produjo de verdad (≥ 3 especies, especies eliminadas, especies vacías).Specie::generate_offspring*: con una especie sin organismos ya no hace panic (era exactamente el panic de panic in Specie::generate_offspring() #19:gen_rangesobre rango vacío, y&self.organisms[0]). Sin padres no hay hijos: la especie queda vacía.Populationno llegaba a este caso (ya filtra especies vacías enspeciate, la limpieza de Remove species that no longer have any organisms. #45), pero la API pública deSpeciesí.specie::tests::generate_offspring_of_an_empty_species_does_not_panic(rojo en develop con el panic derand, verde con el guard) ypopulation::tests::evolve_with_empty_species_does_not_panic_and_drops_them(inserta especies vacías,generate_offspring+speciatemantienen tamaño 20 y las eliminan).Nada de la esencia cambia (red mínima, crecimiento por mutación estructural, CTRNN).
Cómo se verificó (todo por contenedor, release)
cargo fmt -- --check: OKcargo clippy --release --all-targets: 40 ubicaciones de warning antes y después; ninguna en código nuevo.cargo build --release --examples: OKcargo test --release --no-fail-fast: todo verde (lib 122, todos los binarios detests/, incluido XOR).Medida del criterio de cierre
cargo test --release --test empty_species_regression_tests -- --nocapture:1000 generaciones sin panic, tamaño exacto en todas, 1569 especies eliminadas por estancamiento y especies vacías en 983 de 1000 generaciones. Criterio alcanzado en la parte del test.
Texto propuesto para #19 y #45 (decide el dueño; no se ha cerrado ni comentado nada)
Para #19:
Para la PR #45:
ref #73
ref #19
ref #45
Parte de la épica #55
🤖 Generated with Claude Code