obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
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
|