v01
This commit is contained in:
5
thirdparty/ros/ros_comm/tools/rostest/test/clean_master.test
vendored
Normal file
5
thirdparty/ros/ros_comm/tools/rostest/test/clean_master.test
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<test pkg="rostest" type="test_clean_master.py" test-name="clean_master1" />
|
||||
<test pkg="rostest" type="test_clean_master.py" test-name="clean_master2" />
|
||||
<test pkg="rostest" type="test_clean_master.py" test-name="clean_master3" />
|
||||
</launch>
|
||||
3
thirdparty/ros/ros_comm/tools/rostest/test/distro_version.test
vendored
Normal file
3
thirdparty/ros/ros_comm/tools/rostest/test/distro_version.test
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<launch>
|
||||
<test pkg="rostest" type="test_distro_version.py" test-name="distro_version" />
|
||||
</launch>
|
||||
36
thirdparty/ros/ros_comm/tools/rostest/test/dotname_cases.py
vendored
Executable file
36
thirdparty/ros/ros_comm/tools/rostest/test/dotname_cases.py
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class CaseA(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
class CaseB(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
class DotnameLoadingSuite(unittest.TestSuite):
|
||||
|
||||
def __init__(self):
|
||||
super(DotnameLoadingSuite, self).__init__()
|
||||
self.addTest(CaseA())
|
||||
self.addTest(CaseB())
|
||||
|
||||
|
||||
class DotnameLoadingTest(unittest.TestCase):
|
||||
|
||||
def test_a(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
def test_b(self):
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
class NotTestCase():
|
||||
|
||||
def not_test(self):
|
||||
pass
|
||||
24
thirdparty/ros/ros_comm/tools/rostest/test/hztest.test
vendored
Normal file
24
thirdparty/ros/ros_comm/tools/rostest/test/hztest.test
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<launch>
|
||||
<node name="talker" pkg="rospy" type="talker.py" />
|
||||
|
||||
<param name="hztest1/topic" value="chatter" />
|
||||
<param name="hztest1/hz" value="10.0" />
|
||||
<param name="hztest1/hzerror" value="0.5" />
|
||||
<param name="hztest1/test_duration" value="5.0" />
|
||||
<param name="hztest1/wait_time" value="21.0" />
|
||||
<test test-name="hztest_test" pkg="rostest" type="hztest" name="hztest1" />
|
||||
|
||||
<!-- Below also works:
|
||||
|
||||
<test test-name="hztest_test" pkg="rostest" type="hztest" name="hztest1">
|
||||
<rosparam>
|
||||
topic: chatter
|
||||
hz: 10.0
|
||||
hzerror: 0.5
|
||||
test_duration: 5.0
|
||||
wait_time: 21.0
|
||||
</rosparam>
|
||||
</test>
|
||||
|
||||
-->
|
||||
</launch>
|
||||
7
thirdparty/ros/ros_comm/tools/rostest/test/hztest0.test
vendored
Normal file
7
thirdparty/ros/ros_comm/tools/rostest/test/hztest0.test
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<launch>
|
||||
<!-- verify that hztest works with 0 rate. NOTE: there is no test for failure here, which needs to be added somehow -->
|
||||
<param name="hztest0/topic" value="fake" />
|
||||
<param name="hztest0/hz" value="0.0" />
|
||||
<param name="hztest0/test_duration" value="5.0" />
|
||||
<test test-name="hz0_test" pkg="rostest" type="hztest" name="hztest0" />
|
||||
</launch>
|
||||
51
thirdparty/ros/ros_comm/tools/rostest/test/just_advertise
vendored
Executable file
51
thirdparty/ros/ros_comm/tools/rostest/test/just_advertise
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
###############################################################################
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2016, Kentaro Wada.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###############################################################################
|
||||
|
||||
"""
|
||||
This node is designed for testing and just advertises a topic for the specified message class.
|
||||
|
||||
Author: Kentaro Wada <www.kentaro.wada@gmail.com>
|
||||
"""
|
||||
|
||||
import rospy
|
||||
import roslib.message
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
rospy.init_node('just_advertise')
|
||||
msg_name = rospy.get_param('~msg_name')
|
||||
msg_class = roslib.message.get_message_class(msg_name)
|
||||
pub = rospy.Publisher('~output', msg_class, queue_size=1)
|
||||
rospy.spin()
|
||||
30
thirdparty/ros/ros_comm/tools/rostest/test/param.test
vendored
Normal file
30
thirdparty/ros/ros_comm/tools/rostest/test/param.test
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<launch>
|
||||
<!-- These parameters are registered to Parameter Server and
|
||||
will be accessed by the test cases. -->
|
||||
<param name="param_nonempty" value="This param is not empty." />
|
||||
<param name="param_empty" value="" />
|
||||
<param name="param_value_specific" value="Opensource Robotics is forever." />
|
||||
|
||||
<test pkg="rostest" type="paramtest" name="paramtest_nonempty"
|
||||
test-name="paramtest_nonempty">
|
||||
<param name="param_name_target" value="param_nonempty" />
|
||||
<param name="test_duration" value="5.0" />
|
||||
<param name="wait_time" value="20.0" />
|
||||
</test>
|
||||
|
||||
<test pkg="rostest" type="paramtest" name="paramtest_empty"
|
||||
test-name="paramtest_empty">
|
||||
<param name="param_name_target" value="param_empty" />
|
||||
<param name="test_duration" value="5.0" />
|
||||
<param name="wait_time" value="30.0" />
|
||||
</test>
|
||||
|
||||
<test pkg="rostest" type="paramtest" name="paramtest_value_specific_correct"
|
||||
test-name="paramtest_value_specific_correct">
|
||||
<param name="param_name_target" value="param_value_specific" />
|
||||
<param name="param_value_expected" value="Opensource Robotics is forever." />
|
||||
<param name="test_duration" value="5.0" />
|
||||
<param name="wait_time" value="30.0" />
|
||||
</test>
|
||||
|
||||
</launch>
|
||||
35
thirdparty/ros/ros_comm/tools/rostest/test/publishtest.test
vendored
Normal file
35
thirdparty/ros/ros_comm/tools/rostest/test/publishtest.test
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<launch>
|
||||
|
||||
<node name="talker_0"
|
||||
pkg="rospy" type="talker.py">
|
||||
<remap from="chatter" to="~output" />
|
||||
</node>
|
||||
|
||||
<node name="talker_1"
|
||||
pkg="rospy" type="talker.py">
|
||||
<remap from="chatter" to="~output" />
|
||||
</node>
|
||||
|
||||
<node name="talker_2"
|
||||
pkg="rostest" type="just_advertise">
|
||||
<rosparam>
|
||||
msg_name: std_msgs/String
|
||||
</rosparam>
|
||||
</node>
|
||||
|
||||
<test name="publishtest"
|
||||
test-name="publishtest"
|
||||
pkg="rostest" type="publishtest">
|
||||
<rosparam>
|
||||
topics:
|
||||
- name: talker_0/output
|
||||
timeout: 10
|
||||
negative: False
|
||||
- name: talker_1/output
|
||||
- name: talker_2/output
|
||||
timeout: 3
|
||||
negative: True
|
||||
</rosparam>
|
||||
</test>
|
||||
|
||||
</launch>
|
||||
49
thirdparty/ros/ros_comm/tools/rostest/test/test_clean_master.py
vendored
Executable file
49
thirdparty/ros/ros_comm/tools/rostest/test/test_clean_master.py
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2009, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import rospy
|
||||
import rosunit
|
||||
|
||||
class CleanMasterTest(unittest.TestCase):
|
||||
|
||||
def test_clean_master(self):
|
||||
self.failIf(rospy.has_param('dirty'))
|
||||
rospy.set_param('dirty', True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
rosunit.unitrun('test_rostest', 'test_clean_master', CleanMasterTest, coverage_packages=[])
|
||||
|
||||
51
thirdparty/ros/ros_comm/tools/rostest/test/test_distro_version.py
vendored
Executable file
51
thirdparty/ros/ros_comm/tools/rostest/test/test_distro_version.py
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2009, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import rospy
|
||||
import rostest
|
||||
import subprocess
|
||||
|
||||
class VersionTest(unittest.TestCase):
|
||||
|
||||
def test_distro_version(self):
|
||||
val = (subprocess.Popen(['rosversion', '-d'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0] or '').strip()
|
||||
param = rospy.get_param('rosdistro').strip()
|
||||
self.assertEquals(val, param, "rosversion -d [%s] and roscore [%s] do not match"%(val, param))
|
||||
|
||||
if __name__ == '__main__':
|
||||
rostest.unitrun('test_rostest', 'test_distro_version', VersionTest, coverage_packages=[])
|
||||
|
||||
52
thirdparty/ros/ros_comm/tools/rostest/test/test_dotname.py
vendored
Executable file
52
thirdparty/ros/ros_comm/tools/rostest/test/test_dotname.py
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This file should be run using a non-ros unit test framework such as nose using
|
||||
# nosetests test_dotname.py.
|
||||
|
||||
import unittest
|
||||
import rostest
|
||||
from dotname_cases import DotnameLoadingTest, NotTestCase, DotnameLoadingSuite
|
||||
|
||||
|
||||
class TestDotnameLoading(unittest.TestCase):
|
||||
|
||||
def test_class_basic(self):
|
||||
rostest.rosrun('test_rostest', 'test_class_basic', DotnameLoadingTest)
|
||||
|
||||
def test_class_dotname(self):
|
||||
rostest.rosrun('test_rostest', 'test_class_dotname', 'dotname_cases.DotnameLoadingTest')
|
||||
|
||||
def test_method_dotname(self):
|
||||
rostest.rosrun('test_rostest', 'test_method_dotname', 'dotname_cases.DotnameLoadingTest.test_a')
|
||||
|
||||
def test_suite_dotname(self):
|
||||
rostest.rosrun('test_rostest', 'test_suite_dotname', 'dotname_cases.DotnameLoadingSuite')
|
||||
|
||||
def test_class_basic_nottest(self):
|
||||
# class which exists but is not a TestCase
|
||||
with self.assertRaises(SystemExit):
|
||||
rostest.rosrun('test_rostest', 'test_class_basic_nottest', NotTestCase)
|
||||
|
||||
def test_suite_basic(self):
|
||||
# can't load suites with the basic loader
|
||||
with self.assertRaises(SystemExit):
|
||||
rostest.rosrun('test_rosunit', 'test_suite_basic', DotnameLoadingSuite)
|
||||
|
||||
def test_class_dotname_nottest(self):
|
||||
# class which exists but is not a valid test
|
||||
with self.assertRaises(TypeError):
|
||||
rostest.rosrun('test_rostest', 'test_class_dotname_nottest', 'dotname_cases.NotTestCase')
|
||||
|
||||
def test_class_dotname_noexist(self):
|
||||
# class which does not exist in the module
|
||||
with self.assertRaises(AttributeError):
|
||||
rostest.rosrun('test_rostest', 'test_class_dotname_noexist', 'dotname_cases.DotnameLoading')
|
||||
|
||||
def test_method_dotname_noexist(self):
|
||||
# method which does not exist in the class
|
||||
with self.assertRaises(AttributeError):
|
||||
rostest.rosrun('test_rostest', 'test_method_dotname_noexist', 'dotname_cases.DotnameLoadingTest.not_method')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
213
thirdparty/ros/ros_comm/tools/rostest/test/test_permuter.cpp
vendored
Normal file
213
thirdparty/ros/ros_comm/tools/rostest/test/test_permuter.cpp
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Willow Garage, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include "rostest/permuter.h"
|
||||
|
||||
using namespace rostest;
|
||||
|
||||
|
||||
double epsilon = 1e-9;
|
||||
|
||||
TEST(Permuter, PermuteOption)
|
||||
{
|
||||
std::vector<double> vals;
|
||||
vals.push_back(1.0);
|
||||
vals.push_back(2.0);
|
||||
vals.push_back(3.0);
|
||||
vals.push_back(4.0);
|
||||
double value = 0;
|
||||
|
||||
PermuteOption<double> op(vals, &value);
|
||||
|
||||
for ( unsigned int i = 0; i < vals.size(); i++)
|
||||
{
|
||||
EXPECT_NEAR(vals[i], value, epsilon);
|
||||
if (i < vals.size() -1)
|
||||
EXPECT_TRUE(op.step());
|
||||
else
|
||||
EXPECT_FALSE(op.step());
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST(Permuter, OneDoublePermuteOption)
|
||||
{
|
||||
double epsilon = 1e-9;
|
||||
rostest::Permuter permuter;
|
||||
std::vector<double> vals;
|
||||
vals.push_back(1.0);
|
||||
vals.push_back(2.0);
|
||||
vals.push_back(3.0);
|
||||
vals.push_back(4.0);
|
||||
|
||||
|
||||
double value = 0;
|
||||
|
||||
permuter.addOptionSet(vals, &value);
|
||||
|
||||
for ( unsigned int i = 0; i < vals.size(); i++)
|
||||
{
|
||||
EXPECT_NEAR(vals[i], value, epsilon);
|
||||
if (i < vals.size() -1)
|
||||
EXPECT_TRUE(permuter.step());
|
||||
else
|
||||
EXPECT_FALSE(permuter.step());
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TEST(Permuter, TwoDoubleOptions)
|
||||
{
|
||||
double epsilon = 1e-9;
|
||||
Permuter permuter;
|
||||
std::vector<double> vals;
|
||||
vals.push_back(1.0);
|
||||
vals.push_back(2.0);
|
||||
vals.push_back(3.0);
|
||||
vals.push_back(4.0);
|
||||
|
||||
|
||||
double value = 0;
|
||||
|
||||
std::vector<double> vals2;
|
||||
vals2.push_back(9.0);
|
||||
vals2.push_back(8.0);
|
||||
vals2.push_back(7.0);
|
||||
vals2.push_back(6.0);
|
||||
|
||||
double value2;
|
||||
|
||||
permuter.addOptionSet(vals, &value);
|
||||
permuter.addOptionSet(vals2, &value2);
|
||||
for ( unsigned int j = 0; j < vals2.size(); j++)
|
||||
for ( unsigned int i = 0; i < vals.size(); i++)
|
||||
{
|
||||
//printf("%f?=%f %f?=%f\n", value, vals[i], value2, vals2[j]);
|
||||
EXPECT_NEAR(vals[i], value, epsilon);
|
||||
EXPECT_NEAR(vals2[j], value2, epsilon);
|
||||
if (i == vals.size() -1 && j == vals2.size() -1)
|
||||
EXPECT_FALSE(permuter.step());
|
||||
else
|
||||
EXPECT_TRUE(permuter.step());
|
||||
};
|
||||
|
||||
}
|
||||
TEST(Permuter, ThreeDoubleOptions)
|
||||
{
|
||||
double epsilon = 1e-9;
|
||||
Permuter permuter;
|
||||
std::vector<double> vals;
|
||||
vals.push_back(1.0);
|
||||
vals.push_back(2.0);
|
||||
vals.push_back(3.0);
|
||||
vals.push_back(4.0);
|
||||
|
||||
|
||||
double value = 0;
|
||||
|
||||
std::vector<double> vals2;
|
||||
vals2.push_back(9.0);
|
||||
vals2.push_back(8.0);
|
||||
vals2.push_back(7.0);
|
||||
vals2.push_back(6.0);
|
||||
|
||||
double value2;
|
||||
|
||||
std::vector<double> vals3;
|
||||
vals3.push_back(99.0);
|
||||
vals3.push_back(88.0);
|
||||
vals3.push_back(78.0);
|
||||
vals3.push_back(63.0);
|
||||
|
||||
double value3;
|
||||
|
||||
permuter.addOptionSet(vals, &value);
|
||||
permuter.addOptionSet(vals2, &value2);
|
||||
permuter.addOptionSet(vals3, &value3);
|
||||
|
||||
for ( unsigned int k = 0; k < vals3.size(); k++)
|
||||
for ( unsigned int j = 0; j < vals2.size(); j++)
|
||||
for ( unsigned int i = 0; i < vals.size(); i++)
|
||||
{
|
||||
EXPECT_NEAR(vals[i], value, epsilon);
|
||||
EXPECT_NEAR(vals2[j], value2, epsilon);
|
||||
EXPECT_NEAR(vals3[k], value3, epsilon);
|
||||
if (i == vals.size() -1 && j == vals2.size() -1&& k == vals3.size() -1)
|
||||
EXPECT_FALSE(permuter.step());
|
||||
else
|
||||
EXPECT_TRUE(permuter.step());
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TEST(Permuter, DoubleStringPermuteOptions)
|
||||
{
|
||||
double epsilon = 1e-9;
|
||||
Permuter permuter;
|
||||
std::vector<double> vals;
|
||||
vals.push_back(1.0);
|
||||
vals.push_back(2.0);
|
||||
vals.push_back(3.0);
|
||||
vals.push_back(4.0);
|
||||
|
||||
|
||||
double value = 0;
|
||||
|
||||
std::vector<std::string> vals2;
|
||||
vals2.push_back("hi");
|
||||
vals2.push_back("there");
|
||||
vals2.push_back("this");
|
||||
vals2.push_back("works");
|
||||
|
||||
std::string value2;
|
||||
|
||||
permuter.addOptionSet(vals, &value);
|
||||
permuter.addOptionSet(vals2, &value2);
|
||||
|
||||
for ( unsigned int j = 0; j < vals2.size(); j++)
|
||||
for ( unsigned int i = 0; i < vals.size(); i++)
|
||||
{
|
||||
//printf("%f?=%f %s?=%s\n", value, vals[i], value2.c_str(), vals2[j].c_str());
|
||||
EXPECT_NEAR(vals[i], value, epsilon);
|
||||
EXPECT_STREQ(vals2[j].c_str(), value2.c_str());
|
||||
if (i == vals.size() -1 && j == vals2.size() -1)
|
||||
EXPECT_FALSE(permuter.step());
|
||||
else
|
||||
EXPECT_TRUE(permuter.step());
|
||||
};
|
||||
|
||||
}
|
||||
int main(int argc, char **argv){
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
7
thirdparty/ros/ros_comm/tools/rostest/test/time-limit.test
vendored
Normal file
7
thirdparty/ros/ros_comm/tools/rostest/test/time-limit.test
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<launch>
|
||||
<!-- as these tests are designed to fail, they aren't be added to the normal test regression suite.
|
||||
they must be manually run with the knowledge that they will fail -->
|
||||
<test test-name="time_limit_test" pkg="rostest" type="time_limit_test.py" time-limit="1" />
|
||||
<!-- test normal timeout (60 seconds) -->
|
||||
<test test-name="time_limit_test__no_limit" pkg="rostest" type="time_limit_test.py" />
|
||||
</launch>
|
||||
40
thirdparty/ros/ros_comm/tools/rostest/test/time_limit_test.py
vendored
Executable file
40
thirdparty/ros/ros_comm/tools/rostest/test/time_limit_test.py
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
## only point of this test is to be killed within a short period of time
|
||||
|
||||
import rospy
|
||||
|
||||
while not rospy.is_shutdown():
|
||||
pass
|
||||
Reference in New Issue
Block a user