Files
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +02:00

38 lines
1.3 KiB
C++

#include <gtest/gtest.h>
#include <vanetza/gnss/nmea.hpp>
#include <vanetza/gnss/wgs84point.hpp>
#include <string>
using namespace vanetza;
TEST(NMEA, gprmc) {
using namespace boost::posix_time;
using namespace boost::gregorian;
nmea::time time(date(2013, 12, 5), time_duration(10, 32, 15));
Wgs84Point position(49.8234932 * units::degree, -12.5343 * units::degree);
units::NauticalVelocity speed(9.358 * units::metric::knots);
units::TrueNorth heading(273.4 * units::true_north_degrees);
std::string rmc = nmea::gprmc(time, position, speed, heading);
EXPECT_EQ("$GPRMC,103215,A,4949.4096,N,1232.0580,W,9.4,273.4,051213,1.0,E,A*33", rmc);
}
TEST(NMEA, gpgga) {
using namespace boost::posix_time;
using namespace boost::gregorian;
nmea::time time(date(2013, 11, 30), time_duration(19, 55, 59));
Wgs84Point position(-0.34 * units::degree, 165.39999 * units::degree);
nmea::Quality quality = nmea::Quality::DGPS;
units::Length hdop = 3.532 * units::si::meters;
std::string gga = nmea::gpgga(time, position, quality, hdop);
EXPECT_EQ("$GPGGA,195559.000000,0020.4000,S,16523.9994,E,2,06,3.5,0.0,M,0.0,M,,*4E", gga);
}
TEST(NMEA, checksum) {
std::string s = {0, 1, 2, 3, 4, 5};
auto c = nmea::checksum(s.begin(), s.end());
EXPECT_EQ(c, 0x01);
}