aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-04-26 13:13:32 -0700
committerMartin Braun <martin.braun@ettus.com>2018-05-02 17:01:21 -0700
commit5d9a7c92d3eb0a9cb719e6e6386d533da59a51db (patch)
tree024bda2ede2231784b55c48e1a23ab39fd97182d /host/tests
parentc52c0b69fc151c7596f9754e6b1e40dede531134 (diff)
downloaduhd-5d9a7c92d3eb0a9cb719e6e6386d533da59a51db.tar.gz
uhd-5d9a7c92d3eb0a9cb719e6e6386d533da59a51db.tar.bz2
uhd-5d9a7c92d3eb0a9cb719e6e6386d533da59a51db.zip
lib: Purge use of boost::assign, except for uhd::dict
Replaced with initialization lists. Note: uhd::dict does not work with initializer lists without making changes to said data structure. This commit has no functional changes, so keeping the boost::assigns for uhd::dict.
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/blockdef_test.cpp28
-rw-r--r--host/tests/convert_test.cpp13
-rw-r--r--host/tests/device3_test.cpp6
-rw-r--r--host/tests/nocscript_expr_test.cpp18
-rw-r--r--host/tests/nocscript_ftable_test.cpp27
5 files changed, 44 insertions, 48 deletions
diff --git a/host/tests/blockdef_test.cpp b/host/tests/blockdef_test.cpp
index dc0b40ea9..7779150be 100644
--- a/host/tests/blockdef_test.cpp
+++ b/host/tests/blockdef_test.cpp
@@ -8,7 +8,6 @@
#include <iostream>
#include <map>
#include <stdint.h>
-#include <boost/assign/list_of.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/format.hpp>
#include <uhd/rfnoc/blockdef.hpp>
@@ -16,24 +15,25 @@
using namespace uhd::rfnoc;
BOOST_AUTO_TEST_CASE(test_lookup) {
- std::map<uint64_t, std::string> blocknames = boost::assign::list_of< std::pair<uint64_t, std::string> >
- (0, "NullSrcSink")
- (0xFF70000000000000, "FFT")
- (0xF112000000000001, "FIR")
- (0xF1F0000000000000, "FIFO")
- (0xD053000000000000, "Window")
- (0x5CC0000000000000, "SchmidlCox")
- ;
-
+ const std::map<uint64_t, std::string> blocknames{
+ {0, "NullSrcSink"},
+ {0xFF70000000000000, "FFT"},
+ {0xF112000000000001, "FIR"},
+ {0xF1F0000000000000, "FIFO"},
+ {0xD053000000000000, "Window"},
+ {0x5CC0000000000000, "SchmidlCox"}
+ };
std::cout << blocknames.size() << std::endl;
- for (std::map<uint64_t, std::string>::iterator it = blocknames.begin(); it != blocknames.end(); ++it) {
- std::cout << "Testing " << it->second << " => " << str(boost::format("%016X") % it->first) << std::endl;
- blockdef::sptr block_definition = blockdef::make_from_noc_id(it->first);
+ for (const auto block : blocknames) {
+ std::cout << "Testing " << block.second
+ << " => " << str(boost::format("%016X") % block.first)
+ << std::endl;
+ auto block_definition = blockdef::make_from_noc_id(block.first);
// If the previous function fails, it'll return a NULL pointer
BOOST_REQUIRE(block_definition);
BOOST_CHECK(block_definition->is_block());
- BOOST_CHECK_EQUAL(block_definition->get_name(), it->second);
+ BOOST_CHECK_EQUAL(block_definition->get_name(), block.second);
}
}
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp
index 1253b80d7..862e02073 100644
--- a/host/tests/convert_test.cpp
+++ b/host/tests/convert_test.cpp
@@ -8,7 +8,6 @@
#include <uhd/convert.hpp>
#include <boost/test/unit_test.hpp>
#include <stdint.h>
-#include <boost/assign/list_of.hpp>
#include <complex>
#include <vector>
#include <cstdlib>
@@ -128,13 +127,15 @@ static void test_convert_types_for_floats(
//make a list of all prio: best/generic combos
typedef std::pair<int, int> int_pair_t;
- std::vector<int_pair_t> prios = boost::assign::list_of
- (int_pair_t(0, 0)) (int_pair_t(-1, 0))
- (int_pair_t(0, -1)) (int_pair_t(-1, -1))
- ;
+ const std::vector<int_pair_t> prios{
+ int_pair_t(0, 0),
+ int_pair_t(-1, 0),
+ int_pair_t(0, -1),
+ int_pair_t(-1, -1)
+ };
//loopback foreach prio combo (generic vs best)
- for(const int_pair_t &prio: prios){
+ for (const auto &prio : prios) {
loopback(nsamps, in_id, out_id, input, output, prio.first, prio.second);
for (size_t i = 0; i < nsamps; i++){
MY_CHECK_CLOSE(input[i].real(), output[i].real(), value_type(1./(1 << 14)));
diff --git a/host/tests/device3_test.cpp b/host/tests/device3_test.cpp
index 3a7f7c6cb..eb29d560f 100644
--- a/host/tests/device3_test.cpp
+++ b/host/tests/device3_test.cpp
@@ -68,9 +68,9 @@ class pseudo_device3_impl : public uhd::device3
_tree->create<std::string>("/name").set("Test Pseudo-Device3");
// We can re-use this:
- std::map<size_t, ctrl_iface::sptr> ctrl_ifaces = boost::assign::map_list_of
- (0, ctrl_iface::sptr(new pseudo_ctrl_iface_impl()))
- ;
+ std::map<size_t, ctrl_iface::sptr> ctrl_ifaces{
+ {0, ctrl_iface::sptr(new pseudo_ctrl_iface_impl())}
+ };
// Add two block controls:
uhd::rfnoc::make_args_t make_args;
diff --git a/host/tests/nocscript_expr_test.cpp b/host/tests/nocscript_expr_test.cpp
index 68990ba56..19b4345c2 100644
--- a/host/tests/nocscript_expr_test.cpp
+++ b/host/tests/nocscript_expr_test.cpp
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(test_literals)
expression_literal literal_int_vec("[1, 2, 3]", expression::TYPE_INT_VECTOR);
BOOST_CHECK_EQUAL(literal_int_vec.infer_type(), expression::TYPE_INT_VECTOR);
- std::vector<int> test_data = boost::assign::list_of(1)(2)(3);
+ std::vector<int> test_data{1, 2, 3};
std::vector<int> result = literal_int_vec.get_int_vector();
BOOST_CHECK_EQUAL_COLLECTIONS(test_data.begin(), test_data.end(),
result.begin(), result.end());
@@ -345,19 +345,9 @@ BOOST_AUTO_TEST_CASE(test_functable_mockup)
BOOST_CHECK_EQUAL(functable.get_type("ADD", two_double_args), expression::TYPE_DOUBLE);
BOOST_CHECK_EQUAL(functable.get_type("XOR", two_bool_args), expression::TYPE_BOOL);
- expression_container::expr_list_type add_args_int =
- boost::assign::list_of(E(2))(E(3))
- ;
- expression_container::expr_list_type add_args_dbl =
- boost::assign::list_of
- (E(2.25))
- (E(5.0))
- ;
- expression_container::expr_list_type xor_args_bool =
- boost::assign::list_of
- (E(true))
- (E(false))
- ;
+ expression_container::expr_list_type add_args_int{E(2), E(3)};
+ expression_container::expr_list_type add_args_dbl{E(2.25), E(5.0)};
+ expression_container::expr_list_type xor_args_bool{E(true), E(false)};
BOOST_CHECK_EQUAL(functable.eval("ADD", two_int_args, add_args_int), expression_literal(5));
BOOST_CHECK_EQUAL(functable.eval("ADD", two_double_args, add_args_dbl), expression_literal(7.25));
diff --git a/host/tests/nocscript_ftable_test.cpp b/host/tests/nocscript_ftable_test.cpp
index 48303305c..99ac2231a 100644
--- a/host/tests/nocscript_ftable_test.cpp
+++ b/host/tests/nocscript_ftable_test.cpp
@@ -8,7 +8,6 @@
#include "../lib/rfnoc/nocscript/function_table.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
-#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <algorithm>
@@ -28,9 +27,9 @@ BOOST_AUTO_TEST_CASE(test_basic_funcs)
BOOST_CHECK(ft->function_exists("FALSE"));
// Math
- expression_container::expr_list_type two_int_values = boost::assign::list_of(E(2))(E(3));
- expression_container::expr_list_type two_int_values2 = boost::assign::list_of(E(3))(E(2));
- expression_container::expr_list_type two_double_values = boost::assign::list_of(E(2.0))(E(3.0));
+ expression_container::expr_list_type two_int_values{E(2), E(3)};
+ expression_container::expr_list_type two_int_values2{E(3), E(2)};
+ expression_container::expr_list_type two_double_values{E(2.0), E(3.0)};
BOOST_REQUIRE_EQUAL(ft->get_type("ADD", two_int_args), expression::TYPE_INT);
expression_literal e_add = ft->eval("ADD", two_int_args, two_int_values);
@@ -67,7 +66,7 @@ BOOST_AUTO_TEST_CASE(test_basic_funcs)
BOOST_REQUIRE_EQUAL(e_ge.infer_type(), expression::TYPE_BOOL);
BOOST_CHECK_EQUAL(e_ge.get_bool(), false);
- expression_container::expr_list_type sixty_four = boost::assign::list_of(E(64));
+ expression_container::expr_list_type sixty_four{E(64)};
expression_literal e_pwr2 = ft->eval("IS_PWR_OF_2", one_int_arg, sixty_four);
BOOST_REQUIRE_EQUAL(e_pwr2.infer_type(), expression::TYPE_BOOL);
BOOST_CHECK_EQUAL(e_pwr2.get_bool(), true);
@@ -76,8 +75,8 @@ BOOST_AUTO_TEST_CASE(test_basic_funcs)
BOOST_CHECK_EQUAL(e_log2.get_int(), 6);
// Boolean Logic
- expression_container::expr_list_type e_true = boost::assign::list_of(E(true));
- expression_container::expr_list_type e_false = boost::assign::list_of(E(false));
+ expression_container::expr_list_type e_true{E(true)};
+ expression_container::expr_list_type e_false{E(false)};
BOOST_CHECK(ft->eval("TRUE", no_args, empty_arg_list).to_bool());
BOOST_CHECK(ft->eval("TRUE", no_args, empty_arg_list).get_bool());
BOOST_CHECK_EQUAL(ft->eval("FALSE", no_args, empty_arg_list).to_bool(), false);
@@ -86,7 +85,7 @@ BOOST_AUTO_TEST_CASE(test_basic_funcs)
// Control
std::cout << "Checking ~1s sleep until... ";
- expression_container::expr_list_type e_sleeptime = boost::assign::list_of(E(.999));
+ expression_container::expr_list_type e_sleeptime{E(.999)};
BOOST_CHECK(ft->eval("SLEEP", one_double_arg, e_sleeptime).get_bool());
std::cout << "Now." << std::endl;
}
@@ -103,7 +102,10 @@ BOOST_AUTO_TEST_CASE(test_add_funcs)
BOOST_CHECK(not ft->function_exists("ADD_PLUS_2"));
- expression_function::argtype_list_type add_int_args = boost::assign::list_of(expression::TYPE_INT)(expression::TYPE_INT);
+ expression_function::argtype_list_type add_int_args{
+ expression::TYPE_INT,
+ expression::TYPE_INT
+ };
ft->register_function(
"ADD_PLUS_2",
boost::bind(&add_plus2_int, _1),
@@ -114,7 +116,7 @@ BOOST_AUTO_TEST_CASE(test_add_funcs)
BOOST_CHECK(ft->function_exists("ADD_PLUS_2"));
BOOST_CHECK(ft->function_exists("ADD_PLUS_2", add_int_args));
- expression_container::expr_list_type add_int_values = boost::assign::list_of(E(2))(E(3));
+ expression_container::expr_list_type add_int_values{E(2), E(3)};
expression_literal e = ft->eval("ADD_PLUS_2", two_int_args, add_int_values);
BOOST_REQUIRE_EQUAL(e.infer_type(), expression::TYPE_INT);
BOOST_CHECK_EQUAL(e.get_int(), 7);
@@ -219,7 +221,10 @@ BOOST_AUTO_TEST_CASE(test_bitwise_funcs)
// Bitwise Math
int int_value1 = 0x2;
int int_value2 = 0x3;
- expression_container::expr_list_type two_int_values = boost::assign::list_of(E(int_value1))(E(int_value2));
+ expression_container::expr_list_type two_int_values{
+ E(int_value1),
+ E(int_value2)
+ };
BOOST_REQUIRE_EQUAL(ft->get_type("SHIFT_RIGHT", two_int_args), expression::TYPE_INT);
expression_literal e_shift_right = ft->eval("SHIFT_RIGHT", two_int_args, two_int_values);