#include #include #include #include #include #include #include #include #include #include using namespace vanetza; TEST(ItsAsn1, max_timestamp_roundtrip) { const std::int64_t max_timestamp = 4398046511103; asn1::asn1c_wrapper tx { asn_DEF_TimestampIts }; asn_imax2INTEGER(&*tx, max_timestamp); auto buffer = tx.encode(); EXPECT_EQ(6, buffer.size()); asn1::asn1c_wrapper 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; }