aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2015-03-07 11:12:58 -0500
committerMartin Braun <martin.braun@ettus.com>2015-03-11 15:33:17 -0700
commita7049e4ff79cdc205db76bf7270219f254073961 (patch)
treed8dd37ecfaa3719a82c5aa3ce56f0d04faae01ef /host/tests
parenta4eee83b82a5f57b22c092e5f9dc825baf8fe6dd (diff)
downloaduhd-a7049e4ff79cdc205db76bf7270219f254073961.tar.gz
uhd-a7049e4ff79cdc205db76bf7270219f254073961.tar.bz2
uhd-a7049e4ff79cdc205db76bf7270219f254073961.zip
uhd: Fixed multiple compiler warnings
- Use ULL and LL etc. so compiler doesn't need to decide constant's types - define the empty 'while' loop to include {} to make older compilers happy - Use explicit type names for BOOST_CHECK_EQUAL
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/chdr_test.cpp10
-rw-r--r--host/tests/fp_compare_delta_test.cpp6
-rw-r--r--host/tests/sid_t_test.cpp122
-rw-r--r--host/tests/sph_recv_test.cpp4
-rw-r--r--host/tests/sph_send_test.cpp2
-rw-r--r--host/tests/time_spec_test.cpp4
6 files changed, 74 insertions, 74 deletions
diff --git a/host/tests/chdr_test.cpp b/host/tests/chdr_test.cpp
index 8893e12e5..ed6c690f9 100644
--- a/host/tests/chdr_test.cpp
+++ b/host/tests/chdr_test.cpp
@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(test_with_chdr){
if_packet_info.eob = false;
if_packet_info.packet_count = 7;
if_packet_info.has_tsf = true;
- if_packet_info.tsf = 0x1234567890ABCDEF;
+ if_packet_info.tsf = 0x1234567890ABCDEFull;
if_packet_info.sid = 0xAABBCCDD;
if_packet_info.num_payload_words32 = 24;
if_packet_info.num_payload_bytes = 95;
@@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(test_with_chdr_fc){
if_packet_info.eob = false;
if_packet_info.packet_count = 19;
if_packet_info.has_tsf = false;
- if_packet_info.tsf = 0x1234567890ABCDEF;
+ if_packet_info.tsf = 0x1234567890ABCDEFull;
if_packet_info.sid = 0xAABBCCDD;
if_packet_info.num_payload_words32 = 4;
if_packet_info.num_payload_bytes = 16;
@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(test_with_chdr_cmd){
if_packet_info.packet_type = if_packet_info_t::PACKET_TYPE_CMD;
if_packet_info.packet_count = 19;
if_packet_info.has_tsf = true;
- if_packet_info.tsf = 0x1234567890ABCDEF;
+ if_packet_info.tsf = 0x1234567890ABCDEFull;
if_packet_info.sid = 0xAABBCCDD;
if_packet_info.num_payload_words32 = 4;
if_packet_info.num_payload_bytes = 16;
@@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(test_with_chdr_resp){
if_packet_info.packet_type = if_packet_info_t::PACKET_TYPE_RESP;
if_packet_info.packet_count = 123;
if_packet_info.has_tsf = false;
- if_packet_info.tsf = 0x1234567890ABCDEF;
+ if_packet_info.tsf = 0x1234567890ABCDEFull;
if_packet_info.sid = 0xAABBCCDD;
if_packet_info.num_payload_words32 = 4;
if_packet_info.num_payload_bytes = 16;
@@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(test_with_chdr_err){
if_packet_info.eob = false;
if_packet_info.error = false; // Needs to be set explicitly
if_packet_info.has_tsf = false;
- if_packet_info.tsf = 0x1234567890ABCDEF;
+ if_packet_info.tsf = 0x1234567890ABCDEFull;
if_packet_info.sid = 0xAABBCCDD;
if_packet_info.num_payload_words32 = 4;
if_packet_info.num_payload_bytes = 16;
diff --git a/host/tests/fp_compare_delta_test.cpp b/host/tests/fp_compare_delta_test.cpp
index 9b009a79d..a38c3d2b0 100644
--- a/host/tests/fp_compare_delta_test.cpp
+++ b/host/tests/fp_compare_delta_test.cpp
@@ -239,12 +239,12 @@ BOOST_AUTO_TEST_CASE(double_greaterthanequals_operators) {
BOOST_AUTO_TEST_CASE(frequency_compare_function) {
- BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232, 6817333232));
- BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333233, 6817333232));
+ BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232.0, 6817333232.0));
+ BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333233.0, 6817333232.0));
BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232.1, 6817333232.1));
BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333232.5, 6817333232.6));
BOOST_CHECK(uhd::math::frequencies_are_equal(16.8173332321e9, 16.8173332321e9));
BOOST_CHECK(!uhd::math::frequencies_are_equal(16.8173332322e9, 16.8173332321e9));
BOOST_CHECK(!uhd::math::frequencies_are_equal(5.0, 4.0));
- BOOST_CHECK(uhd::math::frequencies_are_equal(48750000, 48749999.9946));
+ BOOST_CHECK(uhd::math::frequencies_are_equal(48750000.0, 48749999.9946));
}
diff --git a/host/tests/sid_t_test.cpp b/host/tests/sid_t_test.cpp
index 71ab2c213..b5cdeb3d8 100644
--- a/host/tests/sid_t_test.cpp
+++ b/host/tests/sid_t_test.cpp
@@ -30,12 +30,12 @@ BOOST_AUTO_TEST_CASE(test_sid_t) {
BOOST_CHECK_EQUAL(sid.is_set(), true);
BOOST_CHECK_EQUAL(sid.to_pp_string(), "1.2>3.16");
BOOST_CHECK_EQUAL(sid.to_pp_string_hex(), "01:02>03:10");
- BOOST_CHECK_EQUAL(sid.get_src(), 0x0102);
- BOOST_CHECK_EQUAL(sid.get_dst(), 0x0310);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x01);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x02);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x03);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x10);
+ BOOST_CHECK_EQUAL(sid.get_src(), (uint32_t)0x0102);
+ BOOST_CHECK_EQUAL(sid.get_dst(), (uint32_t)0x0310);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x01);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x10);
BOOST_CHECK_EQUAL(sid == sid, true);
BOOST_CHECK_EQUAL(sid == sid_value, true);
@@ -68,88 +68,88 @@ BOOST_AUTO_TEST_CASE(test_sid_t_set) {
sid_t sid(sid_value);
sid.set(0x01020304);
- BOOST_CHECK_EQUAL(sid.get(), 0x01020304);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x01);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x02);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x03);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x04);
- BOOST_CHECK_EQUAL(sid.get_dst_xbarport(), 0x0);
- BOOST_CHECK_EQUAL(sid.get_dst_blockport(), 0x4);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x01020304);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(),(uint32_t)0x01);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04);
+ BOOST_CHECK_EQUAL(sid.get_dst_xbarport(), (uint32_t)0x0);
+ BOOST_CHECK_EQUAL(sid.get_dst_blockport(), (uint32_t)0x4);
sid.set_src_addr(0x0a);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a020304);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x02);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x03);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x04);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a020304);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x02);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04);
sid.set_src_endpoint(0x0b);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a0b0304);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x0b);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x03);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x04);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0304);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x03);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04);
sid.set_dst_addr(0x0c);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a0b0c04);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x0b);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x0c);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x04);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0c04);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x04);
sid.set_dst_endpoint(0x0d);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a0b0c0d);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x0b);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x0c);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0x0d);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0c0d);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0x0d);
sid.set_dst_xbarport(0xb);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a0b0cbd);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x0b);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x0c);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0xbd);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0cbd);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0xbd);
sid.set_dst_blockport(0xc);
- BOOST_CHECK_EQUAL(sid.get(), 0x0a0b0cbc);
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 0x0a);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 0x0b);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 0x0c);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 0xbc);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0a0b0cbc);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)0x0a);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)0x0b);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)0x0c);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)0xbc);
sid_t flipped_sid = sid.reversed();
- BOOST_CHECK_EQUAL(flipped_sid.get(), 0x0cbc0a0b);
+ BOOST_CHECK_EQUAL(flipped_sid.get(), (uint32_t)0x0cbc0a0b);
// In-place
sid.reverse();
- BOOST_CHECK_EQUAL(sid.get(), 0x0cbc0a0b);
+ BOOST_CHECK_EQUAL(sid.get(), (uint32_t)0x0cbc0a0b);
}
BOOST_AUTO_TEST_CASE(test_sid_t_from_str) {
sid_t sid("1.2>3.4");
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 1);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 2);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 3);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 4);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)4);
sid = "01:02>03:10";
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 1);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 2);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 3);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 16);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16);
sid = "01:06/03:10";
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 1);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 6);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 3);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 16);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)6);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)3);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16);
sid = "01:02:04:10";
- BOOST_CHECK_EQUAL(sid.get_src_addr(), 1);
- BOOST_CHECK_EQUAL(sid.get_src_endpoint(), 2);
- BOOST_CHECK_EQUAL(sid.get_dst_addr(), 4);
- BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), 16);
+ BOOST_CHECK_EQUAL(sid.get_src_addr(), (uint32_t)1);
+ BOOST_CHECK_EQUAL(sid.get_src_endpoint(), (uint32_t)2);
+ BOOST_CHECK_EQUAL(sid.get_dst_addr(), (uint32_t)4);
+ BOOST_CHECK_EQUAL(sid.get_dst_endpoint(), (uint32_t)16);
BOOST_REQUIRE_THROW(sid_t fail_sid("foobar"), uhd::value_error);
BOOST_REQUIRE_THROW(sid_t fail_sid("01:02:03:4"), uhd::value_error);
diff --git a/host/tests/sph_recv_test.cpp b/host/tests/sph_recv_test.cpp
index 5dd0761db..e8c51b847 100644
--- a/host/tests/sph_recv_test.cpp
+++ b/host/tests/sph_recv_test.cpp
@@ -675,7 +675,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(metadata.has_time_spec);
BOOST_CHECK_TS_CLOSE(metadata.time_spec, uhd::time_spec_t::from_ticks(num_accum_samps, SAMP_RATE));
- BOOST_CHECK_EQUAL(num_samps_ret, 10);
+ BOOST_CHECK_EQUAL(num_samps_ret, (size_t)10);
num_accum_samps += num_samps_ret;
if (not metadata.more_fragments) continue;
@@ -685,7 +685,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
- BOOST_CHECK_EQUAL(metadata.fragment_offset, 10);
+ BOOST_CHECK_EQUAL(metadata.fragment_offset, (size_t)10);
BOOST_CHECK(metadata.has_time_spec);
BOOST_CHECK_TS_CLOSE(metadata.time_spec, uhd::time_spec_t::from_ticks(num_accum_samps, SAMP_RATE));
BOOST_CHECK_EQUAL(num_samps_ret, i%10);
diff --git a/host/tests/sph_send_test.cpp b/host/tests/sph_send_test.cpp
index 603b36c85..58d47c76d 100644
--- a/host/tests/sph_send_test.cpp
+++ b/host/tests/sph_send_test.cpp
@@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_full_buffer_mode){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
dummy_send_xport.pop_front_packet(ifpi);
- BOOST_CHECK_EQUAL(ifpi.num_payload_words32, 20);
+ BOOST_CHECK_EQUAL(ifpi.num_payload_words32, (size_t)20);
BOOST_CHECK(ifpi.has_tsf);
BOOST_CHECK_EQUAL(ifpi.tsf, num_accum_samps*TICK_RATE/SAMP_RATE);
BOOST_CHECK_EQUAL(ifpi.sob, i == 0);
diff --git a/host/tests/time_spec_test.cpp b/host/tests/time_spec_test.cpp
index c9b9652f9..b98bea7d9 100644
--- a/host/tests/time_spec_test.cpp
+++ b/host/tests/time_spec_test.cpp
@@ -112,8 +112,8 @@ BOOST_AUTO_TEST_CASE(test_time_large_ticks_to_time_spec)
BOOST_AUTO_TEST_CASE(test_time_error_irrational_rate)
{
- static const double rate = 1625e3/6;
- const long long tick_in = 23423436291667;
+ static const double rate = 1625e3/6.0;
+ const long long tick_in = 23423436291667ll;
const uhd::time_spec_t ts = uhd::time_spec_t::from_ticks(tick_in, rate);
const long long tick_out = ts.to_ticks(rate);
const long long err = tick_in - tick_out;