diff --git a/CMakeLists.txt b/CMakeLists.txt index 5798c0ca..4710064c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ endif() set(GOBY_VERSION_MAJOR "2") set(GOBY_VERSION_MINOR "1") -set(GOBY_VERSION_PATCH "11") +set(GOBY_VERSION_PATCH "12") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") message("Compiling in Git source tree.") @@ -51,7 +51,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") else() message("Compiling from release tarball.") - set(GOBY_VERSION_DATE "2018.11.08") + set(GOBY_VERSION_DATE "2019.01.31") endif() set(GOBY_VERSION "${GOBY_VERSION_MAJOR}.${GOBY_VERSION_MINOR}.${GOBY_VERSION_PATCH}") diff --git a/release.txt b/release.txt index 3a323be0..8904da6c 100644 --- a/release.txt +++ b/release.txt @@ -1,5 +1,16 @@ Goby Release Notes (Major version 2) +**************** +Version 2.1.12 + +### Code aesthetics +- Consistent code formatting using clang-format style + +### Bug fixes +- Corrected moos_translator1 unit test for Ubuntu 18.04 + +See https://github.com/GobySoft/goby/compare/2.1.11...2.1.12 + **************** Version 2.1.11 diff --git a/src/moos/moos_protobuf_helpers.h b/src/moos/moos_protobuf_helpers.h index 93c0dc1c..8a1604b4 100644 --- a/src/moos/moos_protobuf_helpers.h +++ b/src/moos/moos_protobuf_helpers.h @@ -575,7 +575,8 @@ class MOOSTranslation::digits10) << refl->GetRepeatedFloat(proto_msg, field_desc, j); + out << std::setprecision(std::numeric_limits::digits10) + << refl->GetRepeatedFloat(proto_msg, field_desc, j); break; case google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE: @@ -635,11 +636,13 @@ class MOOSTranslation::digits10)<< refl->GetFloat(proto_msg, field_desc); + out << std::setprecision(std::numeric_limits::digits10) + << refl->GetFloat(proto_msg, field_desc); break; case google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE: - out << std::setprecision(std::numeric_limits::digits10) << refl->GetDouble(proto_msg, field_desc); + out << std::setprecision(std::numeric_limits::digits10) + << refl->GetDouble(proto_msg, field_desc); break; case google::protobuf::FieldDescriptor::CPPTYPE_ENUM: diff --git a/src/test/moos/translator1/test.cpp b/src/test/moos/translator1/test.cpp index 3d27385f..432a19f7 100644 --- a/src/test/moos/translator1/test.cpp +++ b/src/test/moos/translator1/test.cpp @@ -25,8 +25,8 @@ #include "goby/common/logger.h" #include "goby/moos/moos_translator.h" #include "goby/util/binary.h" -#include "test.pb.h" #include "goby/util/sci.h" +#include "test.pb.h" using namespace goby::moos; @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) CMOOSGeodesy geodesy; geodesy.Initialise(LAT_ORIGIN, LON_ORIGIN); - + goby::glog << translator << std::endl; run_one_in_one_out_test(translator, 0, false); @@ -306,22 +306,27 @@ int main(int argc, char* argv[]) geodesy.UTM2LatLong(report.x(), report.y(), expected_lat, expected_lon); const int LAT_INT_DIGITS = 2; const int LON_INT_DIGITS = 3; - expected_lat = goby::util::unbiased_round(expected_lat, std::numeric_limits::digits10 - LAT_INT_DIGITS-1); - expected_lon = goby::util::unbiased_round(expected_lon, std::numeric_limits::digits10 - LON_INT_DIGITS-1); + expected_lat = goby::util::unbiased_round(expected_lat, std::numeric_limits::digits10 - + LAT_INT_DIGITS - 1); + expected_lon = goby::util::unbiased_round(expected_lon, std::numeric_limits::digits10 - + LON_INT_DIGITS - 1); std::stringstream expected_lat_ss, expected_lon_ss; expected_lat_ss << std::setprecision(std::numeric_limits::digits10) << expected_lat; expected_lon_ss << std::setprecision(std::numeric_limits::digits10) << expected_lon; boost::format expected_lat_fmt("%1%"); boost::format expected_lon_fmt("%1%"); - std::string expected_lat_fmt_str = (expected_lat_fmt % boost::io::group( - std::setprecision(std::numeric_limits::digits10), expected_lat)).str(); - std::string expected_lon_fmt_str = (expected_lon_fmt % boost::io::group( - std::setprecision(std::numeric_limits::digits10), expected_lon)).str(); + std::string expected_lat_fmt_str = + (expected_lat_fmt % + boost::io::group(std::setprecision(std::numeric_limits::digits10), expected_lat)) + .str(); + std::string expected_lon_fmt_str = + (expected_lon_fmt % + boost::io::group(std::setprecision(std::numeric_limits::digits10), expected_lon)) + .str(); std::string expected_lat_key_values_str = expected_lat_ss.str(); std::string expected_lon_key_values_str = expected_lon_ss.str(); - - + for (std::multimap::const_iterator it = moos_msgs.begin(), n = moos_msgs.end(); it != n; ++it) @@ -329,20 +334,25 @@ int main(int argc, char* argv[]) goby::glog << "Variable: " << it->first << "\n" << "Value: " << it->second.GetString() << std::endl; - goby::glog << "Expected lat (FORMAT): " << expected_lat_fmt_str << std::endl; - goby::glog << "Expected lon (FORMAT): " << expected_lon_fmt_str << std::endl; - goby::glog << "Expected lat (KEY_VALUES): " << expected_lat_key_values_str << std::endl; - goby::glog << "Expected lon (KEY_VALUES): " << expected_lon_key_values_str << std::endl; + goby::glog << "Expected lat (FORMAT): " << expected_lat_fmt_str << std::endl; + goby::glog << "Expected lon (FORMAT): " << expected_lon_fmt_str << std::endl; + goby::glog << "Expected lat (KEY_VALUES): " << expected_lat_key_values_str << std::endl; + goby::glog << "Expected lon (KEY_VALUES): " << expected_lon_key_values_str << std::endl; if (it->first == "NODE_REPORT_FORMAT") assert(it->second.GetString() == - std::string("NAME=unicorn,X=550,Y=1023.5,HEADING=240,REPEAT={};LAT=") + expected_lat_fmt_str + ";LON=" + expected_lon_fmt_str + - ";X+Y=1573.5,X-Y=-473.5"); + std::string("NAME=unicorn,X=550,Y=1023.5,HEADING=240,REPEAT={};LAT=") + + expected_lat_fmt_str + ";LON=" + expected_lon_fmt_str + + ";X+Y=1573.5,X-Y=-473.5"); else if (it->first == "NODE_REPORT_KEY_VALUE") assert(it->second.GetString() == - std::string("Name=unicorn,x=550,y=1023.5,heading=240,utm_y2lat(y)=") + expected_lat_key_values_str + ",utm_x2lon(" - "x)=" + expected_lon_key_values_str + ",name2modem_id(Name)=3,name2modem_id+modem_id2type+to_upper(" - "Name)=AUV,add(x)=1573.5,subtract(x)=-473.5"); + std::string("Name=unicorn,x=550,y=1023.5,heading=240,utm_y2lat(y)=") + + expected_lat_key_values_str + + ",utm_x2lon(" + "x)=" + + expected_lon_key_values_str + + ",name2modem_id(Name)=3,name2modem_id+modem_id2type+to_upper(" + "Name)=AUV,add(x)=1573.5,subtract(x)=-473.5"); } std::string sub_message_format_str = "em.val=%17:1%";