File indexing completed on 2026-03-28 07:46:22
0001 import acts
0002 import acts.examples
0003
0004
0005 def test_hello_world_sequence():
0006 class WhiteBoardKeyInspector(acts.examples.IAlgorithm):
0007 def __init__(self):
0008 super().__init__(name="WhiteBoardKeyInspector", level=acts.logging.INFO)
0009 self.seenEvents = 0
0010
0011 def execute(self, context):
0012 keys = context.eventStore.keys
0013 assert "random_data" in keys
0014 assert "copied_data" in keys
0015 self.seenEvents += 1
0016 return acts.examples.ProcessCode.SUCCESS
0017
0018 eventsCount = 10
0019 logLevel = acts.logging.INFO
0020
0021 rnd = acts.examples.RandomNumbers(seed=42)
0022 seq = acts.examples.Sequencer(events=eventsCount, numThreads=1, logLevel=logLevel)
0023
0024 seq.addAlgorithm(acts.examples.HelloLoggerAlgorithm(level=logLevel))
0025
0026 randomCfg = acts.examples.HelloRandomAlgorithm.Config()
0027 randomCfg.randomNumbers = rnd
0028 randomCfg.gaussParameters = (0.0, 2.5)
0029 randomCfg.uniformParameters = (-1.23, 4.25)
0030 randomCfg.gammaParameters = (1.0, 1.0)
0031 randomCfg.drawsPerEvent = 5000
0032 randomCfg.output = "random_data"
0033 seq.addAlgorithm(acts.examples.HelloRandomAlgorithm(randomCfg, level=logLevel))
0034
0035 whiteboardCfg = acts.examples.HelloWhiteBoardAlgorithm.Config()
0036 whiteboardCfg.input = randomCfg.output
0037 whiteboardCfg.output = "copied_data"
0038 seq.addAlgorithm(
0039 acts.examples.HelloWhiteBoardAlgorithm(whiteboardCfg, level=logLevel)
0040 )
0041
0042 inspector = WhiteBoardKeyInspector()
0043 seq.addAlgorithm(inspector)
0044
0045 seq.run()
0046
0047 assert inspector.seenEvents == eventsCount