1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Add test for the serdes_monitor_pvt class

This commit is contained in:
Carles Fernandez 2019-04-21 11:46:33 +02:00
parent 1b96e0a81d
commit 2cba1c5e0a
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 48 additions and 0 deletions

View File

@ -120,6 +120,7 @@ DECLARE_string(log_dir);
#include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc"
#include "unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc"
#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc" #include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" #include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" #include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc"

View File

@ -0,0 +1,47 @@
/*!
* \file serdes_monitor_pvt_test.cc
* \brief Implements Unit Test for the serdes_monitor_pvt class.
* \author Carles Fernandez_prades, 2019. cfernandez(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "serdes_monitor_pvt.h"
TEST(Serdes_Monitor_Pvt_Test, Simpletest)
{
Monitor_Pvt monitor = Monitor_Pvt();
double true_latitude = 23.4;
monitor.latitude = true_latitude;
Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt();
std::string serialized_data = serdes.createProtobuffer(monitor);
gnss_sdr::MonitorPvt mon;
mon.ParseFromString(serialized_data);
double read_latitude = mon.latitude();
EXPECT_NEAR(true_latitude, read_latitude, 0.000001);
}