test_rosparam_utils.cpp
Go to the documentation of this file.
00001 #include "jsk_topic_tools/rosparam_utils.h"
00002 #include <XmlRpcValue.h>
00003 #include <gtest/gtest.h>
00004 
00005 
00006 TEST(RoparamUtils, testGetXmlDoubleValue){
00007   // type int
00008   XmlRpc::XmlRpcValue v = 1;
00009   EXPECT_EQ(XmlRpc::XmlRpcValue::TypeInt, v.getType());
00010   EXPECT_EQ(1.0, jsk_topic_tools::getXMLDoubleValue(v));
00011   // type double
00012   v = 1.0;
00013   EXPECT_EQ(XmlRpc::XmlRpcValue::TypeDouble, v.getType());
00014   EXPECT_EQ(1.0, jsk_topic_tools::getXMLDoubleValue(v));
00015   // test unparsable param
00016   try {
00017     v = "-.3";
00018     EXPECT_EQ(-0.3, jsk_topic_tools::getXMLDoubleValue(v));
00019   } catch (std::runtime_error &e) {
00020     SUCCEED() << "Not parsable value";
00021     return;
00022   }
00023 }
00024 
00025 int main(int argc, char **argv){
00026   testing::InitGoogleTest(&argc, argv);
00027   return RUN_ALL_TESTS();
00028 }


jsk_topic_tools
Author(s): Kei Okada , Yusuke Furuta
autogenerated on Fri Sep 8 2017 03:38:56