From 09b16daca270ed0ade1f41f76c0910d6442e95de Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Apr 2014 23:46:04 -0700 Subject: fix virtual_time and test scheduler --- Rx/v2/test/operators/publish.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Rx/v2/test/operators/publish.cpp') diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index f043d18..02d799b 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -50,6 +50,7 @@ SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ SCENARIO("publish", "[publish][multicast][operators]"){ GIVEN("a test hot observable of longs"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -77,24 +78,24 @@ SCENARIO("publish", "[publish][multicast][operators]"){ }; auto xs = sc.make_hot_observable(messages); - auto res = sc.make_subscriber(); + auto res = w.make_subscriber(); rx::connectable_observable ys; WHEN("subscribed and then connected"){ - sc.schedule_absolute(rxsc::test::created_time, + w.schedule_absolute(rxsc::test::created_time, [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ ys = xs.publish().as_dynamic(); //ys = xs.publish_last().as_dynamic(); }); - sc.schedule_absolute(rxsc::test::subscribed_time, + w.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl){ ys.subscribe(res); }); - sc.schedule_absolute(rxsc::test::unsubscribed_time, + w.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl){ res.unsubscribe(); }); @@ -102,11 +103,11 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(300, + w.schedule_absolute(300, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(400, + w.schedule_absolute(400, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); @@ -115,11 +116,11 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(500, + w.schedule_absolute(500, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(550, + w.schedule_absolute(550, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); @@ -128,17 +129,17 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(650, + w.schedule_absolute(650, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(800, + w.schedule_absolute(800, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); } - sc.start(); + w.start(); THEN("the output only contains items sent while subscribed"){ record items[] = { -- cgit v1.2.3