From 3a29a2c9bf55012c6c1712f4739063ffad0a1f83 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Fri, 3 Apr 2020 18:28:04 -0700 Subject: [PATCH 1/3] Remove unused seed_rand() and generate_rand_vectors() Signed-off-by: Shane Loretz --- test/test_mean.cpp | 19 ------------------- test/test_median.cpp | 19 ------------------- test/test_realtime_circular_buffer.cpp | 19 ------------------- 3 files changed, 57 deletions(-) diff --git a/test/test_mean.cpp b/test/test_mean.cpp index d07d825..6f9bd22 100644 --- a/test/test_mean.cpp +++ b/test/test_mean.cpp @@ -33,25 +33,6 @@ using namespace filters ; -void seed_rand() -{ - //Seed random number generator with current microseond count - timeval temp_time_struct; - gettimeofday(&temp_time_struct,NULL); - srand(temp_time_struct.tv_usec); -}; - -void generate_rand_vectors(double scale, uint64_t runs, std::vector& xvalues, std::vector& yvalues, std::vector&zvalues) -{ - seed_rand(); - for ( uint64_t i = 0; i < runs ; i++ ) - { - xvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - yvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - zvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - } -} - TEST(MultiChannelMeanFilterDouble, ConfirmIdentityNRows) { double epsilon = 1e-6; diff --git a/test/test_median.cpp b/test/test_median.cpp index 0bafd7b..85a8fc5 100644 --- a/test/test_median.cpp +++ b/test/test_median.cpp @@ -34,25 +34,6 @@ using namespace filters ; -void seed_rand() -{ - //Seed random number generator with current microseond count - timeval temp_time_struct; - gettimeofday(&temp_time_struct,NULL); - srand(temp_time_struct.tv_usec); -}; - -void generate_rand_vectors(double scale, uint64_t runs, std::vector& xvalues, std::vector& yvalues, std::vector&zvalues) -{ - seed_rand(); - for ( uint64_t i = 0; i < runs ; i++ ) - { - xvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - yvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - zvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - } -} - TEST(MultiChannelMedianFilterDouble, ConfirmIdentityNRows) { double epsilon = 1e-6; diff --git a/test/test_realtime_circular_buffer.cpp b/test/test_realtime_circular_buffer.cpp index c2faaa6..8985fc7 100644 --- a/test/test_realtime_circular_buffer.cpp +++ b/test/test_realtime_circular_buffer.cpp @@ -35,25 +35,6 @@ using namespace filters ; -void seed_rand() -{ - //Seed random number generator with current microseond count - timeval temp_time_struct; - gettimeofday(&temp_time_struct,NULL); - srand(temp_time_struct.tv_usec); -}; - -void generate_rand_vectors(double scale, uint64_t runs, std::vector& xvalues, std::vector& yvalues, std::vector&zvalues) -{ - seed_rand(); - for ( uint64_t i = 0; i < runs ; i++ ) - { - xvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - yvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - zvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX; - } -} - TEST(RealtimeCircularBuffer, InitializationScalar) { From 06f76e1c19b9082c906db4c91300cde9579d2107 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Fri, 3 Apr 2020 18:28:20 -0700 Subject: [PATCH 2/3] Remove commented tests Signed-off-by: Shane Loretz --- test/test_chain.cpp | 46 --------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/test/test_chain.cpp b/test/test_chain.cpp index 4bf6621..09e493f 100644 --- a/test/test_chain.cpp +++ b/test/test_chain.cpp @@ -168,22 +168,6 @@ TEST(MultiChannelFilterChain, TransferFunction){ } } -/* -TEST(MultiChannelFilterChain, OverlappingNames){ - filters::MultiChannelFilterChain chain("double"); - - - std::string bad_xml = " "; - - TiXmlDocument chain_def = TiXmlDocument(); - chain_def.Parse(bad_xml.c_str()); - TiXmlElement * config = chain_def.RootElement(); - - EXPECT_FALSE(chain.configure(5, config)); - -} -*/ - TEST(FilterChain, ReconfiguringChain){ filters::FilterChain chain("int"); @@ -225,37 +209,7 @@ TEST(FilterChain, TenIncrementChains){ chain.clear(); } -/* -TEST(MultiChannelFilterChain, ReconfiguringMultiChannelChain){ - filters::MultiChannelFilterChain chain("int"); - - int v1 = 1; - int v1a = 9; - - EXPECT_TRUE(chain.configure("OneMultiChannelIncrements")); - EXPECT_TRUE(chain.update(v1, v1a)); - EXPECT_EQ(2, v1a); - chain.clear(); - - EXPECT_TRUE(chain.configure("TwoMultiChannelIncrements")); - EXPECT_TRUE(chain.update(v1, v1a)); - EXPECT_EQ(3, v1a); - chain.clear(); - -} - -TEST(MultiChannelFilterChain, ThreeMultiChannelIncrementChains){ - filters::MultiChannelFilterChain chain("int"); - int v1 = 1; - int v1a = 9; - EXPECT_TRUE(chain.configure("ThreeMultiChannelIncrements")); - EXPECT_TRUE(chain.update(v1, v1a)); - EXPECT_EQ(4, v1a); - chain.clear(); - -} -*/ TEST(MultiChannelFilterChain, TenMultiChannelIncrementChains){ filters::MultiChannelFilterChain chain("int"); std::vector v1; From db42b1d0e724532504600251880de362f06215d8 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Fri, 3 Apr 2020 18:28:34 -0700 Subject: [PATCH 3/3] Remove commented asserts Signed-off-by: Shane Loretz --- include/filters/increment.h | 2 -- include/filters/mean.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/include/filters/increment.h b/include/filters/increment.h index 2731e36..96d1c6c 100644 --- a/include/filters/increment.h +++ b/include/filters/increment.h @@ -141,8 +141,6 @@ MultiChannelIncrementFilter::~MultiChannelIncrementFilter() template bool MultiChannelIncrementFilter::update(const std::vector & data_in, std::vector& data_out) { - // ROS_ASSERT(data_in.size() == width_); - //ROS_ASSERT(data_out.size() == width_); if (data_in.size() != number_of_channels_ || data_out.size() != number_of_channels_) { ROS_ERROR("Configured with wrong size config:%d in:%d out:%d", number_of_channels_, (int)data_in.size(), (int)data_out.size()); diff --git a/include/filters/mean.h b/include/filters/mean.h index 542d59b..6c8afed 100644 --- a/include/filters/mean.h +++ b/include/filters/mean.h @@ -194,8 +194,6 @@ MultiChannelMeanFilter::~MultiChannelMeanFilter() template bool MultiChannelMeanFilter::update(const std::vector & data_in, std::vector& data_out) { - // ROS_ASSERT(data_in.size() == width_); - //ROS_ASSERT(data_out.size() == width_); if (data_in.size() != number_of_channels_ || data_out.size() != number_of_channels_) { ROS_ERROR("Configured with wrong size config:%d in:%d out:%d", number_of_channels_, (int)data_in.size(), (int)data_out.size());