|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Phase 26 — property-based tests for the cellular-automata core. More...
#include <cstdint>#include <random>#include <gtest/gtest.h>#include <ca-traits.H>#include <tpl_ca_storage.H>#include <tpl_ca_lattice.H>#include <tpl_ca_neighborhood.H>#include <tpl_ca_rule.H>#include <tpl_ca_engine.H>#include <tpl_ca_async_engine.H>#include <tpl_ca_update_scheme.H>#include <tpl_ca_block_rule.H>Go to the source code of this file.
Functions | |
| TEST (CAProperties, BBMConservesParticleCountAcrossRandomGrids) | |
| TEST (CAProperties, TMGasConservesParticleCountAcrossRandomGrids) | |
| TEST (CAProperties, MargolusBBMIsReversibleAcrossRandomGrids) | |
| TEST (CAProperties, MargolusTMGasIsReversibleAcrossRandomGrids) | |
| TEST (CAProperties, MargolusCrittersIsReversibleAcrossRandomGrids) | |
| TEST (CAProperties, SynchronousEngineIsDeterministic) | |
| TEST (CAProperties, AtSafeIsWellDefinedForAnyCoordinate) | |
Phase 26 — property-based tests for the cellular-automata core.
Unlike the case-designed GoogleTests, these checks generate many random initial grids and assert invariants that must hold for every input:
BBM_Rule and TM_Gas_Rule under Margolus_Update conserve the whole-lattice particle count for any initial grid.Margolus_Update with an involutive block rule is reversible: forward(N) followed by backward(N) restores the initial state bit-for-bit, for any initial grid.Synchronous_Engine is deterministic: the same initial state yields the same trajectory.Lattice::at_safe(c) is well-defined for any (possibly far out-of-range or negative) coordinate: it never reads out of bounds (validated under ASan/UBSan in CI) and agrees with the boundary policy.Each property sweeps a grid of {seed} x {side} random instances via the for_random_grids helper.
Definition in file ca_properties_test.cc.
| TEST | ( | CAProperties | , |
| AtSafeIsWellDefinedForAnyCoordinate | |||
| ) |
Definition at line 263 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching(), k, r, rng, and seed.
| TEST | ( | CAProperties | , |
| BBMConservesParticleCountAcrossRandomGrids | |||
| ) |
Definition at line 143 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching(), and seed.
| TEST | ( | CAProperties | , |
| MargolusBBMIsReversibleAcrossRandomGrids | |||
| ) |
Definition at line 218 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching().
| TEST | ( | CAProperties | , |
| MargolusCrittersIsReversibleAcrossRandomGrids | |||
| ) |
Definition at line 228 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching().
| TEST | ( | CAProperties | , |
| MargolusTMGasIsReversibleAcrossRandomGrids | |||
| ) |
Definition at line 223 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching().
| TEST | ( | CAProperties | , |
| SynchronousEngineIsDeterministic | |||
| ) |
Definition at line 237 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::make_game_of_life_rule(), seed, and Aleph::CA::Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::step().
| TEST | ( | CAProperties | , |
| TMGasConservesParticleCountAcrossRandomGrids | |||
| ) |
Definition at line 164 of file ca_properties_test.cc.
References Aleph::blossom_maximum_cardinality_matching(), and seed.