[Assorted-commits] SF.net SVN: assorted:[1276] cpp-commons/trunk/src/test
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-09 22:59:42
|
Revision: 1276 http://assorted.svn.sourceforge.net/assorted/?rev=1276&view=rev Author: yangzhang Date: 2009-03-09 22:59:33 +0000 (Mon, 09 Mar 2009) Log Message: ----------- added tests for array, st Modified Paths: -------------- cpp-commons/trunk/src/test/Makefile Added Paths: ----------- cpp-commons/trunk/src/test/array.cc cpp-commons/trunk/src/test/st.cc Modified: cpp-commons/trunk/src/test/Makefile =================================================================== --- cpp-commons/trunk/src/test/Makefile 2009-03-09 22:56:37 UTC (rev 1275) +++ cpp-commons/trunk/src/test/Makefile 2009-03-09 22:59:33 UTC (rev 1276) @@ -42,4 +42,7 @@ clean: rm -f $(BINS) +st: st.cc + $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -lst -lstx -lresolv -o $@ + .PHONY: all build clean Added: cpp-commons/trunk/src/test/array.cc =================================================================== --- cpp-commons/trunk/src/test/array.cc (rev 0) +++ cpp-commons/trunk/src/test/array.cc 2009-03-09 22:59:33 UTC (rev 1276) @@ -0,0 +1,17 @@ +#include <commons/array.h> +#include "test.h" + +static const int size = 4096; + +TEST(array, array) { + array<char> xs(size); + EXPECT_EQ(size, xs.size()); +} + +TEST(array, sized_array) { + char *p = new char[size]; + sized_array<char> xs(p, size); + EXPECT_EQ(size, xs.size()); + EXPECT_EQ(p, xs.get()); + EXPECT_EQ(p, xs.begin()); +} Added: cpp-commons/trunk/src/test/st.cc =================================================================== --- cpp-commons/trunk/src/test/st.cc (rev 0) +++ cpp-commons/trunk/src/test/st.cc 2009-03-09 22:59:33 UTC (rev 1276) @@ -0,0 +1,9 @@ +#include <commons/st/st.h> +#include <commons/unique_ptr.h> +#include "test.h" + +TEST(st, channel) { + st_channel<unique_ptr<int> > ch; + ch.push(unique_ptr<int>(new int(0))); + unique_ptr<int> p = ch.take(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |