1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Improve test

This commit is contained in:
Carles Fernandez 2021-02-23 09:55:14 +01:00
parent 3b10e37a6f
commit ae018f829c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -31,17 +31,33 @@ TEST(Serdes_Monitor_Pvt_Test, Simpletest)
mon.ParseFromString(serialized_data); mon.ParseFromString(serialized_data);
double read_latitude = mon.latitude(); double read_latitude = mon.latitude();
EXPECT_NEAR(true_latitude, read_latitude, 0.000001); EXPECT_NEAR(true_latitude, read_latitude, 0.000001);
}
TEST(Serdes_Monitor_Pvt_Test, GalileoEphemerisSerdes)
{
auto eph = std::make_shared<Galileo_Ephemeris>(); auto eph = std::make_shared<Galileo_Ephemeris>();
int true_tow = 12345; int true_tow = 12345;
eph->tow = true_tow; eph->tow = true_tow;
Serdes_Galileo_Eph gal_serdes = Serdes_Galileo_Eph(); Serdes_Galileo_Eph gal_serdes = Serdes_Galileo_Eph();
serialized_data = gal_serdes.createProtobuffer(eph); std::string serialized_data = gal_serdes.createProtobuffer(eph);
gnss_sdr::GalileoEphemeris ephgal; gnss_sdr::GalileoEphemeris ephgal;
ephgal.ParseFromString(serialized_data); ephgal.ParseFromString(serialized_data);
double true_delta_n = 0.33;
ephgal.set_delta_n(true_delta_n);
int read_tow = ephgal.tow(); int read_tow = ephgal.tow();
EXPECT_EQ(true_tow, read_tow); EXPECT_EQ(true_tow, read_tow);
double read_delta_n = ephgal.delta_n();
EXPECT_NEAR(true_delta_n, read_delta_n, 0.000001);
auto eph2 = gal_serdes.readProtobuffer(ephgal);
double read2_delta_n = eph2.delta_n;
int read2_tow = eph2.tow;
EXPECT_EQ(true_tow, read2_tow);
EXPECT_NEAR(true_delta_n, read2_delta_n, 0.000001);
} }