[Assorted-commits] SF.net SVN: assorted:[1353] cpp-commons/trunk/src/test/st.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-04-29 05:24:17
|
Revision: 1353 http://assorted.svn.sourceforge.net/assorted/?rev=1353&view=rev Author: yangzhang Date: 2009-04-29 05:24:10 +0000 (Wed, 29 Apr 2009) Log Message: ----------- added channel test to st tests Modified Paths: -------------- cpp-commons/trunk/src/test/st.cc Modified: cpp-commons/trunk/src/test/st.cc =================================================================== --- cpp-commons/trunk/src/test/st.cc 2009-04-29 04:28:27 UTC (rev 1352) +++ cpp-commons/trunk/src/test/st.cc 2009-04-29 05:24:10 UTC (rev 1353) @@ -7,3 +7,23 @@ ch.push(unique_ptr<int>(new int(0))); unique_ptr<int> p = ch.take(); } + +struct a { + a() {} + a(const a &) { ADD_FAILURE() << "shouldn't be copying"; } + a(a &&) {} + void operator=(const a &) { ADD_FAILURE() << "shouldn't be copying"; } + void operator=(a &&) {} + void f() {} +}; + +TEST(st, channel2) { + st_channel<a> ch; + ch.push(a()); + a s; + ch.push(move(s)); + + a x = ch.take(); + x.f(); + ch.take(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |