@@ -90,11 +90,11 @@ TYPED_TEST_P(EventStreamTest, EventMerge1)
9090
9191 auto merged = Merge (a1, a2, a3);
9292
93- std::queue <int > results;
93+ std::vector <int > results;
9494
9595 Observe (merged, [&] (int v)
9696 {
97- results.push (v);
97+ results.push_back (v);
9898 });
9999
100100 {
@@ -104,19 +104,10 @@ TYPED_TEST_P(EventStreamTest, EventMerge1)
104104 a3 << 30 ;
105105 }
106106
107- ASSERT_FALSE (results.empty ());
108- ASSERT_EQ (results.front (),10 );
109- results.pop ();
110-
111- ASSERT_FALSE (results.empty ());
112- ASSERT_EQ (results.front (),20 );
113- results.pop ();
114-
115- ASSERT_FALSE (results.empty ());
116- ASSERT_EQ (results.front (),30 );
117- results.pop ();
118-
119- ASSERT_TRUE (results.empty ());
107+ ASSERT_EQ (results.size (), 3 );
108+ ASSERT_TRUE (std::find (results.begin (), results.end (), 10 ) != results.end ());
109+ ASSERT_TRUE (std::find (results.begin (), results.end (), 20 ) != results.end ());
110+ ASSERT_TRUE (std::find (results.begin (), results.end (), 30 ) != results.end ());
120111}
121112
122113// //////////////////////////////////////////////////////////////////////////////////////
@@ -130,38 +121,28 @@ TYPED_TEST_P(EventStreamTest, EventMerge2)
130121
131122 auto merged = Merge (a1, a2, a3);
132123
133- std::queue <std::string> results;
124+ std::vector <std::string> results;
134125
135126 Observe (merged, [&] (std::string s)
136127 {
137- results.push (s);
128+ results.push_back (s);
138129 });
139130
140131 std::string s1 (" one" );
141132 std::string s2 (" two" );
142133 std::string s3 (" three" );
143134
144135 {
145- MyDomain::ScopedTransaction t;
146-
136+ MyDomain::ScopedTransaction _;
147137 a1 << s1;
148138 a2 << s2;
149139 a3 << s3;
150140 }
151141
152- ASSERT_FALSE (results.empty ());
153- ASSERT_EQ (results.front (), " one" );
154- results.pop ();
155-
156- ASSERT_FALSE (results.empty ());
157- ASSERT_EQ (results.front (), " two" );
158- results.pop ();
159-
160- ASSERT_FALSE (results.empty ());
161- ASSERT_EQ (results.front (), " three" );
162- results.pop ();
163-
164- ASSERT_TRUE (results.empty ());
142+ ASSERT_EQ (results.size (), 3 );
143+ ASSERT_TRUE (std::find (results.begin (), results.end (), " one" ) != results.end ());
144+ ASSERT_TRUE (std::find (results.begin (), results.end (), " two" ) != results.end ());
145+ ASSERT_TRUE (std::find (results.begin (), results.end (), " three" ) != results.end ());
165146}
166147
167148// //////////////////////////////////////////////////////////////////////////////////////
@@ -237,7 +218,7 @@ TYPED_TEST_P(EventStreamTest, EventFilter)
237218// //////////////////////////////////////////////////////////////////////////////////////
238219TYPED_TEST_P (EventStreamTest, EventTransform)
239220{
240- std::queue <std::string> results;
221+ std::vector <std::string> results;
241222
242223 auto in1 = MyDomain::MakeEventSource<std::string>();
243224 auto in2 = MyDomain::MakeEventSource<std::string>();
@@ -247,36 +228,22 @@ TYPED_TEST_P(EventStreamTest, EventTransform)
247228 auto transformed = Transform (merged, [] (std::string s) -> std::string
248229 {
249230 std::transform (s.begin (), s.end (), s.begin (), ::toupper);
250-
251231 return s;
252232 });
253233
254- int obsCount = 0 ;
255234
256235 Observe (transformed, [&] (const std::string& s)
257236 {
258- obsCount++;
259- results.push (s);
237+ results.push_back (s);
260238 });
261239
262240 in1 << " Hello Worlt" << " Hello World" ;
263241 in2 << " Hello Vorld" ;
264242
265- ASSERT_EQ (obsCount, 3 );
266-
267- ASSERT_FALSE (results.empty ());
268- ASSERT_EQ (results.front (), " HELLO WORLT" );
269- results.pop ();
270-
271- ASSERT_FALSE (results.empty ());
272- ASSERT_EQ (results.front (), " HELLO WORLD" );
273- results.pop ();
274-
275- ASSERT_FALSE (results.empty ());
276- ASSERT_EQ (results.front (), " HELLO VORLD" );
277- results.pop ();
278-
279- ASSERT_TRUE (results.empty ());
243+ ASSERT_EQ (results.size (), 3 );
244+ ASSERT_TRUE (std::find (results.begin (), results.end (), " HELLO WORLT" ) != results.end ());
245+ ASSERT_TRUE (std::find (results.begin (), results.end (), " HELLO WORLD" ) != results.end ());
246+ ASSERT_TRUE (std::find (results.begin (), results.end (), " HELLO VORLD" ) != results.end ());
280247}
281248
282249// //////////////////////////////////////////////////////////////////////////////////////
0 commit comments