Clean up the unit tests.
- Make Python tests cwd-agnostic.
- Use boost::test.
- Add a benchmark.
- Use a library to clean up test/Makefile.am.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665640 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/TMemoryBufferTest.cpp b/test/TMemoryBufferTest.cpp
index 2b2f90c..970ec47 100644
--- a/test/TMemoryBufferTest.cpp
+++ b/test/TMemoryBufferTest.cpp
@@ -1,11 +1,4 @@
-/*
-thrift -cpp ThriftTest.thrift
-g++ -Wall -g -I../lib/cpp/src -I/usr/local/include/boost-1_33_1 \
- TMemoryBufferTest.cpp gen-cpp/ThriftTest_types.cpp \
- ../lib/cpp/.libs/libthrift.a -o TMemoryBufferTest
-./TMemoryBufferTest
-*/
-
+#include <boost/test/unit_test.hpp>
#include <iostream>
#include <climits>
#include <cassert>
@@ -13,9 +6,9 @@
#include <protocol/TBinaryProtocol.h>
#include "gen-cpp/ThriftTest_types.h"
+BOOST_AUTO_TEST_SUITE( TMemoryBufferTest )
-int main(int argc, char** argv) {
- {
+BOOST_AUTO_TEST_CASE( test_roundtrip ) {
using facebook::thrift::transport::TMemoryBuffer;
using facebook::thrift::protocol::TBinaryProtocol;
using boost::shared_ptr;
@@ -41,6 +34,7 @@
assert(a == a2);
}
+BOOST_AUTO_TEST_CASE( test_copy )
{
using facebook::thrift::transport::TMemoryBuffer;
using std::string;
@@ -66,6 +60,7 @@
assert(str4 == "67891234");
}
+BOOST_AUTO_TEST_CASE( test_exceptions )
{
using facebook::thrift::transport::TTransportException;
using facebook::thrift::transport::TMemoryBuffer;
@@ -90,5 +85,4 @@
}
}
-
-}
+BOOST_AUTO_TEST_SUITE_END()