summaryrefslogtreecommitdiff
path: root/Rx/v2/test/operators/scan.cpp
diff options
context:
space:
mode:
authorValeriy Kopylov <valery.kopylov@akvelon.com>2014-06-25 17:31:55 +0400
committerValeriy Kopylov <valery.kopylov@akvelon.com>2014-06-25 17:31:55 +0400
commit07704df69b93414b638aa5433d6418df5c69e157 (patch)
treeb4818700191e457cd718a837506ee0d89e7eddf8 /Rx/v2/test/operators/scan.cpp
parentee34d63f1905d5ecc4246d83fae014579c12115a (diff)
downloadRxCpp-07704df69b93414b638aa5433d6418df5c69e157.tar.gz
Switch existing tests to use a new style
Remove unnecessary local vars, typedefs, namespaces, and templates specialization from tests.
Diffstat (limited to 'Rx/v2/test/operators/scan.cpp')
-rw-r--r--Rx/v2/test/operators/scan.cpp57
1 files changed, 20 insertions, 37 deletions
diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp
index 27ab1c5..3615ff2 100644
--- a/Rx/v2/test/operators/scan.cpp
+++ b/Rx/v2/test/operators/scan.cpp
@@ -1,45 +1,30 @@
-
#include "rxcpp/rx.hpp"
-namespace rx=rxcpp;
namespace rxu=rxcpp::util;
-namespace rxo=rxcpp::operators;
-namespace rxs=rxcpp::sources;
namespace rxsc=rxcpp::schedulers;
-namespace rxsub=rxcpp::subjects;
-namespace rxn=rxcpp::notifications;
#include "rxcpp/rx-test.hpp"
-namespace rxt=rxcpp::test;
-
#include "catch.hpp"
SCENARIO("scan some data with seed", "[scan][operators]"){
GIVEN("a test hot observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
- typedef rxsc::test::messages<int> m;
- typedef rxn::subscription life;
- typedef m::recorded_type record;
- auto on_next = m::on_next;
- auto on_error = m::on_error;
- auto on_completed = m::on_completed;
- auto subscribe = m::subscribe;
+ const rxsc::test::messages<int> on;
int seed = 1;
- record messages[] = {
- on_next(150, 1),
- on_next(210, 2),
- on_next(220, 3),
- on_next(230, 4),
- on_next(240, 5),
- on_completed(250)
- };
- auto xs = sc.make_hot_observable(messages);
+ auto xs = sc.make_hot_observable({
+ on.on_next(150, 1),
+ on.on_next(210, 2),
+ on.on_next(220, 3),
+ on.on_next(230, 4),
+ on.on_next(240, 5),
+ on.on_completed(250)
+ });
WHEN("mapped to ints that are one larger"){
- auto res = w.start<int>(
+ auto res = w.start(
[&]() {
return xs
.scan(seed, [](int sum, int x) {
@@ -51,23 +36,21 @@ SCENARIO("scan some data with seed", "[scan][operators]"){
);
THEN("the output stops on completion"){
- record items[] = {
- on_next(210, seed + 2),
- on_next(220, seed + 2 + 3),
- on_next(230, seed + 2 + 3 + 4),
- on_next(240, seed + 2 + 3 + 4 + 5),
- on_completed(250)
- };
- auto required = rxu::to_vector(items);
+ auto required = rxu::to_vector({
+ on.on_next(210, seed + 2),
+ on.on_next(220, seed + 2 + 3),
+ on.on_next(230, seed + 2 + 3 + 4),
+ on.on_next(240, seed + 2 + 3 + 4 + 5),
+ on.on_completed(250)
+ });
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
- life items[] = {
- subscribe(200, 250)
- };
- auto required = rxu::to_vector(items);
+ auto required = rxu::to_vector({
+ on.subscribe(200, 250)
+ });
auto actual = xs.subscriptions();
REQUIRE(required == actual);
}