def test1_trans_topology_a():
  ao = ActiveObject()
  ao.start_at(outer)
  pp(ao.spy_full())
  assert(ao.spy_full() ==
    ['START',
     'SEARCH_FOR_SUPER_SIGNAL:outer',
     'ENTRY_SIGNAL:outer',
     'INIT_SIGNAL:outer',
     '<- Queued:(0) Deferred:(0)']
  )
  pp(ao.spy_full())
  print(ao.trace())
  event_w = Event(signal=signals.WaitComplete)
  ao.clear_trace()
  ao.post_fifo(event_w)
  import time
  time.sleep(0.1)
  pp(ao.spy_rtc())
  print(ao.trace())

  # stop the threads
  ao.stop()

  # clear the spy and the trace
  ao.clear_spy()
  ao.clear_trace()

  # post a number of events and see what happens
  event_wait_complete = Event(signal=signals.WaitComplete)
  event_reset_chart = Event(signal=signals.ResetChart)
  ao.post_fifo(event_wait_complete)
  ao.post_fifo(event_reset_chart)
  ao.post_fifo(event_wait_complete)
  ao.post_fifo(event_reset_chart)
  time.sleep(0.3)
  print(ao.trace())
  pp(ao.spy_full())
Exemple #2
0
def test_graffiti_spy():
  ao = ActiveObject(name="scribbled_on")
  ao.start_at(g1_s22_active_objects_graph)
  time.sleep(0.2)
  ao.stop()
  pp(ao.spy())