Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_ca_stochastic_rules_test.cc File Reference

Phase 8 tests for tpl_ca_stochastic_rules.H. More...

#include <algorithm>
#include <array>
#include <cstdint>
#include <random>
#include <vector>
#include <gtest/gtest.h>
#include <ca-rng.H>
#include <ca-traits.H>
#include <tpl_ca_concepts.H>
#include <tpl_ca_engine.H>
#include <tpl_ca_lattice.H>
#include <tpl_ca_neighborhood.H>
#include <tpl_ca_parallel_engine.H>
#include <tpl_ca_rule.H>
#include <tpl_ca_stochastic_rules.H>
#include <tpl_ca_storage.H>
Include dependency graph for tpl_ca_stochastic_rules_test.cc:

Go to the source code of this file.

Functions

 TEST (CAProbabilisticRule, LegacyTwoArgFunctorStillWorks)
 
 TEST (CAProbabilisticRule, ContextualRouteUsesCellSeedDeterminism)
 
 TEST (CAApplyRule, ContextualOverloadIsPickedUp)
 
 TEST (CAApplyRule, FallsBackToLegacyWhenContextNotAccepted)
 
 TEST (CAForestFire, BurningAlwaysBecomesEmpty)
 
 TEST (CAForestFire, TreeIgnitesWhenAnyNeighbourBurns)
 
 TEST (CAForestFire, EmptyStaysEmptyWhenGrowthIsZero)
 
 TEST (CAForestFire, EmptyAlwaysGrowsWhenGrowthIsOne)
 
 TEST (CAForestFire, FireSpreadsOnSmallToroidalLattice)
 
 TEST (CASir, RecoveredStaysRecovered)
 
 TEST (CASir, SusceptibleStaysSWithoutInfectedNeighbours)
 
 TEST (CASir, InfectedAlwaysRecoversAtGammaOne)
 
 TEST (CASir, R0BelowOneExtinguishesEpidemic)
 
 TEST (CAIsingGlauber, FlipProbabilityOneHalfWhenDeltaEnergyZero)
 
 TEST (CAIsingMetropolis, AlwaysFlipsWhenEnergyDecreases)
 
 TEST (CAIsingMetropolis, NeverFlipsWhenEnergyMassivelyIncreases)
 
 TEST (CASchelling, IsolatedAgentStaysPut)
 
 TEST (CASchelling, UnhappyAgentVacates)
 
 TEST (CASchelling, HappyAgentStaysPut)
 
 TEST (CASchelling, EmptyCellFillsWithMajority)
 
 TEST (CAStochasticReproducibility, ForestFireIdenticalAcrossThreadCounts)
 
 TEST (CAStochasticReproducibility, SIRIdenticalAcrossThreadCounts)
 
 TEST (CAStochasticReproducibility, IsingGlauberIdenticalAcrossThreadCounts)
 
 TEST (CAStochasticReproducibility, SchellingIdenticalAcrossThreadCounts)
 
 TEST (CAStochasticReproducibility, SequentialAndParallelMatchForestFire)
 

Detailed Description

Phase 8 tests for tpl_ca_stochastic_rules.H.

Coverage:

  • Probabilistic_Rule legacy 2-arg and Phase 8 3-arg dispatch.
  • apply_rule chooses the contextual overload when available.
  • Forest fire, SIR, Ising and Schelling rules' canonical transitions on hand-crafted micro-frames.
  • Cross-thread bit-for-bit reproducibility on the parallel engine for every stochastic rule.
  • SIR with R0 < 1 extinguishes the epidemic.

Definition in file tpl_ca_stochastic_rules_test.cc.

Function Documentation

◆ TEST() [1/25]

TEST ( CAApplyRule  ,
ContextualOverloadIsPickedUp   
)

Definition at line 207 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::apply_rule(), and r.

◆ TEST() [2/25]

TEST ( CAApplyRule  ,
FallsBackToLegacyWhenContextNotAccepted   
)

Definition at line 215 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::apply_rule(), and r.

◆ TEST() [3/25]

TEST ( CAForestFire  ,
BurningAlwaysBecomesEmpty   
)

Definition at line 228 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::next().

◆ TEST() [4/25]

TEST ( CAForestFire  ,
EmptyAlwaysGrowsWhenGrowthIsOne   
)

Definition at line 259 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [5/25]

TEST ( CAForestFire  ,
EmptyStaysEmptyWhenGrowthIsZero   
)

Definition at line 249 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [6/25]

TEST ( CAForestFire  ,
FireSpreadsOnSmallToroidalLattice   
)

Definition at line 269 of file tpl_ca_stochastic_rules_test.cc.

References engine.

◆ TEST() [7/25]

TEST ( CAForestFire  ,
TreeIgnitesWhenAnyNeighbourBurns   
)

Definition at line 238 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [8/25]

TEST ( CAIsingGlauber  ,
FlipProbabilityOneHalfWhenDeltaEnergyZero   
)

Definition at line 349 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::Cell_Context< Rank >::coord, and k.

◆ TEST() [9/25]

TEST ( CAIsingMetropolis  ,
AlwaysFlipsWhenEnergyDecreases   
)

Definition at line 372 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [10/25]

TEST ( CAIsingMetropolis  ,
NeverFlipsWhenEnergyMassivelyIncreases   
)

Definition at line 383 of file tpl_ca_stochastic_rules_test.cc.

References k.

◆ TEST() [11/25]

TEST ( CAProbabilisticRule  ,
ContextualRouteUsesCellSeedDeterminism   
)

Definition at line 146 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [12/25]

TEST ( CAProbabilisticRule  ,
LegacyTwoArgFunctorStillWorks   
)

Definition at line 128 of file tpl_ca_stochastic_rules_test.cc.

References counter.

◆ TEST() [13/25]

TEST ( CASchelling  ,
EmptyCellFillsWithMajority   
)

Definition at line 446 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [14/25]

TEST ( CASchelling  ,
HappyAgentStaysPut   
)

Definition at line 430 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [15/25]

TEST ( CASchelling  ,
IsolatedAgentStaysPut   
)

Definition at line 402 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [16/25]

TEST ( CASchelling  ,
UnhappyAgentVacates   
)

Definition at line 412 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [17/25]

TEST ( CASir  ,
InfectedAlwaysRecoversAtGammaOne   
)

Definition at line 319 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [18/25]

TEST ( CASir  ,
R0BelowOneExtinguishesEpidemic   
)

Definition at line 329 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::count_state(), and engine.

◆ TEST() [19/25]

TEST ( CASir  ,
RecoveredStaysRecovered   
)

Definition at line 296 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [20/25]

TEST ( CASir  ,
SusceptibleStaysSWithoutInfectedNeighbours   
)

Definition at line 309 of file tpl_ca_stochastic_rules_test.cc.

◆ TEST() [21/25]

TEST ( CAStochasticReproducibility  ,
ForestFireIdenticalAcrossThreadCounts   
)

Definition at line 500 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::frames_equal(), and seed.

◆ TEST() [22/25]

TEST ( CAStochasticReproducibility  ,
IsingGlauberIdenticalAcrossThreadCounts   
)

Definition at line 537 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::frames_equal(), rng, and seed.

◆ TEST() [23/25]

TEST ( CAStochasticReproducibility  ,
SchellingIdenticalAcrossThreadCounts   
)

Definition at line 557 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::frames_equal(), and seed.

◆ TEST() [24/25]

◆ TEST() [25/25]

TEST ( CAStochasticReproducibility  ,
SIRIdenticalAcrossThreadCounts   
)

Definition at line 521 of file tpl_ca_stochastic_rules_test.cc.

References Aleph::CA::frames_equal(), and seed.