3 #if !defined(RXCPP_RX_TEST_HPP) 4 #define RXCPP_RX_TEST_HPP 15 struct test_subject_base
16 :
public std::enable_shared_from_this<test_subject_base<T>>
19 typedef std::shared_ptr<test_subject_base<T>> type;
21 virtual ~test_subject_base() {}
23 virtual std::vector<recorded_type> messages()
const =0;
24 virtual std::vector<rxn::subscription> subscriptions()
const =0;
31 explicit test_source(
typename test_subject_base<T>::type ts)
34 if (!this->ts) std::terminate();
36 typename test_subject_base<T>::type ts;
38 ts->on_subscribe(std::move(o));
40 template<
class Subscriber>
41 typename std::enable_if<!std::is_same<Subscriber, subscriber<T>>::value,
void>::type
42 on_subscribe(Subscriber o)
const {
46 ts->on_subscribe(o.as_dynamic());
57 typedef typename detail::test_subject_base<T>::type test_subject;
64 : observer_base(std::move(ob))
70 return ts->messages();
84 :
public observable<T, typename detail::test_source<T>>
87 typedef typename detail::test_subject_base<T>::type test_subject;
96 : observable_base(detail::test_source<T>(ts))
102 return ts->subscriptions();
106 return ts->messages();
119 template<
class T,
class OperatorFactory>
121 -> decltype(source.op(std::forward<OperatorFactory>(of))) {
122 return source.op(std::forward<OperatorFactory>(of));
129 template<
class T,
class OperatorFactory>
131 -> decltype(source.op(std::forward<OperatorFactory>(of))) {
132 return source.op(std::forward<OperatorFactory>(of));
Definition: rx-notification.hpp:253
Definition: rx-all.hpp:26
auto operator>>(const rxcpp::test::testable_observable< T > &source, OperatorFactory &&of) -> decltype(source.op(std::forward< OperatorFactory >(of)))
Definition: rx-test.hpp:120
std::vector< recorded_type > messages() const
Definition: rx-test.hpp:69
auto operator|(const rxcpp::test::testable_observable< T > &source, OperatorFactory &&of) -> decltype(source.op(std::forward< OperatorFactory >(of)))
Definition: rx-test.hpp:130
a source of values. subscribe or use one of the operator methods that return a new observable...
Definition: rx-observable.hpp:510
detail::test_subject_base< T >::recorded_type recorded_type
Definition: rx-test.hpp:93
testable_observer(test_subject ts, observer_base ob)
Definition: rx-test.hpp:63
consumes values from an observable using State that may implement on_next, on_error and on_completed ...
Definition: rx-observer.hpp:179
testable_observable(test_subject ts)
Definition: rx-test.hpp:95
a source of values that records the time of each subscription/unsubscription and all the values and t...
Definition: rx-test.hpp:83
binds an observer that consumes values with a composite_subscription that controls lifetime...
Definition: rx-subscriber.hpp:25
std::vector< recorded_type > messages() const
Definition: rx-test.hpp:105
Definition: rx-predef.hpp:115
Definition: rx-sources.hpp:17
Definition: rx-test.hpp:53
detail::test_subject_base< T >::recorded_type recorded_type
Definition: rx-test.hpp:61
std::vector< rxn::subscription > subscriptions() const
Definition: rx-test.hpp:101