If you want to track events which are related to each other you might use the
two classes TrackingCounterMaster
and
TrackingCounterClient
. The master contains
a shared conter value. Each time one of the clients is activated it gets the
current value from the master and stores it. The value inside the master is
incremented at the same time. This way you can roughly check the order in which
the clients were accessed. It is also possible to retrieve each counter value
of a client and not only the last one.
TrackingCounterMaster master ("master", 0); TrackingCounterClient client1 ("client-1", master); TrackingCounterClient client2 ("client-2", master); master.setExpected(5, 10); client1.setExpected(2); client2.setExpected(2, 8); client1++; client2++; master.verify();