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

Tests for the Phase-7 CA observer suite. More...

#include <cstdint>
#include <random>
#include <vector>
#include <gtest/gtest.h>
#include <ca-engine-utils.H>
#include <ca-metrics.H>
#include <ca-observer.H>
#include <ca-traits.H>
#include <tpl_ca_engine.H>
#include <tpl_ca_lattice.H>
#include <tpl_ca_neighborhood.H>
#include <tpl_ca_rule.H>
#include <tpl_ca_storage.H>
Include dependency graph for ca_observer_test.cc:

Go to the source code of this file.

Functions

 TEST (CAComposite, FansOutBothCallbacksToEveryChild)
 
 TEST (CAComposite, FactoryPreservesLvalueObserverReferences)
 
 TEST (CAActivityObserver, BlinkerReportsFourChangesPerStep)
 
 TEST (CAActivityObserver, BlockIsStillSoActivityIsZero)
 
 TEST (CADensityObserver, InitialFrameIsCapturedAndStepsAccumulate)
 
 TEST (CADensityObserver, GoLRandomDensityLandsInExpectedBand)
 
 TEST (CAStationaryDetector, BlinkerYieldsCycleLengthTwo)
 
 TEST (CAStationaryDetector, BlockYieldsCycleLengthOne)
 
 TEST (CAStationaryDetector, NoCycleDetectedWhenWindowIsTooSmall)
 
 TEST (CASamplingObserver, SnapshotsAtConfiguredPeriod)
 
 TEST (CASamplingObserver, ZeroPeriodDisablesSampling)
 
 TEST (CAEntropyObserver, EntropyZeroForEmptyAndConstantFrames)
 
 TEST (CAEntropyObserver, EntropyPositiveOnRandomFrame)
 
 TEST (CAComposite, MultipleObserversObserveTheSameRun)
 

Detailed Description

Tests for the Phase-7 CA observer suite.

Scope:

  • Concept conformance (ObserverLike).
  • Composite_Observer dispatches on_step_begin/end to all children.
  • Density_Observer records initial frame + one sample per step.
  • Activity_Observer reports 4 changed cells per step on a blinker (canonical Phase-7 acceptance criterion).
  • Stationary_Detector reports cycle length 2 on a blinker.
  • Stationary_Detector reports cycle length 1 on a still life.
  • Sampling_Observer snapshots at the configured period.
  • Entropy_Observer produces a non-trivial time series for a random GoL seed.
  • Density of GoL with a fixed random seed lands inside an expected band.

Definition in file ca_observer_test.cc.

Function Documentation

◆ TEST() [1/14]

TEST ( CAActivityObserver  ,
BlinkerReportsFourChangesPerStep   
)

◆ TEST() [2/14]

TEST ( CAActivityObserver  ,
BlockIsStillSoActivityIsZero   
)

◆ TEST() [3/14]

TEST ( CAComposite  ,
FactoryPreservesLvalueObserverReferences   
)

◆ TEST() [4/14]

TEST ( CAComposite  ,
FansOutBothCallbacksToEveryChild   
)

◆ TEST() [5/14]

TEST ( CAComposite  ,
MultipleObserversObserveTheSameRun   
)

◆ TEST() [6/14]

TEST ( CADensityObserver  ,
GoLRandomDensityLandsInExpectedBand   
)

◆ TEST() [7/14]

TEST ( CADensityObserver  ,
InitialFrameIsCapturedAndStepsAccumulate   
)

◆ TEST() [8/14]

TEST ( CAEntropyObserver  ,
EntropyPositiveOnRandomFrame   
)

◆ TEST() [9/14]

TEST ( CAEntropyObserver  ,
EntropyZeroForEmptyAndConstantFrames   
)

◆ TEST() [10/14]

TEST ( CASamplingObserver  ,
SnapshotsAtConfiguredPeriod   
)

◆ TEST() [11/14]

TEST ( CASamplingObserver  ,
ZeroPeriodDisablesSampling   
)

◆ TEST() [12/14]

TEST ( CAStationaryDetector  ,
BlinkerYieldsCycleLengthTwo   
)

◆ TEST() [13/14]

TEST ( CAStationaryDetector  ,
BlockYieldsCycleLengthOne   
)

◆ TEST() [14/14]

TEST ( CAStationaryDetector  ,
NoCycleDetectedWhenWindowIsTooSmall   
)