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.
88 lines
2.5 KiB
C++
88 lines
2.5 KiB
C++
#include <gtest/gtest.h>
|
|
#include <vanetza/common/annotation.hpp>
|
|
#include <vanetza/security/v2/tests/check_region.hpp>
|
|
#include <vanetza/security/v2/tests/check_visitor.hpp>
|
|
#include <boost/format.hpp>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace security
|
|
{
|
|
namespace v2
|
|
{
|
|
|
|
void check(const ThreeDLocation& expected, const ThreeDLocation& actual)
|
|
{
|
|
EXPECT_EQ(expected.latitude, actual.latitude);
|
|
EXPECT_EQ(expected.longitude, actual.longitude);
|
|
EXPECT_EQ(expected.elevation, actual.elevation);
|
|
}
|
|
|
|
void check(const TwoDLocation& expected, const TwoDLocation& actual)
|
|
{
|
|
EXPECT_EQ(expected.longitude, actual.longitude);
|
|
EXPECT_EQ(expected.latitude, actual.latitude);
|
|
}
|
|
|
|
void check(const NoneRegion& expected, const NoneRegion& actual)
|
|
{
|
|
mark_unused(expected);
|
|
mark_unused(actual);
|
|
SCOPED_TRACE("None");
|
|
}
|
|
|
|
void check(const CircularRegion& expected, const CircularRegion& actual)
|
|
{
|
|
SCOPED_TRACE("CiruclarRegion");
|
|
check(expected.center, actual.center);
|
|
EXPECT_EQ(expected.radius, actual.radius);
|
|
}
|
|
|
|
void check(const RectangularRegion& expected, const RectangularRegion& actual)
|
|
{
|
|
SCOPED_TRACE("RectangularRegion");
|
|
check(expected.northwest, actual.northwest);
|
|
check(expected.southeast, actual.southeast);
|
|
}
|
|
|
|
void check(std::list<RectangularRegion> expected, std::list<RectangularRegion> actual)
|
|
{
|
|
SCOPED_TRACE("list<RectangularRegion>");
|
|
ASSERT_EQ(expected.size(), actual.size());
|
|
for (std::size_t i = 0, j = expected.size(); i < j; ++i) {
|
|
SCOPED_TRACE(boost::format("Rectangle #%1%") % i);
|
|
check(expected.front(), actual.front());
|
|
expected.pop_front();
|
|
actual.pop_front();
|
|
}
|
|
}
|
|
|
|
void check(PolygonalRegion expected, PolygonalRegion actual)
|
|
{
|
|
SCOPED_TRACE("PolygonalRegion");
|
|
ASSERT_EQ(expected.size(), actual.size());
|
|
for (std::size_t i = 0, j = expected.size(); i < j; ++i) {
|
|
SCOPED_TRACE(boost::format("Coordinate #%1%") % i);
|
|
check(expected.front(), actual.front());
|
|
expected.pop_front();
|
|
actual.pop_front();
|
|
}
|
|
}
|
|
|
|
void check(const IdentifiedRegion& expected, const IdentifiedRegion& actual)
|
|
{
|
|
EXPECT_EQ(expected.region_dictionary, actual.region_dictionary);
|
|
EXPECT_EQ(expected.region_identifier, actual.region_identifier);
|
|
EXPECT_EQ(expected.local_region, actual.local_region);
|
|
}
|
|
|
|
void check(const GeographicRegion& expected, const GeographicRegion& actual)
|
|
{
|
|
ASSERT_EQ(get_type(expected), get_type(actual));
|
|
boost::apply_visitor(check_visitor<GeographicRegion>(), expected, actual);
|
|
}
|
|
|
|
} // namespace v2
|
|
} // namespace security
|
|
} // namespace vanetza
|