Skip to content

Commit

Permalink
[noetic] Delete unused code (#33)
Browse files Browse the repository at this point in the history
* Remove unused seed_rand() and generate_rand_vectors()

Signed-off-by: Shane Loretz <[email protected]>

* Remove commented tests

Signed-off-by: Shane Loretz <[email protected]>

* Remove commented asserts

Signed-off-by: Shane Loretz <[email protected]>
  • Loading branch information
sloretz authored Apr 6, 2020
1 parent 96ee215 commit 644f7f8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 107 deletions.
2 changes: 0 additions & 2 deletions include/filters/increment.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ MultiChannelIncrementFilter<T>::~MultiChannelIncrementFilter()
template <typename T>
bool MultiChannelIncrementFilter<T>::update(const std::vector<T> & data_in, std::vector<T>& 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());
Expand Down
2 changes: 0 additions & 2 deletions include/filters/mean.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ MultiChannelMeanFilter<T>::~MultiChannelMeanFilter()
template <typename T>
bool MultiChannelMeanFilter<T>::update(const std::vector<T> & data_in, std::vector<T>& 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());
Expand Down
46 changes: 0 additions & 46 deletions test/test_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,6 @@ TEST(MultiChannelFilterChain, TransferFunction){
}
}

/*
TEST(MultiChannelFilterChain, OverlappingNames){
filters::MultiChannelFilterChain<double> chain("double");
std::string bad_xml = "<filters> <filter type=\"MultiChannelMeanFilterDouble\" name=\"mean_test\"> <params number_of_observations=\"5\"/></filter><filter type=\"MedianFilter\" name=\"mean_test\"> <params number_of_observations=\"5\"/></filter></filters>";
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<int> chain("int");

Expand Down Expand Up @@ -225,37 +209,7 @@ TEST(FilterChain, TenIncrementChains){
chain.clear();

}
/*
TEST(MultiChannelFilterChain, ReconfiguringMultiChannelChain){
filters::MultiChannelFilterChain<int> 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<int> 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<int> chain("int");
std::vector<int> v1;
Expand Down
19 changes: 0 additions & 19 deletions test/test_mean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>& xvalues, std::vector<double>& yvalues, std::vector<double>&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;
Expand Down
19 changes: 0 additions & 19 deletions test/test_median.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>& xvalues, std::vector<double>& yvalues, std::vector<double>&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;
Expand Down
19 changes: 0 additions & 19 deletions test/test_realtime_circular_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>& xvalues, std::vector<double>& yvalues, std::vector<double>&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)
{

Expand Down

0 comments on commit 644f7f8

Please sign in to comment.