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.
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
#include <gtest/gtest.h>
|
|
#include <vanetza/asn1/asn1c_wrapper.hpp>
|
|
#include <vanetza/asn1/cam.hpp>
|
|
#include <vanetza/asn1/denm.hpp>
|
|
#include <vanetza/asn1/mapem.hpp>
|
|
#include <vanetza/asn1/spatem.hpp>
|
|
#include <vanetza/asn1/ssem.hpp>
|
|
#include <vanetza/asn1/srem.hpp>
|
|
#include <vanetza/asn1/ivim.hpp>
|
|
#include <vanetza/asn1/its/TimestampIts.h>
|
|
|
|
using namespace vanetza;
|
|
|
|
TEST(ItsAsn1, max_timestamp_roundtrip)
|
|
{
|
|
const std::int64_t max_timestamp = 4398046511103;
|
|
asn1::asn1c_wrapper<TimestampIts_t> tx { asn_DEF_TimestampIts };
|
|
asn_imax2INTEGER(&*tx, max_timestamp);
|
|
auto buffer = tx.encode();
|
|
EXPECT_EQ(6, buffer.size());
|
|
asn1::asn1c_wrapper<TimestampIts_t> rx { asn_DEF_TimestampIts };
|
|
EXPECT_TRUE(rx.decode(buffer));
|
|
std::int64_t rx_timestamp = 0;
|
|
asn_INTEGER2imax(&*tx, &rx_timestamp);
|
|
EXPECT_EQ(rx_timestamp, max_timestamp);
|
|
}
|
|
|
|
TEST(ItsAsn1, encode_denm)
|
|
{
|
|
asn1::Denm denm;
|
|
EXPECT_EQ(0, asn_uint642INTEGER(&denm->denm.management.detectionTime, TimestampIts_utcStartOf2004));
|
|
EXPECT_EQ(0, asn_uint642INTEGER(&denm->denm.management.referenceTime, TimestampIts_utcStartOf2004));
|
|
EXPECT_TRUE(denm.validate());
|
|
vanetza::ByteBuffer buf = denm.encode();
|
|
EXPECT_EQ(40, buf.size());
|
|
}
|
|
|
|
TEST(ItsAsn1, create_cam)
|
|
{
|
|
asn1::Cam cam;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_denm)
|
|
{
|
|
asn1::Denm denm;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_mapem)
|
|
{
|
|
asn1::Mapem mapem;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_spatem)
|
|
{
|
|
asn1::Spatem spatem;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_srem)
|
|
{
|
|
asn1::Srem srem;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_ssem)
|
|
{
|
|
asn1::Ssem ssem;
|
|
}
|
|
|
|
TEST(ItsAsn1, create_ivim)
|
|
{
|
|
asn1::Ivim ivim;
|
|
}
|
|
|