summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am12
-rw-r--r--test/addr_test.cpp26
-rw-r--r--test/cppunit_test.cpp25
-rw-r--r--test/device_test.cpp22
-rw-r--r--test/main_test.cpp3
-rw-r--r--test/usrp_dboard_test.cpp26
-rw-r--r--test/wax_test.cpp32
7 files changed, 30 insertions, 116 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 0fbb18bf8..46b1de0e6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,7 +6,7 @@ include $(top_srcdir)/Makefile.common
SUBDIRS =
-if HAVE_CPPUNIT
+if HAVE_UNIT_TEST
AM_CPPFLAGS = \
$(GENERAL_CPPFLAGS) \
@@ -14,15 +14,15 @@ AM_CPPFLAGS = \
LDADD = \
$(GENERAL_LDDFLAGS) \
- $(USRP_UHD_LA) \
- $(CPPUNIT_LIBS)
+ $(BOOST_UNIT_TEST_FRAMEWORK_LIB) \
+ $(USRP_UHD_LA)
-noinst_PROGRAMS = cppunit_test
+noinst_PROGRAMS = main_test
-cppunit_test_SOURCES = \
+main_test_SOURCES = \
+ main_test.cpp \
addr_test.cpp \
device_test.cpp \
- cppunit_test.cpp \
usrp_dboard_test.cpp \
wax_test.cpp
diff --git a/test/addr_test.cpp b/test/addr_test.cpp
index 65792aabc..e2fc36f38 100644
--- a/test/addr_test.cpp
+++ b/test/addr_test.cpp
@@ -2,39 +2,23 @@
// Copyright 2010 Ettus Research LLC
//
+#include <boost/test/unit_test.hpp>
#include <usrp_uhd/device_addr.hpp>
-#include <cppunit/extensions/HelperMacros.h>
-/***********************************************************************
- * cpp unit setup
- **********************************************************************/
-class addr_test : public CppUnit::TestFixture{
- CPPUNIT_TEST_SUITE(addr_test);
- CPPUNIT_TEST(test_mac_addr);
- CPPUNIT_TEST(test_ip_addr);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void test_mac_addr(void);
- void test_ip_addr(void);
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(addr_test);
-
-void addr_test::test_mac_addr(void){
+BOOST_AUTO_TEST_CASE(test_mac_addr){
std::cout << "Testing mac addr..." << std::endl;
const std::string mac_addr_str("00:01:23:45:67:89");
usrp_uhd::mac_addr_t mac_addr(mac_addr_str);
std::cout << "Input: " << mac_addr_str << std::endl;
std::cout << "Output: " << mac_addr << std::endl;
- CPPUNIT_ASSERT_EQUAL(mac_addr_str, mac_addr.to_string());
+ BOOST_CHECK_EQUAL(mac_addr_str, mac_addr.to_string());
}
-void addr_test::test_ip_addr(void){
+BOOST_AUTO_TEST_CASE(test_ip_addr){
std::cout << "Testing ip addr..." << std::endl;
const std::string ip_addr_str("192.168.1.10");
usrp_uhd::ip_addr_t ip_addr(ip_addr_str);
std::cout << "Input: " << ip_addr_str << std::endl;
std::cout << "Output: " << ip_addr << std::endl;
- CPPUNIT_ASSERT_EQUAL(ip_addr_str, ip_addr.to_string());
+ BOOST_CHECK_EQUAL(ip_addr_str, ip_addr.to_string());
}
diff --git a/test/cppunit_test.cpp b/test/cppunit_test.cpp
deleted file mode 100644
index d4bfff9db..000000000
--- a/test/cppunit_test.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//http://cppunit.sourceforge.net/doc/lastest/money_example.html
-
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-
-int main(int, char* [])
-{
- // Get the top level suite from the registry
- CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
-
- // Adds the test to the list of test to run
- CppUnit::TextUi::TestRunner runner;
- runner.addTest( suite );
-
- // Change the default outputter to a compiler error format outputter
- runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
- std::cerr ) );
- // Run the tests.
- bool wasSucessful = runner.run();
-
- // Return error code 1 if the one of test failed.
- return wasSucessful ? 0 : 1;
-}
diff --git a/test/device_test.cpp b/test/device_test.cpp
index 66256ba88..db305097b 100644
--- a/test/device_test.cpp
+++ b/test/device_test.cpp
@@ -2,26 +2,12 @@
// Copyright 2010 Ettus Research LLC
//
+#include <boost/test/unit_test.hpp>
#include <usrp_uhd/device.hpp>
-#include <cppunit/extensions/HelperMacros.h>
-
-/***********************************************************************
- * cpp unit setup
- **********************************************************************/
-class device_test : public CppUnit::TestFixture{
- CPPUNIT_TEST_SUITE(device_test);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void test(void);
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(device_test);
using namespace usrp_uhd;
-void device_test::test(void){
+BOOST_AUTO_TEST_CASE(test_device){
device_addr_t device_addr(DEVICE_ADDR_TYPE_VIRTUAL);
device_addr.virtual_args.num_dboards = 2;
device_addr.virtual_args.num_rx_dsps = 3;
@@ -34,11 +20,11 @@ void device_test::test(void){
std::cout << "Access the mboard" << std::endl;
wax::proxy mb0 = (*dev)[DEVICE_PROP_MBOARD];
std::cout << wax::cast<std::string>(mb0[MBOARD_PROP_NAME]) << std::endl;
- CPPUNIT_ASSERT_EQUAL(
+ BOOST_CHECK_EQUAL(
device_addr.virtual_args.num_dboards,
wax::cast<size_t>(mb0[MBOARD_PROP_NUM_RX_DBOARDS])
);
- CPPUNIT_ASSERT_EQUAL(
+ BOOST_CHECK_EQUAL(
device_addr.virtual_args.num_dboards,
wax::cast<size_t>(mb0[MBOARD_PROP_NUM_TX_DBOARDS])
);
diff --git a/test/main_test.cpp b/test/main_test.cpp
new file mode 100644
index 000000000..0b47303b7
--- /dev/null
+++ b/test/main_test.cpp
@@ -0,0 +1,3 @@
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
diff --git a/test/usrp_dboard_test.cpp b/test/usrp_dboard_test.cpp
index 8d8b1de4a..1e89f36f9 100644
--- a/test/usrp_dboard_test.cpp
+++ b/test/usrp_dboard_test.cpp
@@ -2,8 +2,8 @@
// Copyright 2010 Ettus Research LLC
//
+#include <boost/test/unit_test.hpp>
#include <usrp_uhd/usrp/dboard/manager.hpp>
-#include <cppunit/extensions/HelperMacros.h>
using namespace usrp_uhd::usrp::dboard;
@@ -26,21 +26,7 @@ public:
std::string read_spi (spi_dev_t, spi_latch_t, size_t){return "";}
};
-/***********************************************************************
- * cpp unit setup
- **********************************************************************/
-class dboard_test : public CppUnit::TestFixture{
- CPPUNIT_TEST_SUITE(dboard_test);
- CPPUNIT_TEST(test_manager);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void test_manager(void);
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(dboard_test);
-
-void dboard_test::test_manager(void){
+BOOST_AUTO_TEST_CASE(test_manager){
std::cout << "Making a dummy usrp dboard interface..." << std::endl;
interface::sptr ifc0(new dummy_interface());
@@ -48,12 +34,12 @@ void dboard_test::test_manager(void){
manager::sptr mgr0(new manager(0x0001, 0x0000, ifc0)); //basic rx, basic tx
std::cout << "Testing the dboard manager..." << std::endl;
- CPPUNIT_ASSERT_EQUAL(size_t(3), mgr0->get_num_rx_subdevs());
- CPPUNIT_ASSERT_EQUAL(size_t(1), mgr0->get_num_tx_subdevs());
+ BOOST_CHECK_EQUAL(size_t(3), mgr0->get_num_rx_subdevs());
+ BOOST_CHECK_EQUAL(size_t(1), mgr0->get_num_tx_subdevs());
std::cout << "Testing access (will fail later when db code filled in)..." << std::endl;
- CPPUNIT_ASSERT_THROW(mgr0->get_rx_subdev(3), std::out_of_range);
- CPPUNIT_ASSERT_THROW(mgr0->get_tx_subdev(1), std::out_of_range);
+ BOOST_CHECK_THROW(mgr0->get_rx_subdev(3), std::out_of_range);
+ BOOST_CHECK_THROW(mgr0->get_tx_subdev(1), std::out_of_range);
(*mgr0->get_rx_subdev(0))[NULL];
(*mgr0->get_tx_subdev(0))[NULL];
}
diff --git a/test/wax_test.cpp b/test/wax_test.cpp
index 0221f13b8..353130410 100644
--- a/test/wax_test.cpp
+++ b/test/wax_test.cpp
@@ -2,8 +2,8 @@
// Copyright 2010 Ettus Research LLC
//
+#include <boost/test/unit_test.hpp>
#include <usrp_uhd/wax.hpp>
-#include <cppunit/extensions/HelperMacros.h>
/***********************************************************************
* demo class for wax framework
@@ -40,29 +40,9 @@ public:
}
};
-/***********************************************************************
- * cpp unit setup
- **********************************************************************/
-class wax_test : public CppUnit::TestFixture{
- CPPUNIT_TEST_SUITE(wax_test);
- CPPUNIT_TEST(test_chaining);
- CPPUNIT_TEST(test_set_get);
- CPPUNIT_TEST(test_proxy);
- CPPUNIT_TEST(test_print);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void test_chaining(void);
- void test_set_get(void);
- void test_proxy(void);
- void test_print(void);
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(wax_test);
-
static wax_demo wd(2, 10);
-void wax_test::test_chaining(void){
+BOOST_AUTO_TEST_CASE(test_chaining){
std::cout << "chain 1" << std::endl;
wd[size_t(0)];
std::cout << "chain 2" << std::endl;
@@ -71,7 +51,7 @@ void wax_test::test_chaining(void){
wd[size_t(0)][size_t(0)][size_t(0)];
}
-void wax_test::test_set_get(void){
+BOOST_AUTO_TEST_CASE(test_set_get){
std::cout << "set and get all" << std::endl;
for (size_t i = 0; i < 10; i++){
for (size_t j = 0; j < 10; j++){
@@ -79,19 +59,19 @@ void wax_test::test_set_get(void){
float val = i * j * k + i + j + k;
//std::cout << i << " " << j << " " << k << std::endl;
wd[i][j][k] = val;
- CPPUNIT_ASSERT_EQUAL(val, wax::cast<float>(wd[i][j][k]));
+ BOOST_CHECK_EQUAL(val, wax::cast<float>(wd[i][j][k]));
}
}
}
}
-void wax_test::test_proxy(void){
+BOOST_AUTO_TEST_CASE(test_proxy){
std::cout << "store proxy" << std::endl;
wax::proxy p = wd[size_t(0)][size_t(0)];
p[size_t(0)] = float(5);
}
-void wax_test::test_print(void){
+BOOST_AUTO_TEST_CASE(test_print){
std::cout << "print type" << std::endl;
wax::type test_type = float(3.33);
std::cout << test_type << std::endl;