aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/block_id_test.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-05-23 15:00:43 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:16 -0800
commit7c78bdd6415515e62c5ba98e0c9fcf5f83479c27 (patch)
treecd2b858cb17dd1e59cba86647d52bdc1b5a9d1b7 /host/tests/block_id_test.cpp
parent1ed37cdfda93e430037ee4028ec5ac70ab223b1b (diff)
downloaduhd-7c78bdd6415515e62c5ba98e0c9fcf5f83479c27.tar.gz
uhd-7c78bdd6415515e62c5ba98e0c9fcf5f83479c27.tar.bz2
uhd-7c78bdd6415515e62c5ba98e0c9fcf5f83479c27.zip
rfnoc: Change Block-ID format to 0/FFT#1
Previously, it was 0/FFT_1. The counter was separated by an underscore. Now, we separate by a # symbol to allow for underscores in block names. This means 'FIR_Filter' is now a valid blockname.
Diffstat (limited to 'host/tests/block_id_test.cpp')
-rw-r--r--host/tests/block_id_test.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/host/tests/block_id_test.cpp b/host/tests/block_id_test.cpp
index 7c068e4d2..fb11daf1f 100644
--- a/host/tests/block_id_test.cpp
+++ b/host/tests/block_id_test.cpp
@@ -14,17 +14,18 @@ using namespace uhd::rfnoc;
BOOST_AUTO_TEST_CASE(test_block_id)
{
- BOOST_CHECK(block_id_t::is_valid_block_id("00/Filter_1"));
- BOOST_CHECK(not block_id_t::is_valid_block_id("0/MAG_SQUARE"));
+ BOOST_CHECK(block_id_t::is_valid_block_id("00/Filter#1"));
+ BOOST_CHECK(not block_id_t::is_valid_block_id("0/MAG#SQUARE"));
BOOST_CHECK(block_id_t::is_valid_blockname("FilterFoo"));
- BOOST_CHECK(not block_id_t::is_valid_blockname("Filter_Foo"));
+ BOOST_CHECK(block_id_t::is_valid_blockname("Filter_Foo"));
+ BOOST_CHECK(not block_id_t::is_valid_blockname("Filter#Foo"));
BOOST_CHECK(not block_id_t::is_valid_blockname("Filter/Foo"));
BOOST_CHECK(not block_id_t::is_valid_blockname("0Filter/Foo"));
BOOST_CHECK(not block_id_t::is_valid_blockname("0/Filter/Foo"));
BOOST_REQUIRE_THROW(block_id_t invalid_block_id("0Filter/1"), uhd::value_error);
- block_id_t block_id("0/FFT_1");
+ block_id_t block_id("0/FFT#1");
BOOST_CHECK_EQUAL(block_id.get_device_no(), 0);
BOOST_CHECK_EQUAL(block_id.get_block_name(), "FFT");
BOOST_CHECK_EQUAL(block_id.get_block_count(), 1);
@@ -44,7 +45,7 @@ BOOST_AUTO_TEST_CASE(test_block_id)
BOOST_CHECK_EQUAL(block_id.get_block_name(), "FooBar");
BOOST_CHECK_EQUAL(block_id.get_block_count(), 11);
- BOOST_CHECK(not block_id.set_block_name("Foo_Bar"));
+ BOOST_CHECK(not block_id.set_block_name("Foo%Bar"));
BOOST_CHECK_EQUAL(block_id.get_device_no(), 17);
BOOST_CHECK_EQUAL(
block_id.get_block_name(), "FooBar"); // Is unchanged because invalid
@@ -59,28 +60,28 @@ BOOST_AUTO_TEST_CASE(test_block_id)
BOOST_CHECK_EQUAL(other_block_id.get_device_no(), 7);
BOOST_CHECK_EQUAL(other_block_id.get_block_name(), "BlockName");
BOOST_CHECK_EQUAL(other_block_id.get_block_count(), 3);
- BOOST_CHECK_EQUAL(other_block_id.to_string(), "7/BlockName_3");
+ BOOST_CHECK_EQUAL(other_block_id.to_string(), "7/BlockName#3");
// Cast
std::string block_id_str = std::string(other_block_id);
- std::cout << "Should print '7/BlockName_3': " << block_id_str << std::endl;
- BOOST_CHECK_EQUAL(block_id_str, "7/BlockName_3");
+ std::cout << "Should print '7/BlockName#3': " << block_id_str << std::endl;
+ BOOST_CHECK_EQUAL(block_id_str, "7/BlockName#3");
// Operators
std::cout << "Testing ostream printing (<<): " << other_block_id << std::endl;
BOOST_CHECK_EQUAL(other_block_id, block_id_str);
- BOOST_CHECK_EQUAL(other_block_id, "7/BlockName_3");
+ BOOST_CHECK_EQUAL(other_block_id, "7/BlockName#3");
// match()
BOOST_CHECK(other_block_id.match("BlockName"));
BOOST_CHECK(other_block_id.match("7/BlockName"));
- BOOST_CHECK(other_block_id.match("BlockName_3"));
- BOOST_CHECK(other_block_id.match("7/BlockName_3"));
+ BOOST_CHECK(other_block_id.match("BlockName#3"));
+ BOOST_CHECK(other_block_id.match("7/BlockName#3"));
BOOST_CHECK(not other_block_id.match("8/BlockName"));
- BOOST_CHECK(not other_block_id.match("8/BlockName_3"));
- BOOST_CHECK(not other_block_id.match("Block_Name_3"));
- BOOST_CHECK(not other_block_id.match("BlockName_4"));
- BOOST_CHECK(not other_block_id.match("BlockName_X"));
+ BOOST_CHECK(not other_block_id.match("8/BlockName#3"));
+ BOOST_CHECK(not other_block_id.match("Block_Name#3"));
+ BOOST_CHECK(not other_block_id.match("BlockName#4"));
+ BOOST_CHECK(not other_block_id.match("BlockName#X"));
BOOST_CHECK(not other_block_id.match("2093ksdjfflsdkjf"));
}
@@ -96,7 +97,7 @@ BOOST_AUTO_TEST_CASE(test_block_id_set)
BOOST_CHECK_EQUAL(block_id_for_set.get_device_no(), 1);
BOOST_CHECK_EQUAL(block_id_for_set.get_block_name(), "FirFilter2");
BOOST_CHECK_EQUAL(block_id_for_set.get_block_count(), 9);
- block_id_for_set.set("Sync_3");
+ block_id_for_set.set("Sync#3");
BOOST_CHECK_EQUAL(block_id_for_set.get_device_no(), 1);
BOOST_CHECK_EQUAL(block_id_for_set.get_block_name(), "Sync");
BOOST_CHECK_EQUAL(block_id_for_set.get_block_count(), 3);
@@ -104,8 +105,8 @@ BOOST_AUTO_TEST_CASE(test_block_id_set)
BOOST_AUTO_TEST_CASE(test_block_id_cmp)
{
- BOOST_CHECK(block_id_t("0/FFT_1") == block_id_t("0/FFT_1"));
- BOOST_CHECK(block_id_t("0/FFT_1") != block_id_t("1/FFT_1"));
- BOOST_CHECK(block_id_t("0/FFT_1") < block_id_t("1/aaaaaaaaa_0"));
- BOOST_CHECK(not(block_id_t("0/FFT_1") > block_id_t("1/aaaaaaaaa_0")));
+ BOOST_CHECK(block_id_t("0/FFT#1") == block_id_t("0/FFT#1"));
+ BOOST_CHECK(block_id_t("0/FFT#1") != block_id_t("1/FFT#1"));
+ BOOST_CHECK(block_id_t("0/FFT#1") < block_id_t("1/aaaaaaaaa#0"));
+ BOOST_CHECK(not(block_id_t("0/FFT#1") > block_id_t("1/aaaaaaaaa#0")));
}